From 950c06f26e29c859860a571cf51a34e6bca9722e Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Thu, 13 Feb 2020 21:47:01 -0500 Subject: [PATCH] Bump default dts to 2015 --- scripts/importTypescript.js | 2 +- src/lib/lib.ts | 4 ---- src/tsWorker.ts | 14 +++++++------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/importTypescript.js b/scripts/importTypescript.js index eaa9b93d..7464e66c 100644 --- a/scripts/importTypescript.js +++ b/scripts/importTypescript.js @@ -118,7 +118,7 @@ function importLibs() { }; enqueue(''); - enqueue('es6'); + enqueue('es2015'); var result = []; while (queue.length > 0) { diff --git a/src/lib/lib.ts b/src/lib/lib.ts index fd51683f..6b43acc9 100644 --- a/src/lib/lib.ts +++ b/src/lib/lib.ts @@ -21,8 +21,6 @@ export const lib_es2015_collection_dts: string = "/*! ************************** export const lib_es2015_core_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n\ninterface Array {\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;\n find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: T, start?: number, end?: number): this;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n}\n\ninterface ArrayConstructor {\n /**\n * Creates an array from an array-like object.\n * @param arrayLike An array-like object to convert to an array.\n */\n from(arrayLike: ArrayLike): T[];\n\n /**\n * Creates an array from an iterable object.\n * @param arrayLike An array-like object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[];\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: T[]): T[];\n}\n\ninterface DateConstructor {\n new (value: number | string | Date): Date;\n}\n\ninterface Function {\n /**\n * Returns the name of the function. Function names are read-only and can not be changed.\n */\n readonly name: string;\n}\n\ninterface Math {\n /**\n * Returns the number of leading zero bits in the 32-bit binary representation of a number.\n * @param x A numeric expression.\n */\n clz32(x: number): number;\n\n /**\n * Returns the result of 32-bit multiplication of two numbers.\n * @param x First number\n * @param y Second number\n */\n imul(x: number, y: number): number;\n\n /**\n * Returns the sign of the x, indicating whether x is positive, negative or zero.\n * @param x The numeric expression to test\n */\n sign(x: number): number;\n\n /**\n * Returns the base 10 logarithm of a number.\n * @param x A numeric expression.\n */\n log10(x: number): number;\n\n /**\n * Returns the base 2 logarithm of a number.\n * @param x A numeric expression.\n */\n log2(x: number): number;\n\n /**\n * Returns the natural logarithm of 1 + x.\n * @param x A numeric expression.\n */\n log1p(x: number): number;\n\n /**\n * Returns the result of (e^x - 1), which is an implementation-dependent approximation to\n * subtracting 1 from the exponential function of x (e raised to the power of x, where e\n * is the base of the natural logarithms).\n * @param x A numeric expression.\n */\n expm1(x: number): number;\n\n /**\n * Returns the hyperbolic cosine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n cosh(x: number): number;\n\n /**\n * Returns the hyperbolic sine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n sinh(x: number): number;\n\n /**\n * Returns the hyperbolic tangent of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n tanh(x: number): number;\n\n /**\n * Returns the inverse hyperbolic cosine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n acosh(x: number): number;\n\n /**\n * Returns the inverse hyperbolic sine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n asinh(x: number): number;\n\n /**\n * Returns the inverse hyperbolic tangent of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n atanh(x: number): number;\n\n /**\n * Returns the square root of the sum of squares of its arguments.\n * @param values Values to compute the square root for.\n * If no arguments are passed, the result is +0.\n * If there is only one argument, the result is the absolute value.\n * If any argument is +Infinity or -Infinity, the result is +Infinity.\n * If any argument is NaN, the result is NaN.\n * If all arguments are either +0 or −0, the result is +0.\n */\n hypot(...values: number[]): number;\n\n /**\n * Returns the integral part of the a numeric expression, x, removing any fractional digits.\n * If x is already an integer, the result is x.\n * @param x A numeric expression.\n */\n trunc(x: number): number;\n\n /**\n * Returns the nearest single precision float representation of a number.\n * @param x A numeric expression.\n */\n fround(x: number): number;\n\n /**\n * Returns an implementation-dependent approximation to the cube root of number.\n * @param x A numeric expression.\n */\n cbrt(x: number): number;\n}\n\ninterface NumberConstructor {\n /**\n * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1\n * that is representable as a Number value, which is approximately:\n * 2.2204460492503130808472633361816 x 10‍−‍16.\n */\n readonly EPSILON: number;\n\n /**\n * Returns true if passed value is finite.\n * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a\n * number. Only finite values of the type number, result in true.\n * @param number A numeric value.\n */\n isFinite(number: number): boolean;\n\n /**\n * Returns true if the value passed is an integer, false otherwise.\n * @param number A numeric value.\n */\n isInteger(number: number): boolean;\n\n /**\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a\n * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter\n * to a number. Only values of the type number, that are also NaN, result in true.\n * @param number A numeric value.\n */\n isNaN(number: number): boolean;\n\n /**\n * Returns true if the value passed is a safe integer.\n * @param number A numeric value.\n */\n isSafeInteger(number: number): boolean;\n\n /**\n * The value of the largest integer n such that n and n + 1 are both exactly representable as\n * a Number value.\n * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.\n */\n readonly MAX_SAFE_INTEGER: number;\n\n /**\n * The value of the smallest integer n such that n and n − 1 are both exactly representable as\n * a Number value.\n * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).\n */\n readonly MIN_SAFE_INTEGER: number;\n\n /**\n * Converts a string to a floating-point number.\n * @param string A string that contains a floating-point number.\n */\n parseFloat(string: string): number;\n\n /**\n * Converts A string to an integer.\n * @param s A string to convert into a number.\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n * All other strings are considered decimal.\n */\n parseInt(string: string, radix?: number): number;\n}\n\ninterface ObjectConstructor {\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param source The source object from which to copy properties.\n */\n assign(target: T, source: U): T & U;\n\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param source1 The first source object from which to copy properties.\n * @param source2 The second source object from which to copy properties.\n */\n assign(target: T, source1: U, source2: V): T & U & V;\n\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param source1 The first source object from which to copy properties.\n * @param source2 The second source object from which to copy properties.\n * @param source3 The third source object from which to copy properties.\n */\n assign(target: T, source1: U, source2: V, source3: W): T & U & V & W;\n\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param sources One or more source objects from which to copy properties\n */\n assign(target: object, ...sources: any[]): any;\n\n /**\n * Returns an array of all symbol properties found directly on object o.\n * @param o Object to retrieve the symbols from.\n */\n getOwnPropertySymbols(o: any): symbol[];\n\n /**\n * Returns the names of the enumerable string properties and methods of an object.\n * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\n */\n keys(o: {}): string[];\n\n /**\n * Returns true if the values are the same value, false otherwise.\n * @param value1 The first value.\n * @param value2 The second value.\n */\n is(value1: any, value2: any): boolean;\n\n /**\n * Sets the prototype of a specified object o to object proto or null. Returns the object o.\n * @param o The object to change its prototype.\n * @param proto The value of the new prototype or null.\n */\n setPrototypeOf(o: any, proto: object | null): any;\n}\n\ninterface ReadonlyArray {\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (this: void, value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;\n find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;\n}\n\ninterface RegExp {\n /**\n * Returns a string indicating the flags of the regular expression in question. This field is read-only.\n * The characters in this string are sequenced and concatenated in the following order:\n *\n * - \"g\" for global\n * - \"i\" for ignoreCase\n * - \"m\" for multiline\n * - \"u\" for unicode\n * - \"y\" for sticky\n *\n * If no flags are set, the value is the empty string.\n */\n readonly flags: string;\n\n /**\n * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular\n * expression. Default is false. Read-only.\n */\n readonly sticky: boolean;\n\n /**\n * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular\n * expression. Default is false. Read-only.\n */\n readonly unicode: boolean;\n}\n\ninterface RegExpConstructor {\n new (pattern: RegExp | string, flags?: string): RegExp;\n (pattern: RegExp | string, flags?: string): RegExp;\n}\n\ninterface String {\n /**\n * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point\n * value of the UTF-16 encoded code point starting at the string element at position pos in\n * the String resulting from converting this object to a String.\n * If there is no element at that position, the result is undefined.\n * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.\n */\n codePointAt(pos: number): number | undefined;\n\n /**\n * Returns true if searchString appears as a substring of the result of converting this\n * object to a String, at one or more positions that are\n * greater than or equal to position; otherwise, returns false.\n * @param searchString search string\n * @param position If position is undefined, 0 is assumed, so as to search all of the String.\n */\n includes(searchString: string, position?: number): boolean;\n\n /**\n * Returns true if the sequence of elements of searchString converted to a String is the\n * same as the corresponding elements of this object (converted to a String) starting at\n * endPosition – length(this). Otherwise returns false.\n */\n endsWith(searchString: string, endPosition?: number): boolean;\n\n /**\n * Returns the String value result of normalizing the string into the normalization form\n * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\n * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\n * is \"NFC\"\n */\n normalize(form: \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\"): string;\n\n /**\n * Returns the String value result of normalizing the string into the normalization form\n * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\n * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\n * is \"NFC\"\n */\n normalize(form?: string): string;\n\n /**\n * Returns a String value that is made from count copies appended together. If count is 0,\n * the empty string is returned.\n * @param count number of copies to append\n */\n repeat(count: number): string;\n\n /**\n * Returns true if the sequence of elements of searchString converted to a String is the\n * same as the corresponding elements of this object (converted to a String) starting at\n * position. Otherwise returns false.\n */\n startsWith(searchString: string, position?: number): boolean;\n\n /**\n * Returns an HTML anchor element and sets the name attribute to the text value\n * @param name\n */\n anchor(name: string): string;\n\n /** Returns a HTML element */\n big(): string;\n\n /** Returns a HTML element */\n blink(): string;\n\n /** Returns a HTML element */\n bold(): string;\n\n /** Returns a HTML element */\n fixed(): string;\n\n /** Returns a HTML element and sets the color attribute value */\n fontcolor(color: string): string;\n\n /** Returns a HTML element and sets the size attribute value */\n fontsize(size: number): string;\n\n /** Returns a HTML element and sets the size attribute value */\n fontsize(size: string): string;\n\n /** Returns an HTML element */\n italics(): string;\n\n /** Returns an HTML element and sets the href attribute value */\n link(url: string): string;\n\n /** Returns a HTML element */\n small(): string;\n\n /** Returns a HTML element */\n strike(): string;\n\n /** Returns a HTML element */\n sub(): string;\n\n /** Returns a HTML element */\n sup(): string;\n}\n\ninterface StringConstructor {\n /**\n * Return the String value whose elements are, in order, the elements in the List elements.\n * If length is 0, the empty string is returned.\n */\n fromCodePoint(...codePoints: number[]): string;\n\n /**\n * String.raw is intended for use as a tag function of a Tagged Template String. When called\n * as such the first argument will be a well formed template call site object and the rest\n * parameter will contain the substitution values.\n * @param template A well-formed template string call site representation.\n * @param substitutions A set of substitution values.\n */\n raw(template: TemplateStringsArray, ...substitutions: any[]): string;\n}\n"; -export const lib_dom_iterable_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n\n/////////////////////////////\n/// DOM Iterable APIs\n/////////////////////////////\n\ninterface AudioParam {\n setValueCurveAtTime(values: Iterable, startTime: number, duration: number): AudioParam;\n}\n\ninterface AudioParamMap extends ReadonlyMap {\n}\n\ninterface AudioTrackList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface BaseAudioContext {\n createIIRFilter(feedforward: Iterable, feedback: Iterable): IIRFilterNode;\n createPeriodicWave(real: Iterable, imag: Iterable, constraints?: PeriodicWaveConstraints): PeriodicWave;\n}\n\ninterface CSSRuleList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface CSSStyleDeclaration {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface Cache {\n addAll(requests: Iterable): Promise;\n}\n\ninterface CanvasPathDrawingStyles {\n setLineDash(segments: Iterable): void;\n}\n\ninterface ClientRectList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface DOMRectList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface DOMStringList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface DOMTokenList {\n [Symbol.iterator](): IterableIterator;\n entries(): IterableIterator<[number, string]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n}\n\ninterface DataTransferItemList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface FileList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface FormData {\n [Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;\n /**\n * Returns an array of key, value pairs for every entry in the list.\n */\n entries(): IterableIterator<[string, FormDataEntryValue]>;\n /**\n * Returns a list of keys in the list.\n */\n keys(): IterableIterator;\n /**\n * Returns a list of values in the list.\n */\n values(): IterableIterator;\n}\n\ninterface HTMLAllCollection {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface HTMLCollectionBase {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface HTMLCollectionOf {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface HTMLFormElement {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface HTMLSelectElement {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface Headers {\n [Symbol.iterator](): IterableIterator<[string, string]>;\n /**\n * Returns an iterator allowing to go through all key/value pairs contained in this object.\n */\n entries(): IterableIterator<[string, string]>;\n /**\n * Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.\n */\n keys(): IterableIterator;\n /**\n * Returns an iterator allowing to go through all values of the key/value pairs contained in this object.\n */\n values(): IterableIterator;\n}\n\ninterface IDBObjectStore {\n /**\n * Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a \"ConstraintError\" DOMException.\n * \n * Throws an \"InvalidStateError\" DOMException if not called within an upgrade transaction.\n */\n createIndex(name: string, keyPath: string | Iterable, options?: IDBIndexParameters): IDBIndex;\n}\n\ninterface MediaKeyStatusMap {\n [Symbol.iterator](): IterableIterator<[BufferSource, MediaKeyStatus]>;\n entries(): IterableIterator<[BufferSource, MediaKeyStatus]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n}\n\ninterface MediaList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface MimeTypeArray {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface NamedNodeMap {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface Navigator {\n requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable): Promise;\n}\n\ninterface NodeList {\n [Symbol.iterator](): IterableIterator;\n /**\n * Returns an array of key, value pairs for every entry in the list.\n */\n entries(): IterableIterator<[number, Node]>;\n /**\n * Returns an list of keys in the list.\n */\n keys(): IterableIterator;\n /**\n * Returns an list of values in the list.\n */\n values(): IterableIterator;\n}\n\ninterface NodeListOf {\n [Symbol.iterator](): IterableIterator;\n /**\n * Returns an array of key, value pairs for every entry in the list.\n */\n entries(): IterableIterator<[number, TNode]>;\n /**\n * Returns an list of keys in the list.\n */\n keys(): IterableIterator;\n /**\n * Returns an list of values in the list.\n */\n values(): IterableIterator;\n}\n\ninterface Plugin {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface PluginArray {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface RTCRtpTransceiver {\n setCodecPreferences(codecs: Iterable): void;\n}\n\ninterface RTCStatsReport extends ReadonlyMap {\n}\n\ninterface SVGLengthList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SVGNumberList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SVGPointList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SVGStringList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SourceBufferList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SpeechGrammarList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SpeechRecognitionResult {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface SpeechRecognitionResultList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface StyleSheetList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface TextTrackCueList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface TextTrackList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface TouchList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface URLSearchParams {\n [Symbol.iterator](): IterableIterator<[string, string]>;\n /**\n * Returns an array of key, value pairs for every entry in the search params.\n */\n entries(): IterableIterator<[string, string]>;\n /**\n * Returns a list of keys in the search params.\n */\n keys(): IterableIterator;\n /**\n * Returns a list of values in the search params.\n */\n values(): IterableIterator;\n}\n\ninterface VRDisplay {\n requestPresent(layers: Iterable): Promise;\n}\n\ninterface VideoTrackList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface WEBGL_draw_buffers {\n drawBuffersWEBGL(buffers: Iterable): void;\n}\n\ninterface WebAuthentication {\n makeCredential(accountInformation: Account, cryptoParameters: Iterable, attestationChallenge: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, options?: ScopedCredentialOptions): Promise;\n}\n\ninterface WebGL2RenderingContextBase {\n clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Iterable, srcOffset?: GLuint): void;\n clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Iterable, srcOffset?: GLuint): void;\n clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Iterable, srcOffset?: GLuint): void;\n drawBuffers(buffers: Iterable): void;\n getActiveUniforms(program: WebGLProgram, uniformIndices: Iterable, pname: GLenum): any;\n getUniformIndices(program: WebGLProgram, uniformNames: Iterable): Iterable | null;\n invalidateFramebuffer(target: GLenum, attachments: Iterable): void;\n invalidateSubFramebuffer(target: GLenum, attachments: Iterable, x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;\n transformFeedbackVaryings(program: WebGLProgram, varyings: Iterable, bufferMode: GLenum): void;\n uniform1uiv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform2uiv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform3uiv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform4uiv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n vertexAttribI4iv(index: GLuint, values: Iterable): void;\n vertexAttribI4uiv(index: GLuint, values: Iterable): void;\n}\n\ninterface WebGL2RenderingContextOverloads {\n uniform1fv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform1iv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform2fv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform2iv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform3fv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform3iv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform4fv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniform4iv(location: WebGLUniformLocation | null, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable, srcOffset?: GLuint, srcLength?: GLuint): void;\n}\n\ninterface WebGLRenderingContextBase {\n vertexAttrib1fv(index: GLuint, values: Iterable): void;\n vertexAttrib2fv(index: GLuint, values: Iterable): void;\n vertexAttrib3fv(index: GLuint, values: Iterable): void;\n vertexAttrib4fv(index: GLuint, values: Iterable): void;\n}\n\ninterface WebGLRenderingContextOverloads {\n uniform1fv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform1iv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform2fv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform2iv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform3fv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform3iv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform4fv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniform4iv(location: WebGLUniformLocation | null, v: Iterable): void;\n uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable): void;\n uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable): void;\n uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable): void;\n}\n"; - export const lib_scripthost_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n\n\n\n/////////////////////////////\n/// Windows Script Host APIS\n/////////////////////////////\n\n\ninterface ActiveXObject {\n new (s: string): any;\n}\ndeclare var ActiveXObject: ActiveXObject;\n\ninterface ITextWriter {\n Write(s: string): void;\n WriteLine(s: string): void;\n Close(): void;\n}\n\ninterface TextStreamBase {\n /**\n * The column number of the current character position in an input stream.\n */\n Column: number;\n\n /**\n * The current line number in an input stream.\n */\n Line: number;\n\n /**\n * Closes a text stream.\n * It is not necessary to close standard streams; they close automatically when the process ends. If\n * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\n */\n Close(): void;\n}\n\ninterface TextStreamWriter extends TextStreamBase {\n /**\n * Sends a string to an output stream.\n */\n Write(s: string): void;\n\n /**\n * Sends a specified number of blank lines (newline characters) to an output stream.\n */\n WriteBlankLines(intLines: number): void;\n\n /**\n * Sends a string followed by a newline character to an output stream.\n */\n WriteLine(s: string): void;\n}\n\ninterface TextStreamReader extends TextStreamBase {\n /**\n * Returns a specified number of characters from an input stream, starting at the current pointer position.\n * Does not return until the ENTER key is pressed.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n Read(characters: number): string;\n\n /**\n * Returns all characters from an input stream.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n ReadAll(): string;\n\n /**\n * Returns an entire line from an input stream.\n * Although this method extracts the newline character, it does not add it to the returned string.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n ReadLine(): string;\n\n /**\n * Skips a specified number of characters when reading from an input text stream.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\n */\n Skip(characters: number): void;\n\n /**\n * Skips the next line when reading from an input text stream.\n * Can only be used on a stream in reading mode, not writing or appending mode.\n */\n SkipLine(): void;\n\n /**\n * Indicates whether the stream pointer position is at the end of a line.\n */\n AtEndOfLine: boolean;\n\n /**\n * Indicates whether the stream pointer position is at the end of a stream.\n */\n AtEndOfStream: boolean;\n}\n\ndeclare var WScript: {\n /**\n * Outputs text to either a message box (under WScript.exe) or the command console window followed by\n * a newline (under CScript.exe).\n */\n Echo(s: any): void;\n\n /**\n * Exposes the write-only error output stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdErr: TextStreamWriter;\n\n /**\n * Exposes the write-only output stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdOut: TextStreamWriter;\n Arguments: { length: number; Item(n: number): string; };\n\n /**\n * The full path of the currently running script.\n */\n ScriptFullName: string;\n\n /**\n * Forces the script to stop immediately, with an optional exit code.\n */\n Quit(exitCode?: number): number;\n\n /**\n * The Windows Script Host build version number.\n */\n BuildVersion: number;\n\n /**\n * Fully qualified path of the host executable.\n */\n FullName: string;\n\n /**\n * Gets/sets the script mode - interactive(true) or batch(false).\n */\n Interactive: boolean;\n\n /**\n * The name of the host executable (WScript.exe or CScript.exe).\n */\n Name: string;\n\n /**\n * Path of the directory containing the host executable.\n */\n Path: string;\n\n /**\n * The filename of the currently running script.\n */\n ScriptName: string;\n\n /**\n * Exposes the read-only input stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdIn: TextStreamReader;\n\n /**\n * Windows Script Host version\n */\n Version: string;\n\n /**\n * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\n */\n ConnectObject(objEventSource: any, strPrefix: string): void;\n\n /**\n * Creates a COM object.\n * @param strProgiID\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n */\n CreateObject(strProgID: string, strPrefix?: string): any;\n\n /**\n * Disconnects a COM object from its event sources.\n */\n DisconnectObject(obj: any): void;\n\n /**\n * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\n * @param strPathname Fully qualified path to the file containing the object persisted to disk.\n * For objects in memory, pass a zero-length string.\n * @param strProgID\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n */\n GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\n\n /**\n * Suspends script execution for a specified length of time, then continues execution.\n * @param intTime Interval (in milliseconds) to suspend script execution.\n */\n Sleep(intTime: number): void;\n};\n\n/**\n * WSH is an alias for WScript under Windows Script Host\n */\ndeclare var WSH: typeof WScript;\n\n/**\n * Represents an Automation SAFEARRAY\n */\ndeclare class SafeArray {\n private constructor();\n private SafeArray_typekey: SafeArray;\n}\n\n/**\n * Allows enumerating over a COM collection, which may not have indexed item access.\n */\ninterface Enumerator {\n /**\n * Returns true if the current item is the last one in the collection, or the collection is empty,\n * or the current item is undefined.\n */\n atEnd(): boolean;\n\n /**\n * Returns the current item in the collection\n */\n item(): T;\n\n /**\n * Resets the current item in the collection to the first item. If there are no items in the collection,\n * the current item is set to undefined.\n */\n moveFirst(): void;\n\n /**\n * Moves the current item to the next item in the collection. If the enumerator is at the end of\n * the collection or the collection is empty, the current item is set to undefined.\n */\n moveNext(): void;\n}\n\ninterface EnumeratorConstructor {\n new (safearray: SafeArray): Enumerator;\n new (collection: { Item(index: any): T }): Enumerator;\n new (collection: any): Enumerator;\n}\n\ndeclare var Enumerator: EnumeratorConstructor;\n\n/**\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\n */\ninterface VBArray {\n /**\n * Returns the number of dimensions (1-based).\n */\n dimensions(): number;\n\n /**\n * Takes an index for each dimension in the array, and returns the item at the corresponding location.\n */\n getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\n\n /**\n * Returns the smallest available index for a given dimension.\n * @param dimension 1-based dimension (defaults to 1)\n */\n lbound(dimension?: number): number;\n\n /**\n * Returns the largest available index for a given dimension.\n * @param dimension 1-based dimension (defaults to 1)\n */\n ubound(dimension?: number): number;\n\n /**\n * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\n * each successive dimension is appended to the end of the array.\n * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\n */\n toArray(): T[];\n}\n\ninterface VBArrayConstructor {\n new (safeArray: SafeArray): VBArray;\n}\n\ndeclare var VBArray: VBArrayConstructor;\n\n/**\n * Automation date (VT_DATE)\n */\ndeclare class VarDate {\n private constructor();\n private VarDate_typekey: VarDate;\n}\n\ninterface DateConstructor {\n new (vd: VarDate): Date;\n}\n\ninterface Date {\n getVarDate: () => VarDate;\n}\n"; export const lib_webworker_importscripts_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n\n\n/////////////////////////////\n/// WorkerGlobalScope APIs\n/////////////////////////////\n// These are only available in a Web Worker\ndeclare function importScripts(...urls: string[]): void;\n"; @@ -33,6 +31,4 @@ export const lib_es5_dts: string = "/*! **************************************** export const lib_es2015_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n" + lib_es5_dts + "" + lib_es2015_core_dts + "" + lib_es2015_collection_dts + "" + lib_es2015_generator_dts + "" + lib_es2015_promise_dts + "" + lib_es2015_iterable_dts + "" + lib_es2015_proxy_dts + "" + lib_es2015_reflect_dts + "" + lib_es2015_symbol_dts + "" + lib_es2015_symbol_wellknown_dts + ""; -export const lib_es6_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n" + lib_es2015_dts + "" + lib_dom_dts + "" + lib_dom_iterable_dts + "" + lib_webworker_importscripts_dts + "" + lib_scripthost_dts + ""; - export const lib_dts: string = "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n" + lib_es5_dts + "" + lib_dom_dts + "" + lib_webworker_importscripts_dts + "" + lib_scripthost_dts + ""; diff --git a/src/tsWorker.ts b/src/tsWorker.ts index 32b9a6bb..e9ece356 100644 --- a/src/tsWorker.ts +++ b/src/tsWorker.ts @@ -5,7 +5,7 @@ 'use strict'; import * as ts from './lib/typescriptServices'; -import { lib_dts, lib_es6_dts } from './lib/lib'; +import { lib_dts, lib_es2015_dts } from './lib/lib'; import { IExtraLibs } from './monaco.contribution'; import IWorkerContext = monaco.worker.IWorkerContext; @@ -15,9 +15,9 @@ const DEFAULT_LIB = { CONTENTS: lib_dts }; -const ES6_LIB = { - NAME: 'defaultLib:lib.es6.d.ts', - CONTENTS: lib_es6_dts +const ES2015_LIB = { + NAME: 'defaultLib:lib.es2015.d.ts', + CONTENTS: lib_es2015_dts }; export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.languages.typescript.TypeScriptWorker { @@ -82,8 +82,8 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language } else if (fileName === DEFAULT_LIB.NAME) { text = DEFAULT_LIB.CONTENTS; - } else if (fileName === ES6_LIB.NAME) { - text = ES6_LIB.CONTENTS; + } else if (fileName === ES2015_LIB.NAME) { + text = ES2015_LIB.CONTENTS; } else { return; } @@ -114,7 +114,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language getDefaultLibFileName(options: ts.CompilerOptions): string { // TODO@joh support lib.es7.d.ts - return (options.target || ts.ScriptTarget.ES5) <= ts.ScriptTarget.ES5 ? DEFAULT_LIB.NAME : ES6_LIB.NAME; + return (options.target || ts.ScriptTarget.ES2015) <= ts.ScriptTarget.ES2015 ? DEFAULT_LIB.NAME : ES2015_LIB.NAME; } isDefaultLibFileName(fileName: string): boolean {