mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into omitComments
Conflicts: src/compiler/emitter.ts
This commit is contained in:
+7
-4
@@ -141,7 +141,10 @@ var harnessSources = harnessCoreSources.concat([
|
||||
"session.ts",
|
||||
"versionCache.ts",
|
||||
"convertToBase64.ts",
|
||||
"transpile.ts"
|
||||
"transpile.ts",
|
||||
"reuseProgramStructure.ts",
|
||||
"cachingInServerLSHost.ts",
|
||||
"moduleResolution.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
@@ -155,10 +158,10 @@ var harnessSources = harnessCoreSources.concat([
|
||||
|
||||
var librarySourceMap = [
|
||||
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
|
||||
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts"], },
|
||||
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "webworker.generated.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: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
|
||||
];
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
[](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang).
|
||||
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [Twitter account](https://twitter.com/typescriptlang).
|
||||
|
||||
## Installing
|
||||
|
||||
|
||||
Vendored
+2653
-12
File diff suppressed because it is too large
Load Diff
Vendored
+2800
-2548
File diff suppressed because it is too large
Load Diff
Vendored
+411
-64
@@ -331,31 +331,31 @@ interface String {
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using a regular expression or search string.
|
||||
* @param searchValue A String object or string literal that represents the regular expression
|
||||
* @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj.
|
||||
* @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 object or string literal that represents the regular expression
|
||||
* @param replaceValue A function that returns the replacement text.
|
||||
* @param searchValue A string that represents the regular expression.
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string;
|
||||
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 object or string literal containing the text to replace for every successful match of rgExp in stringObj.
|
||||
* @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 replaceValue A function that returns the replacement text.
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string;
|
||||
replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;
|
||||
|
||||
/**
|
||||
* Finds the first substring match in a regular expression search.
|
||||
@@ -986,14 +986,14 @@ interface JSON {
|
||||
* @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: any): string;
|
||||
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: any): string;
|
||||
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.
|
||||
@@ -1196,11 +1196,13 @@ interface PromiseLike<T> {
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
/// IE10 ECMAScript Extensions
|
||||
/////////////////////////////
|
||||
|
||||
/**
|
||||
* Represents a raw buffer of binary data, which is used to store data for the
|
||||
@@ -1253,14 +1255,14 @@ interface DataView {
|
||||
* 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;
|
||||
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;
|
||||
getFloat64(byteOffset: number, littleEndian?: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
@@ -1274,13 +1276,13 @@ interface DataView {
|
||||
* 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;
|
||||
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;
|
||||
getInt32(byteOffset: number, littleEndian?: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
@@ -1294,14 +1296,14 @@ interface DataView {
|
||||
* 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;
|
||||
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;
|
||||
getUint32(byteOffset: number, littleEndian?: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
@@ -1310,7 +1312,7 @@ interface DataView {
|
||||
* @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;
|
||||
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
@@ -1319,7 +1321,7 @@ interface DataView {
|
||||
* @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;
|
||||
setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
@@ -1335,7 +1337,7 @@ interface DataView {
|
||||
* @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;
|
||||
setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
@@ -1344,7 +1346,7 @@ interface DataView {
|
||||
* @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;
|
||||
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
@@ -1360,7 +1362,7 @@ interface DataView {
|
||||
* @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;
|
||||
setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
@@ -1369,7 +1371,7 @@ interface DataView {
|
||||
* @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;
|
||||
setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
@@ -1576,7 +1578,7 @@ interface Int8Array {
|
||||
* @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: Int8Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -1625,8 +1627,7 @@ interface Int8Array {
|
||||
interface Int8ArrayConstructor {
|
||||
prototype: Int8Array;
|
||||
new (length: number): Int8Array;
|
||||
new (array: Int8Array): Int8Array;
|
||||
new (array: number[]): Int8Array;
|
||||
new (array: ArrayLike<number>): Int8Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;
|
||||
|
||||
/**
|
||||
@@ -1639,6 +1640,15 @@ interface Int8ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
|
||||
|
||||
}
|
||||
declare var Int8Array: Int8ArrayConstructor;
|
||||
|
||||
@@ -1841,7 +1851,7 @@ interface Uint8Array {
|
||||
* @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: Uint8Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -1891,8 +1901,7 @@ interface Uint8Array {
|
||||
interface Uint8ArrayConstructor {
|
||||
prototype: Uint8Array;
|
||||
new (length: number): Uint8Array;
|
||||
new (array: Uint8Array): Uint8Array;
|
||||
new (array: number[]): Uint8Array;
|
||||
new (array: ArrayLike<number>): Uint8Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;
|
||||
|
||||
/**
|
||||
@@ -1905,9 +1914,291 @@ interface Uint8ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
|
||||
|
||||
}
|
||||
declare var 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.
|
||||
*/
|
||||
BYTES_PER_ELEMENT: number;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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<number>) => 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.
|
||||
*/
|
||||
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<U>(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<U>(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 {
|
||||
prototype: Uint8ClampedArray;
|
||||
new (length: number): Uint8ClampedArray;
|
||||
new (array: ArrayLike<number>): Uint8ClampedArray;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;
|
||||
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
|
||||
}
|
||||
declare var 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.
|
||||
@@ -2107,7 +2398,7 @@ interface Int16Array {
|
||||
* @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: Int16Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -2157,8 +2448,7 @@ interface Int16Array {
|
||||
interface Int16ArrayConstructor {
|
||||
prototype: Int16Array;
|
||||
new (length: number): Int16Array;
|
||||
new (array: Int16Array): Int16Array;
|
||||
new (array: number[]): Int16Array;
|
||||
new (array: ArrayLike<number>): Int16Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;
|
||||
|
||||
/**
|
||||
@@ -2171,6 +2461,15 @@ interface Int16ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
|
||||
|
||||
}
|
||||
declare var Int16Array: Int16ArrayConstructor;
|
||||
|
||||
@@ -2373,7 +2672,7 @@ interface Uint16Array {
|
||||
* @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: Uint16Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -2423,8 +2722,7 @@ interface Uint16Array {
|
||||
interface Uint16ArrayConstructor {
|
||||
prototype: Uint16Array;
|
||||
new (length: number): Uint16Array;
|
||||
new (array: Uint16Array): Uint16Array;
|
||||
new (array: number[]): Uint16Array;
|
||||
new (array: ArrayLike<number>): Uint16Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;
|
||||
|
||||
/**
|
||||
@@ -2437,6 +2735,15 @@ interface Uint16ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
|
||||
|
||||
}
|
||||
declare var Uint16Array: Uint16ArrayConstructor;
|
||||
/**
|
||||
@@ -2638,7 +2945,7 @@ interface Int32Array {
|
||||
* @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: Int32Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -2688,8 +2995,7 @@ interface Int32Array {
|
||||
interface Int32ArrayConstructor {
|
||||
prototype: Int32Array;
|
||||
new (length: number): Int32Array;
|
||||
new (array: Int32Array): Int32Array;
|
||||
new (array: number[]): Int32Array;
|
||||
new (array: ArrayLike<number>): Int32Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;
|
||||
|
||||
/**
|
||||
@@ -2702,6 +3008,14 @@ interface Int32ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
|
||||
}
|
||||
declare var Int32Array: Int32ArrayConstructor;
|
||||
|
||||
@@ -2904,7 +3218,7 @@ interface Uint32Array {
|
||||
* @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: Uint32Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -2954,8 +3268,7 @@ interface Uint32Array {
|
||||
interface Uint32ArrayConstructor {
|
||||
prototype: Uint32Array;
|
||||
new (length: number): Uint32Array;
|
||||
new (array: Uint32Array): Uint32Array;
|
||||
new (array: number[]): Uint32Array;
|
||||
new (array: ArrayLike<number>): Uint32Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;
|
||||
|
||||
/**
|
||||
@@ -2968,6 +3281,14 @@ interface Uint32ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
|
||||
}
|
||||
declare var Uint32Array: Uint32ArrayConstructor;
|
||||
|
||||
@@ -3170,7 +3491,7 @@ interface Float32Array {
|
||||
* @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: Float32Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -3220,8 +3541,7 @@ interface Float32Array {
|
||||
interface Float32ArrayConstructor {
|
||||
prototype: Float32Array;
|
||||
new (length: number): Float32Array;
|
||||
new (array: Float32Array): Float32Array;
|
||||
new (array: number[]): Float32Array;
|
||||
new (array: ArrayLike<number>): Float32Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;
|
||||
|
||||
/**
|
||||
@@ -3234,6 +3554,15 @@ interface Float32ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
|
||||
|
||||
}
|
||||
declare var Float32Array: Float32ArrayConstructor;
|
||||
|
||||
@@ -3436,7 +3765,7 @@ interface Float64Array {
|
||||
* @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: Float64Array, offset?: number): void;
|
||||
set(array: ArrayLike<number>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
@@ -3486,8 +3815,7 @@ interface Float64Array {
|
||||
interface Float64ArrayConstructor {
|
||||
prototype: Float64Array;
|
||||
new (length: number): Float64Array;
|
||||
new (array: Float64Array): Float64Array;
|
||||
new (array: number[]): Float64Array;
|
||||
new (array: ArrayLike<number>): Float64Array;
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;
|
||||
|
||||
/**
|
||||
@@ -3500,8 +3828,17 @@ interface Float64ArrayConstructor {
|
||||
* @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<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
|
||||
}
|
||||
declare var Float64Array: Float64ArrayConstructor;/////////////////////////////
|
||||
declare var Float64Array: Float64ArrayConstructor;
|
||||
/////////////////////////////
|
||||
/// ECMAScript Internationalization API
|
||||
/////////////////////////////
|
||||
|
||||
@@ -6135,7 +6472,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @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 | Window;
|
||||
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.
|
||||
@@ -6706,7 +7043,7 @@ interface File extends Blob {
|
||||
|
||||
declare var File: {
|
||||
prototype: File;
|
||||
new(): File;
|
||||
new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
@@ -10541,7 +10878,7 @@ interface IDBDatabase extends EventTarget {
|
||||
createObjectStore(name: string, optionalParameters?: any): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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;
|
||||
}
|
||||
@@ -10662,7 +10999,7 @@ interface IDBTransaction extends EventTarget {
|
||||
READ_ONLY: string;
|
||||
READ_WRITE: string;
|
||||
VERSION_CHANGE: string;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
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;
|
||||
@@ -10692,11 +11029,14 @@ interface ImageData {
|
||||
width: number;
|
||||
}
|
||||
|
||||
declare var ImageData: {
|
||||
interface ImageDataConstructor {
|
||||
prototype: ImageData;
|
||||
new(): ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
}
|
||||
|
||||
declare var ImageData: ImageDataConstructor;
|
||||
|
||||
interface KeyboardEvent extends UIEvent {
|
||||
altKey: boolean;
|
||||
char: string;
|
||||
@@ -15638,7 +15978,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
onvolumechange: (ev: Event) => any;
|
||||
onwaiting: (ev: Event) => any;
|
||||
opener: Window;
|
||||
orientation: string;
|
||||
orientation: string | number;
|
||||
outerHeight: number;
|
||||
outerWidth: number;
|
||||
pageXOffset: number;
|
||||
@@ -15845,7 +16185,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
LOADING: number;
|
||||
OPENED: number;
|
||||
UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -16115,7 +16455,7 @@ interface MSBaseReader {
|
||||
DONE: number;
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -16271,7 +16611,7 @@ interface XMLHttpRequestEventTarget {
|
||||
onloadstart: (ev: Event) => any;
|
||||
onprogress: (ev: ProgressEvent) => any;
|
||||
ontimeout: (ev: ProgressEvent) => any;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -16288,11 +16628,17 @@ interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
[index: number]: TNode;
|
||||
}
|
||||
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface FilePropertyBag {
|
||||
type?: string;
|
||||
lastModified?: number;
|
||||
}
|
||||
|
||||
interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
@@ -16453,7 +16799,7 @@ 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;
|
||||
declare var orientation: string | number;
|
||||
declare var outerHeight: number;
|
||||
declare var outerWidth: number;
|
||||
declare var pageXOffset: number;
|
||||
@@ -16628,7 +16974,8 @@ 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;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
/////////////////////////////
|
||||
/// WorkerGlobalScope APIs
|
||||
/////////////////////////////
|
||||
|
||||
Vendored
+21
-2316
File diff suppressed because it is too large
Load Diff
Vendored
+2824
-2560
File diff suppressed because it is too large
Load Diff
Vendored
+126
-2324
File diff suppressed because it is too large
Load Diff
+5002
-4080
File diff suppressed because it is too large
Load Diff
+6744
-5400
File diff suppressed because it is too large
Load Diff
Vendored
+343
-300
@@ -23,6 +23,7 @@ declare module "typescript" {
|
||||
contains(fileName: string): boolean;
|
||||
remove(fileName: string): void;
|
||||
forEachValue(f: (v: T) => void): void;
|
||||
clear(): void;
|
||||
}
|
||||
interface TextRange {
|
||||
pos: number;
|
||||
@@ -35,293 +36,294 @@ declare module "typescript" {
|
||||
MultiLineCommentTrivia = 3,
|
||||
NewLineTrivia = 4,
|
||||
WhitespaceTrivia = 5,
|
||||
ConflictMarkerTrivia = 6,
|
||||
NumericLiteral = 7,
|
||||
StringLiteral = 8,
|
||||
RegularExpressionLiteral = 9,
|
||||
NoSubstitutionTemplateLiteral = 10,
|
||||
TemplateHead = 11,
|
||||
TemplateMiddle = 12,
|
||||
TemplateTail = 13,
|
||||
OpenBraceToken = 14,
|
||||
CloseBraceToken = 15,
|
||||
OpenParenToken = 16,
|
||||
CloseParenToken = 17,
|
||||
OpenBracketToken = 18,
|
||||
CloseBracketToken = 19,
|
||||
DotToken = 20,
|
||||
DotDotDotToken = 21,
|
||||
SemicolonToken = 22,
|
||||
CommaToken = 23,
|
||||
LessThanToken = 24,
|
||||
LessThanSlashToken = 25,
|
||||
GreaterThanToken = 26,
|
||||
LessThanEqualsToken = 27,
|
||||
GreaterThanEqualsToken = 28,
|
||||
EqualsEqualsToken = 29,
|
||||
ExclamationEqualsToken = 30,
|
||||
EqualsEqualsEqualsToken = 31,
|
||||
ExclamationEqualsEqualsToken = 32,
|
||||
EqualsGreaterThanToken = 33,
|
||||
PlusToken = 34,
|
||||
MinusToken = 35,
|
||||
AsteriskToken = 36,
|
||||
SlashToken = 37,
|
||||
PercentToken = 38,
|
||||
PlusPlusToken = 39,
|
||||
MinusMinusToken = 40,
|
||||
LessThanLessThanToken = 41,
|
||||
GreaterThanGreaterThanToken = 42,
|
||||
GreaterThanGreaterThanGreaterThanToken = 43,
|
||||
AmpersandToken = 44,
|
||||
BarToken = 45,
|
||||
CaretToken = 46,
|
||||
ExclamationToken = 47,
|
||||
TildeToken = 48,
|
||||
AmpersandAmpersandToken = 49,
|
||||
BarBarToken = 50,
|
||||
QuestionToken = 51,
|
||||
ColonToken = 52,
|
||||
AtToken = 53,
|
||||
EqualsToken = 54,
|
||||
PlusEqualsToken = 55,
|
||||
MinusEqualsToken = 56,
|
||||
AsteriskEqualsToken = 57,
|
||||
SlashEqualsToken = 58,
|
||||
PercentEqualsToken = 59,
|
||||
LessThanLessThanEqualsToken = 60,
|
||||
GreaterThanGreaterThanEqualsToken = 61,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 62,
|
||||
AmpersandEqualsToken = 63,
|
||||
BarEqualsToken = 64,
|
||||
CaretEqualsToken = 65,
|
||||
Identifier = 66,
|
||||
BreakKeyword = 67,
|
||||
CaseKeyword = 68,
|
||||
CatchKeyword = 69,
|
||||
ClassKeyword = 70,
|
||||
ConstKeyword = 71,
|
||||
ContinueKeyword = 72,
|
||||
DebuggerKeyword = 73,
|
||||
DefaultKeyword = 74,
|
||||
DeleteKeyword = 75,
|
||||
DoKeyword = 76,
|
||||
ElseKeyword = 77,
|
||||
EnumKeyword = 78,
|
||||
ExportKeyword = 79,
|
||||
ExtendsKeyword = 80,
|
||||
FalseKeyword = 81,
|
||||
FinallyKeyword = 82,
|
||||
ForKeyword = 83,
|
||||
FunctionKeyword = 84,
|
||||
IfKeyword = 85,
|
||||
ImportKeyword = 86,
|
||||
InKeyword = 87,
|
||||
InstanceOfKeyword = 88,
|
||||
NewKeyword = 89,
|
||||
NullKeyword = 90,
|
||||
ReturnKeyword = 91,
|
||||
SuperKeyword = 92,
|
||||
SwitchKeyword = 93,
|
||||
ThisKeyword = 94,
|
||||
ThrowKeyword = 95,
|
||||
TrueKeyword = 96,
|
||||
TryKeyword = 97,
|
||||
TypeOfKeyword = 98,
|
||||
VarKeyword = 99,
|
||||
VoidKeyword = 100,
|
||||
WhileKeyword = 101,
|
||||
WithKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AbstractKeyword = 112,
|
||||
AsKeyword = 113,
|
||||
AnyKeyword = 114,
|
||||
AsyncKeyword = 115,
|
||||
AwaitKeyword = 116,
|
||||
BooleanKeyword = 117,
|
||||
ConstructorKeyword = 118,
|
||||
DeclareKeyword = 119,
|
||||
GetKeyword = 120,
|
||||
IsKeyword = 121,
|
||||
ModuleKeyword = 122,
|
||||
NamespaceKeyword = 123,
|
||||
RequireKeyword = 124,
|
||||
NumberKeyword = 125,
|
||||
SetKeyword = 126,
|
||||
StringKeyword = 127,
|
||||
SymbolKeyword = 128,
|
||||
TypeKeyword = 129,
|
||||
FromKeyword = 130,
|
||||
OfKeyword = 131,
|
||||
QualifiedName = 132,
|
||||
ComputedPropertyName = 133,
|
||||
TypeParameter = 134,
|
||||
Parameter = 135,
|
||||
Decorator = 136,
|
||||
PropertySignature = 137,
|
||||
PropertyDeclaration = 138,
|
||||
MethodSignature = 139,
|
||||
MethodDeclaration = 140,
|
||||
Constructor = 141,
|
||||
GetAccessor = 142,
|
||||
SetAccessor = 143,
|
||||
CallSignature = 144,
|
||||
ConstructSignature = 145,
|
||||
IndexSignature = 146,
|
||||
TypePredicate = 147,
|
||||
TypeReference = 148,
|
||||
FunctionType = 149,
|
||||
ConstructorType = 150,
|
||||
TypeQuery = 151,
|
||||
TypeLiteral = 152,
|
||||
ArrayType = 153,
|
||||
TupleType = 154,
|
||||
UnionType = 155,
|
||||
IntersectionType = 156,
|
||||
ParenthesizedType = 157,
|
||||
ObjectBindingPattern = 158,
|
||||
ArrayBindingPattern = 159,
|
||||
BindingElement = 160,
|
||||
ArrayLiteralExpression = 161,
|
||||
ObjectLiteralExpression = 162,
|
||||
PropertyAccessExpression = 163,
|
||||
ElementAccessExpression = 164,
|
||||
CallExpression = 165,
|
||||
NewExpression = 166,
|
||||
TaggedTemplateExpression = 167,
|
||||
TypeAssertionExpression = 168,
|
||||
ParenthesizedExpression = 169,
|
||||
FunctionExpression = 170,
|
||||
ArrowFunction = 171,
|
||||
DeleteExpression = 172,
|
||||
TypeOfExpression = 173,
|
||||
VoidExpression = 174,
|
||||
AwaitExpression = 175,
|
||||
PrefixUnaryExpression = 176,
|
||||
PostfixUnaryExpression = 177,
|
||||
BinaryExpression = 178,
|
||||
ConditionalExpression = 179,
|
||||
TemplateExpression = 180,
|
||||
YieldExpression = 181,
|
||||
SpreadElementExpression = 182,
|
||||
ClassExpression = 183,
|
||||
OmittedExpression = 184,
|
||||
ExpressionWithTypeArguments = 185,
|
||||
AsExpression = 186,
|
||||
TemplateSpan = 187,
|
||||
SemicolonClassElement = 188,
|
||||
Block = 189,
|
||||
VariableStatement = 190,
|
||||
EmptyStatement = 191,
|
||||
ExpressionStatement = 192,
|
||||
IfStatement = 193,
|
||||
DoStatement = 194,
|
||||
WhileStatement = 195,
|
||||
ForStatement = 196,
|
||||
ForInStatement = 197,
|
||||
ForOfStatement = 198,
|
||||
ContinueStatement = 199,
|
||||
BreakStatement = 200,
|
||||
ReturnStatement = 201,
|
||||
WithStatement = 202,
|
||||
SwitchStatement = 203,
|
||||
LabeledStatement = 204,
|
||||
ThrowStatement = 205,
|
||||
TryStatement = 206,
|
||||
DebuggerStatement = 207,
|
||||
VariableDeclaration = 208,
|
||||
VariableDeclarationList = 209,
|
||||
FunctionDeclaration = 210,
|
||||
ClassDeclaration = 211,
|
||||
InterfaceDeclaration = 212,
|
||||
TypeAliasDeclaration = 213,
|
||||
EnumDeclaration = 214,
|
||||
ModuleDeclaration = 215,
|
||||
ModuleBlock = 216,
|
||||
CaseBlock = 217,
|
||||
ImportEqualsDeclaration = 218,
|
||||
ImportDeclaration = 219,
|
||||
ImportClause = 220,
|
||||
NamespaceImport = 221,
|
||||
NamedImports = 222,
|
||||
ImportSpecifier = 223,
|
||||
ExportAssignment = 224,
|
||||
ExportDeclaration = 225,
|
||||
NamedExports = 226,
|
||||
ExportSpecifier = 227,
|
||||
MissingDeclaration = 228,
|
||||
ExternalModuleReference = 229,
|
||||
JsxElement = 230,
|
||||
JsxSelfClosingElement = 231,
|
||||
JsxOpeningElement = 232,
|
||||
JsxText = 233,
|
||||
JsxClosingElement = 234,
|
||||
JsxAttribute = 235,
|
||||
JsxSpreadAttribute = 236,
|
||||
JsxExpression = 237,
|
||||
CaseClause = 238,
|
||||
DefaultClause = 239,
|
||||
HeritageClause = 240,
|
||||
CatchClause = 241,
|
||||
PropertyAssignment = 242,
|
||||
ShorthandPropertyAssignment = 243,
|
||||
EnumMember = 244,
|
||||
SourceFile = 245,
|
||||
JSDocTypeExpression = 246,
|
||||
JSDocAllType = 247,
|
||||
JSDocUnknownType = 248,
|
||||
JSDocArrayType = 249,
|
||||
JSDocUnionType = 250,
|
||||
JSDocTupleType = 251,
|
||||
JSDocNullableType = 252,
|
||||
JSDocNonNullableType = 253,
|
||||
JSDocRecordType = 254,
|
||||
JSDocRecordMember = 255,
|
||||
JSDocTypeReference = 256,
|
||||
JSDocOptionalType = 257,
|
||||
JSDocFunctionType = 258,
|
||||
JSDocVariadicType = 259,
|
||||
JSDocConstructorType = 260,
|
||||
JSDocThisType = 261,
|
||||
JSDocComment = 262,
|
||||
JSDocTag = 263,
|
||||
JSDocParameterTag = 264,
|
||||
JSDocReturnTag = 265,
|
||||
JSDocTypeTag = 266,
|
||||
JSDocTemplateTag = 267,
|
||||
SyntaxList = 268,
|
||||
Count = 269,
|
||||
FirstAssignment = 54,
|
||||
LastAssignment = 65,
|
||||
FirstReservedWord = 67,
|
||||
LastReservedWord = 102,
|
||||
FirstKeyword = 67,
|
||||
LastKeyword = 131,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstTypeNode = 148,
|
||||
LastTypeNode = 157,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 65,
|
||||
ShebangTrivia = 6,
|
||||
ConflictMarkerTrivia = 7,
|
||||
NumericLiteral = 8,
|
||||
StringLiteral = 9,
|
||||
RegularExpressionLiteral = 10,
|
||||
NoSubstitutionTemplateLiteral = 11,
|
||||
TemplateHead = 12,
|
||||
TemplateMiddle = 13,
|
||||
TemplateTail = 14,
|
||||
OpenBraceToken = 15,
|
||||
CloseBraceToken = 16,
|
||||
OpenParenToken = 17,
|
||||
CloseParenToken = 18,
|
||||
OpenBracketToken = 19,
|
||||
CloseBracketToken = 20,
|
||||
DotToken = 21,
|
||||
DotDotDotToken = 22,
|
||||
SemicolonToken = 23,
|
||||
CommaToken = 24,
|
||||
LessThanToken = 25,
|
||||
LessThanSlashToken = 26,
|
||||
GreaterThanToken = 27,
|
||||
LessThanEqualsToken = 28,
|
||||
GreaterThanEqualsToken = 29,
|
||||
EqualsEqualsToken = 30,
|
||||
ExclamationEqualsToken = 31,
|
||||
EqualsEqualsEqualsToken = 32,
|
||||
ExclamationEqualsEqualsToken = 33,
|
||||
EqualsGreaterThanToken = 34,
|
||||
PlusToken = 35,
|
||||
MinusToken = 36,
|
||||
AsteriskToken = 37,
|
||||
SlashToken = 38,
|
||||
PercentToken = 39,
|
||||
PlusPlusToken = 40,
|
||||
MinusMinusToken = 41,
|
||||
LessThanLessThanToken = 42,
|
||||
GreaterThanGreaterThanToken = 43,
|
||||
GreaterThanGreaterThanGreaterThanToken = 44,
|
||||
AmpersandToken = 45,
|
||||
BarToken = 46,
|
||||
CaretToken = 47,
|
||||
ExclamationToken = 48,
|
||||
TildeToken = 49,
|
||||
AmpersandAmpersandToken = 50,
|
||||
BarBarToken = 51,
|
||||
QuestionToken = 52,
|
||||
ColonToken = 53,
|
||||
AtToken = 54,
|
||||
EqualsToken = 55,
|
||||
PlusEqualsToken = 56,
|
||||
MinusEqualsToken = 57,
|
||||
AsteriskEqualsToken = 58,
|
||||
SlashEqualsToken = 59,
|
||||
PercentEqualsToken = 60,
|
||||
LessThanLessThanEqualsToken = 61,
|
||||
GreaterThanGreaterThanEqualsToken = 62,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 63,
|
||||
AmpersandEqualsToken = 64,
|
||||
BarEqualsToken = 65,
|
||||
CaretEqualsToken = 66,
|
||||
Identifier = 67,
|
||||
BreakKeyword = 68,
|
||||
CaseKeyword = 69,
|
||||
CatchKeyword = 70,
|
||||
ClassKeyword = 71,
|
||||
ConstKeyword = 72,
|
||||
ContinueKeyword = 73,
|
||||
DebuggerKeyword = 74,
|
||||
DefaultKeyword = 75,
|
||||
DeleteKeyword = 76,
|
||||
DoKeyword = 77,
|
||||
ElseKeyword = 78,
|
||||
EnumKeyword = 79,
|
||||
ExportKeyword = 80,
|
||||
ExtendsKeyword = 81,
|
||||
FalseKeyword = 82,
|
||||
FinallyKeyword = 83,
|
||||
ForKeyword = 84,
|
||||
FunctionKeyword = 85,
|
||||
IfKeyword = 86,
|
||||
ImportKeyword = 87,
|
||||
InKeyword = 88,
|
||||
InstanceOfKeyword = 89,
|
||||
NewKeyword = 90,
|
||||
NullKeyword = 91,
|
||||
ReturnKeyword = 92,
|
||||
SuperKeyword = 93,
|
||||
SwitchKeyword = 94,
|
||||
ThisKeyword = 95,
|
||||
ThrowKeyword = 96,
|
||||
TrueKeyword = 97,
|
||||
TryKeyword = 98,
|
||||
TypeOfKeyword = 99,
|
||||
VarKeyword = 100,
|
||||
VoidKeyword = 101,
|
||||
WhileKeyword = 102,
|
||||
WithKeyword = 103,
|
||||
ImplementsKeyword = 104,
|
||||
InterfaceKeyword = 105,
|
||||
LetKeyword = 106,
|
||||
PackageKeyword = 107,
|
||||
PrivateKeyword = 108,
|
||||
ProtectedKeyword = 109,
|
||||
PublicKeyword = 110,
|
||||
StaticKeyword = 111,
|
||||
YieldKeyword = 112,
|
||||
AbstractKeyword = 113,
|
||||
AsKeyword = 114,
|
||||
AnyKeyword = 115,
|
||||
AsyncKeyword = 116,
|
||||
AwaitKeyword = 117,
|
||||
BooleanKeyword = 118,
|
||||
ConstructorKeyword = 119,
|
||||
DeclareKeyword = 120,
|
||||
GetKeyword = 121,
|
||||
IsKeyword = 122,
|
||||
ModuleKeyword = 123,
|
||||
NamespaceKeyword = 124,
|
||||
RequireKeyword = 125,
|
||||
NumberKeyword = 126,
|
||||
SetKeyword = 127,
|
||||
StringKeyword = 128,
|
||||
SymbolKeyword = 129,
|
||||
TypeKeyword = 130,
|
||||
FromKeyword = 131,
|
||||
OfKeyword = 132,
|
||||
QualifiedName = 133,
|
||||
ComputedPropertyName = 134,
|
||||
TypeParameter = 135,
|
||||
Parameter = 136,
|
||||
Decorator = 137,
|
||||
PropertySignature = 138,
|
||||
PropertyDeclaration = 139,
|
||||
MethodSignature = 140,
|
||||
MethodDeclaration = 141,
|
||||
Constructor = 142,
|
||||
GetAccessor = 143,
|
||||
SetAccessor = 144,
|
||||
CallSignature = 145,
|
||||
ConstructSignature = 146,
|
||||
IndexSignature = 147,
|
||||
TypePredicate = 148,
|
||||
TypeReference = 149,
|
||||
FunctionType = 150,
|
||||
ConstructorType = 151,
|
||||
TypeQuery = 152,
|
||||
TypeLiteral = 153,
|
||||
ArrayType = 154,
|
||||
TupleType = 155,
|
||||
UnionType = 156,
|
||||
IntersectionType = 157,
|
||||
ParenthesizedType = 158,
|
||||
ObjectBindingPattern = 159,
|
||||
ArrayBindingPattern = 160,
|
||||
BindingElement = 161,
|
||||
ArrayLiteralExpression = 162,
|
||||
ObjectLiteralExpression = 163,
|
||||
PropertyAccessExpression = 164,
|
||||
ElementAccessExpression = 165,
|
||||
CallExpression = 166,
|
||||
NewExpression = 167,
|
||||
TaggedTemplateExpression = 168,
|
||||
TypeAssertionExpression = 169,
|
||||
ParenthesizedExpression = 170,
|
||||
FunctionExpression = 171,
|
||||
ArrowFunction = 172,
|
||||
DeleteExpression = 173,
|
||||
TypeOfExpression = 174,
|
||||
VoidExpression = 175,
|
||||
AwaitExpression = 176,
|
||||
PrefixUnaryExpression = 177,
|
||||
PostfixUnaryExpression = 178,
|
||||
BinaryExpression = 179,
|
||||
ConditionalExpression = 180,
|
||||
TemplateExpression = 181,
|
||||
YieldExpression = 182,
|
||||
SpreadElementExpression = 183,
|
||||
ClassExpression = 184,
|
||||
OmittedExpression = 185,
|
||||
ExpressionWithTypeArguments = 186,
|
||||
AsExpression = 187,
|
||||
TemplateSpan = 188,
|
||||
SemicolonClassElement = 189,
|
||||
Block = 190,
|
||||
VariableStatement = 191,
|
||||
EmptyStatement = 192,
|
||||
ExpressionStatement = 193,
|
||||
IfStatement = 194,
|
||||
DoStatement = 195,
|
||||
WhileStatement = 196,
|
||||
ForStatement = 197,
|
||||
ForInStatement = 198,
|
||||
ForOfStatement = 199,
|
||||
ContinueStatement = 200,
|
||||
BreakStatement = 201,
|
||||
ReturnStatement = 202,
|
||||
WithStatement = 203,
|
||||
SwitchStatement = 204,
|
||||
LabeledStatement = 205,
|
||||
ThrowStatement = 206,
|
||||
TryStatement = 207,
|
||||
DebuggerStatement = 208,
|
||||
VariableDeclaration = 209,
|
||||
VariableDeclarationList = 210,
|
||||
FunctionDeclaration = 211,
|
||||
ClassDeclaration = 212,
|
||||
InterfaceDeclaration = 213,
|
||||
TypeAliasDeclaration = 214,
|
||||
EnumDeclaration = 215,
|
||||
ModuleDeclaration = 216,
|
||||
ModuleBlock = 217,
|
||||
CaseBlock = 218,
|
||||
ImportEqualsDeclaration = 219,
|
||||
ImportDeclaration = 220,
|
||||
ImportClause = 221,
|
||||
NamespaceImport = 222,
|
||||
NamedImports = 223,
|
||||
ImportSpecifier = 224,
|
||||
ExportAssignment = 225,
|
||||
ExportDeclaration = 226,
|
||||
NamedExports = 227,
|
||||
ExportSpecifier = 228,
|
||||
MissingDeclaration = 229,
|
||||
ExternalModuleReference = 230,
|
||||
JsxElement = 231,
|
||||
JsxSelfClosingElement = 232,
|
||||
JsxOpeningElement = 233,
|
||||
JsxText = 234,
|
||||
JsxClosingElement = 235,
|
||||
JsxAttribute = 236,
|
||||
JsxSpreadAttribute = 237,
|
||||
JsxExpression = 238,
|
||||
CaseClause = 239,
|
||||
DefaultClause = 240,
|
||||
HeritageClause = 241,
|
||||
CatchClause = 242,
|
||||
PropertyAssignment = 243,
|
||||
ShorthandPropertyAssignment = 244,
|
||||
EnumMember = 245,
|
||||
SourceFile = 246,
|
||||
JSDocTypeExpression = 247,
|
||||
JSDocAllType = 248,
|
||||
JSDocUnknownType = 249,
|
||||
JSDocArrayType = 250,
|
||||
JSDocUnionType = 251,
|
||||
JSDocTupleType = 252,
|
||||
JSDocNullableType = 253,
|
||||
JSDocNonNullableType = 254,
|
||||
JSDocRecordType = 255,
|
||||
JSDocRecordMember = 256,
|
||||
JSDocTypeReference = 257,
|
||||
JSDocOptionalType = 258,
|
||||
JSDocFunctionType = 259,
|
||||
JSDocVariadicType = 260,
|
||||
JSDocConstructorType = 261,
|
||||
JSDocThisType = 262,
|
||||
JSDocComment = 263,
|
||||
JSDocTag = 264,
|
||||
JSDocParameterTag = 265,
|
||||
JSDocReturnTag = 266,
|
||||
JSDocTypeTag = 267,
|
||||
JSDocTemplateTag = 268,
|
||||
SyntaxList = 269,
|
||||
Count = 270,
|
||||
FirstAssignment = 55,
|
||||
LastAssignment = 66,
|
||||
FirstReservedWord = 68,
|
||||
LastReservedWord = 103,
|
||||
FirstKeyword = 68,
|
||||
LastKeyword = 132,
|
||||
FirstFutureReservedWord = 104,
|
||||
LastFutureReservedWord = 112,
|
||||
FirstTypeNode = 149,
|
||||
LastTypeNode = 158,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 66,
|
||||
FirstToken = 0,
|
||||
LastToken = 131,
|
||||
LastToken = 132,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
LastLiteralToken = 10,
|
||||
FirstTemplateToken = 10,
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 65,
|
||||
FirstNode = 132,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
LastLiteralToken = 11,
|
||||
FirstTemplateToken = 11,
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 66,
|
||||
FirstNode = 133,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -452,9 +454,9 @@ declare module "typescript" {
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
* Examples:
|
||||
* FunctionDeclaration
|
||||
* MethodDeclaration
|
||||
* AccessorDeclaration
|
||||
* - FunctionDeclaration
|
||||
* - MethodDeclaration
|
||||
* - AccessorDeclaration
|
||||
*/
|
||||
interface FunctionLikeDeclaration extends SignatureDeclaration {
|
||||
_functionLikeDeclarationBrand: any;
|
||||
@@ -944,7 +946,7 @@ declare module "typescript" {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
interface ParseConfigHost {
|
||||
interface ParseConfigHost extends ModuleResolutionHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
interface WriteFileCallback {
|
||||
@@ -958,6 +960,10 @@ declare module "typescript" {
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
interface Program extends ScriptReferenceHost {
|
||||
/**
|
||||
* Get a list of root file names that were passed to a 'createProgram'
|
||||
*/
|
||||
getRootFileNames(): string[];
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
@@ -1019,11 +1025,6 @@ declare module "typescript" {
|
||||
emitSkipped: boolean;
|
||||
diagnostics: Diagnostic[];
|
||||
}
|
||||
interface TypeCheckerHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
getSourceFiles(): SourceFile[];
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
}
|
||||
interface TypeChecker {
|
||||
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
|
||||
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
||||
@@ -1031,6 +1032,7 @@ declare module "typescript" {
|
||||
getPropertyOfType(type: Type, propertyName: string): Symbol;
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getBaseTypes(type: InterfaceType): ObjectType[];
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
@@ -1054,6 +1056,7 @@ declare module "typescript" {
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
|
||||
getJsxIntrinsicTagNames(): Symbol[];
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1198,7 +1201,7 @@ declare module "typescript" {
|
||||
Anonymous = 65536,
|
||||
Instantiated = 131072,
|
||||
ObjectLiteral = 524288,
|
||||
ESSymbol = 4194304,
|
||||
ESSymbol = 16777216,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 80896,
|
||||
@@ -1218,8 +1221,6 @@ declare module "typescript" {
|
||||
typeParameters: TypeParameter[];
|
||||
outerTypeParameters: TypeParameter[];
|
||||
localTypeParameters: TypeParameter[];
|
||||
resolvedBaseConstructorType?: Type;
|
||||
resolvedBaseTypes: ObjectType[];
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
@@ -1315,6 +1316,7 @@ declare module "typescript" {
|
||||
noLib?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outFile?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
@@ -1367,14 +1369,25 @@ declare module "typescript" {
|
||||
fileNames: string[];
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
interface CompilerHost {
|
||||
interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string;
|
||||
}
|
||||
interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
interface TextSpan {
|
||||
start: number;
|
||||
@@ -1448,8 +1461,11 @@ declare module "typescript" {
|
||||
function couldStartTrivia(text: string, pos: number): boolean;
|
||||
function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
/** Optionally, get the shebang */
|
||||
function getShebang(text: string): string;
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
@@ -1489,13 +1505,14 @@ declare module "typescript" {
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
@@ -1559,6 +1576,7 @@ declare module "typescript" {
|
||||
getConstructSignatures(): Signature[];
|
||||
getStringIndexType(): Type;
|
||||
getNumberIndexType(): Type;
|
||||
getBaseTypes(): ObjectType[];
|
||||
}
|
||||
interface Signature {
|
||||
getDeclaration(): SignatureDeclaration;
|
||||
@@ -1600,6 +1618,7 @@ declare module "typescript" {
|
||||
interface PreProcessedFileInfo {
|
||||
referencedFiles: FileReference[];
|
||||
importedFiles: FileReference[];
|
||||
ambientExternalModules: string[];
|
||||
isLibFile: boolean;
|
||||
}
|
||||
interface HostCancellationToken {
|
||||
@@ -1620,6 +1639,7 @@ declare module "typescript" {
|
||||
trace?(s: string): void;
|
||||
error?(s: string): void;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
interface LanguageService {
|
||||
cleanupSemanticCache(): void;
|
||||
@@ -1660,6 +1680,7 @@ declare module "typescript" {
|
||||
getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[];
|
||||
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[];
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[];
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
|
||||
getEmitOutput(fileName: string): EmitOutput;
|
||||
getProgram(): Program;
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
@@ -1696,6 +1717,11 @@ declare module "typescript" {
|
||||
span: TextSpan;
|
||||
newText: string;
|
||||
}
|
||||
interface TextInsertion {
|
||||
newText: string;
|
||||
/** The position in newText the caret should point to after the insertion. */
|
||||
caretOffset: number;
|
||||
}
|
||||
interface RenameLocation {
|
||||
textSpan: TextSpan;
|
||||
fileName: string;
|
||||
@@ -1716,6 +1742,7 @@ declare module "typescript" {
|
||||
const writtenReference: string;
|
||||
}
|
||||
interface HighlightSpan {
|
||||
fileName?: string;
|
||||
textSpan: TextSpan;
|
||||
kind: string;
|
||||
}
|
||||
@@ -1743,6 +1770,7 @@ declare module "typescript" {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number | string;
|
||||
@@ -1985,6 +2013,7 @@ declare module "typescript" {
|
||||
* @param compilationSettings The compilation settings used to acquire the file
|
||||
*/
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
|
||||
reportStats(): string;
|
||||
}
|
||||
module ScriptElementKind {
|
||||
const unknown: string;
|
||||
@@ -2071,10 +2100,24 @@ declare module "typescript" {
|
||||
}
|
||||
function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
|
||||
function getDefaultCompilerOptions(): CompilerOptions;
|
||||
interface TranspileOptions {
|
||||
compilerOptions?: CompilerOptions;
|
||||
fileName?: string;
|
||||
reportDiagnostics?: boolean;
|
||||
moduleName?: string;
|
||||
renamedDependencies?: Map<string>;
|
||||
}
|
||||
interface TranspileOutput {
|
||||
outputText: string;
|
||||
diagnostics?: Diagnostic[];
|
||||
sourceMapText?: string;
|
||||
}
|
||||
function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
|
||||
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
||||
+7845
-6469
File diff suppressed because it is too large
Load Diff
Vendored
+343
-300
@@ -23,6 +23,7 @@ declare namespace ts {
|
||||
contains(fileName: string): boolean;
|
||||
remove(fileName: string): void;
|
||||
forEachValue(f: (v: T) => void): void;
|
||||
clear(): void;
|
||||
}
|
||||
interface TextRange {
|
||||
pos: number;
|
||||
@@ -35,293 +36,294 @@ declare namespace ts {
|
||||
MultiLineCommentTrivia = 3,
|
||||
NewLineTrivia = 4,
|
||||
WhitespaceTrivia = 5,
|
||||
ConflictMarkerTrivia = 6,
|
||||
NumericLiteral = 7,
|
||||
StringLiteral = 8,
|
||||
RegularExpressionLiteral = 9,
|
||||
NoSubstitutionTemplateLiteral = 10,
|
||||
TemplateHead = 11,
|
||||
TemplateMiddle = 12,
|
||||
TemplateTail = 13,
|
||||
OpenBraceToken = 14,
|
||||
CloseBraceToken = 15,
|
||||
OpenParenToken = 16,
|
||||
CloseParenToken = 17,
|
||||
OpenBracketToken = 18,
|
||||
CloseBracketToken = 19,
|
||||
DotToken = 20,
|
||||
DotDotDotToken = 21,
|
||||
SemicolonToken = 22,
|
||||
CommaToken = 23,
|
||||
LessThanToken = 24,
|
||||
LessThanSlashToken = 25,
|
||||
GreaterThanToken = 26,
|
||||
LessThanEqualsToken = 27,
|
||||
GreaterThanEqualsToken = 28,
|
||||
EqualsEqualsToken = 29,
|
||||
ExclamationEqualsToken = 30,
|
||||
EqualsEqualsEqualsToken = 31,
|
||||
ExclamationEqualsEqualsToken = 32,
|
||||
EqualsGreaterThanToken = 33,
|
||||
PlusToken = 34,
|
||||
MinusToken = 35,
|
||||
AsteriskToken = 36,
|
||||
SlashToken = 37,
|
||||
PercentToken = 38,
|
||||
PlusPlusToken = 39,
|
||||
MinusMinusToken = 40,
|
||||
LessThanLessThanToken = 41,
|
||||
GreaterThanGreaterThanToken = 42,
|
||||
GreaterThanGreaterThanGreaterThanToken = 43,
|
||||
AmpersandToken = 44,
|
||||
BarToken = 45,
|
||||
CaretToken = 46,
|
||||
ExclamationToken = 47,
|
||||
TildeToken = 48,
|
||||
AmpersandAmpersandToken = 49,
|
||||
BarBarToken = 50,
|
||||
QuestionToken = 51,
|
||||
ColonToken = 52,
|
||||
AtToken = 53,
|
||||
EqualsToken = 54,
|
||||
PlusEqualsToken = 55,
|
||||
MinusEqualsToken = 56,
|
||||
AsteriskEqualsToken = 57,
|
||||
SlashEqualsToken = 58,
|
||||
PercentEqualsToken = 59,
|
||||
LessThanLessThanEqualsToken = 60,
|
||||
GreaterThanGreaterThanEqualsToken = 61,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 62,
|
||||
AmpersandEqualsToken = 63,
|
||||
BarEqualsToken = 64,
|
||||
CaretEqualsToken = 65,
|
||||
Identifier = 66,
|
||||
BreakKeyword = 67,
|
||||
CaseKeyword = 68,
|
||||
CatchKeyword = 69,
|
||||
ClassKeyword = 70,
|
||||
ConstKeyword = 71,
|
||||
ContinueKeyword = 72,
|
||||
DebuggerKeyword = 73,
|
||||
DefaultKeyword = 74,
|
||||
DeleteKeyword = 75,
|
||||
DoKeyword = 76,
|
||||
ElseKeyword = 77,
|
||||
EnumKeyword = 78,
|
||||
ExportKeyword = 79,
|
||||
ExtendsKeyword = 80,
|
||||
FalseKeyword = 81,
|
||||
FinallyKeyword = 82,
|
||||
ForKeyword = 83,
|
||||
FunctionKeyword = 84,
|
||||
IfKeyword = 85,
|
||||
ImportKeyword = 86,
|
||||
InKeyword = 87,
|
||||
InstanceOfKeyword = 88,
|
||||
NewKeyword = 89,
|
||||
NullKeyword = 90,
|
||||
ReturnKeyword = 91,
|
||||
SuperKeyword = 92,
|
||||
SwitchKeyword = 93,
|
||||
ThisKeyword = 94,
|
||||
ThrowKeyword = 95,
|
||||
TrueKeyword = 96,
|
||||
TryKeyword = 97,
|
||||
TypeOfKeyword = 98,
|
||||
VarKeyword = 99,
|
||||
VoidKeyword = 100,
|
||||
WhileKeyword = 101,
|
||||
WithKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AbstractKeyword = 112,
|
||||
AsKeyword = 113,
|
||||
AnyKeyword = 114,
|
||||
AsyncKeyword = 115,
|
||||
AwaitKeyword = 116,
|
||||
BooleanKeyword = 117,
|
||||
ConstructorKeyword = 118,
|
||||
DeclareKeyword = 119,
|
||||
GetKeyword = 120,
|
||||
IsKeyword = 121,
|
||||
ModuleKeyword = 122,
|
||||
NamespaceKeyword = 123,
|
||||
RequireKeyword = 124,
|
||||
NumberKeyword = 125,
|
||||
SetKeyword = 126,
|
||||
StringKeyword = 127,
|
||||
SymbolKeyword = 128,
|
||||
TypeKeyword = 129,
|
||||
FromKeyword = 130,
|
||||
OfKeyword = 131,
|
||||
QualifiedName = 132,
|
||||
ComputedPropertyName = 133,
|
||||
TypeParameter = 134,
|
||||
Parameter = 135,
|
||||
Decorator = 136,
|
||||
PropertySignature = 137,
|
||||
PropertyDeclaration = 138,
|
||||
MethodSignature = 139,
|
||||
MethodDeclaration = 140,
|
||||
Constructor = 141,
|
||||
GetAccessor = 142,
|
||||
SetAccessor = 143,
|
||||
CallSignature = 144,
|
||||
ConstructSignature = 145,
|
||||
IndexSignature = 146,
|
||||
TypePredicate = 147,
|
||||
TypeReference = 148,
|
||||
FunctionType = 149,
|
||||
ConstructorType = 150,
|
||||
TypeQuery = 151,
|
||||
TypeLiteral = 152,
|
||||
ArrayType = 153,
|
||||
TupleType = 154,
|
||||
UnionType = 155,
|
||||
IntersectionType = 156,
|
||||
ParenthesizedType = 157,
|
||||
ObjectBindingPattern = 158,
|
||||
ArrayBindingPattern = 159,
|
||||
BindingElement = 160,
|
||||
ArrayLiteralExpression = 161,
|
||||
ObjectLiteralExpression = 162,
|
||||
PropertyAccessExpression = 163,
|
||||
ElementAccessExpression = 164,
|
||||
CallExpression = 165,
|
||||
NewExpression = 166,
|
||||
TaggedTemplateExpression = 167,
|
||||
TypeAssertionExpression = 168,
|
||||
ParenthesizedExpression = 169,
|
||||
FunctionExpression = 170,
|
||||
ArrowFunction = 171,
|
||||
DeleteExpression = 172,
|
||||
TypeOfExpression = 173,
|
||||
VoidExpression = 174,
|
||||
AwaitExpression = 175,
|
||||
PrefixUnaryExpression = 176,
|
||||
PostfixUnaryExpression = 177,
|
||||
BinaryExpression = 178,
|
||||
ConditionalExpression = 179,
|
||||
TemplateExpression = 180,
|
||||
YieldExpression = 181,
|
||||
SpreadElementExpression = 182,
|
||||
ClassExpression = 183,
|
||||
OmittedExpression = 184,
|
||||
ExpressionWithTypeArguments = 185,
|
||||
AsExpression = 186,
|
||||
TemplateSpan = 187,
|
||||
SemicolonClassElement = 188,
|
||||
Block = 189,
|
||||
VariableStatement = 190,
|
||||
EmptyStatement = 191,
|
||||
ExpressionStatement = 192,
|
||||
IfStatement = 193,
|
||||
DoStatement = 194,
|
||||
WhileStatement = 195,
|
||||
ForStatement = 196,
|
||||
ForInStatement = 197,
|
||||
ForOfStatement = 198,
|
||||
ContinueStatement = 199,
|
||||
BreakStatement = 200,
|
||||
ReturnStatement = 201,
|
||||
WithStatement = 202,
|
||||
SwitchStatement = 203,
|
||||
LabeledStatement = 204,
|
||||
ThrowStatement = 205,
|
||||
TryStatement = 206,
|
||||
DebuggerStatement = 207,
|
||||
VariableDeclaration = 208,
|
||||
VariableDeclarationList = 209,
|
||||
FunctionDeclaration = 210,
|
||||
ClassDeclaration = 211,
|
||||
InterfaceDeclaration = 212,
|
||||
TypeAliasDeclaration = 213,
|
||||
EnumDeclaration = 214,
|
||||
ModuleDeclaration = 215,
|
||||
ModuleBlock = 216,
|
||||
CaseBlock = 217,
|
||||
ImportEqualsDeclaration = 218,
|
||||
ImportDeclaration = 219,
|
||||
ImportClause = 220,
|
||||
NamespaceImport = 221,
|
||||
NamedImports = 222,
|
||||
ImportSpecifier = 223,
|
||||
ExportAssignment = 224,
|
||||
ExportDeclaration = 225,
|
||||
NamedExports = 226,
|
||||
ExportSpecifier = 227,
|
||||
MissingDeclaration = 228,
|
||||
ExternalModuleReference = 229,
|
||||
JsxElement = 230,
|
||||
JsxSelfClosingElement = 231,
|
||||
JsxOpeningElement = 232,
|
||||
JsxText = 233,
|
||||
JsxClosingElement = 234,
|
||||
JsxAttribute = 235,
|
||||
JsxSpreadAttribute = 236,
|
||||
JsxExpression = 237,
|
||||
CaseClause = 238,
|
||||
DefaultClause = 239,
|
||||
HeritageClause = 240,
|
||||
CatchClause = 241,
|
||||
PropertyAssignment = 242,
|
||||
ShorthandPropertyAssignment = 243,
|
||||
EnumMember = 244,
|
||||
SourceFile = 245,
|
||||
JSDocTypeExpression = 246,
|
||||
JSDocAllType = 247,
|
||||
JSDocUnknownType = 248,
|
||||
JSDocArrayType = 249,
|
||||
JSDocUnionType = 250,
|
||||
JSDocTupleType = 251,
|
||||
JSDocNullableType = 252,
|
||||
JSDocNonNullableType = 253,
|
||||
JSDocRecordType = 254,
|
||||
JSDocRecordMember = 255,
|
||||
JSDocTypeReference = 256,
|
||||
JSDocOptionalType = 257,
|
||||
JSDocFunctionType = 258,
|
||||
JSDocVariadicType = 259,
|
||||
JSDocConstructorType = 260,
|
||||
JSDocThisType = 261,
|
||||
JSDocComment = 262,
|
||||
JSDocTag = 263,
|
||||
JSDocParameterTag = 264,
|
||||
JSDocReturnTag = 265,
|
||||
JSDocTypeTag = 266,
|
||||
JSDocTemplateTag = 267,
|
||||
SyntaxList = 268,
|
||||
Count = 269,
|
||||
FirstAssignment = 54,
|
||||
LastAssignment = 65,
|
||||
FirstReservedWord = 67,
|
||||
LastReservedWord = 102,
|
||||
FirstKeyword = 67,
|
||||
LastKeyword = 131,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstTypeNode = 148,
|
||||
LastTypeNode = 157,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 65,
|
||||
ShebangTrivia = 6,
|
||||
ConflictMarkerTrivia = 7,
|
||||
NumericLiteral = 8,
|
||||
StringLiteral = 9,
|
||||
RegularExpressionLiteral = 10,
|
||||
NoSubstitutionTemplateLiteral = 11,
|
||||
TemplateHead = 12,
|
||||
TemplateMiddle = 13,
|
||||
TemplateTail = 14,
|
||||
OpenBraceToken = 15,
|
||||
CloseBraceToken = 16,
|
||||
OpenParenToken = 17,
|
||||
CloseParenToken = 18,
|
||||
OpenBracketToken = 19,
|
||||
CloseBracketToken = 20,
|
||||
DotToken = 21,
|
||||
DotDotDotToken = 22,
|
||||
SemicolonToken = 23,
|
||||
CommaToken = 24,
|
||||
LessThanToken = 25,
|
||||
LessThanSlashToken = 26,
|
||||
GreaterThanToken = 27,
|
||||
LessThanEqualsToken = 28,
|
||||
GreaterThanEqualsToken = 29,
|
||||
EqualsEqualsToken = 30,
|
||||
ExclamationEqualsToken = 31,
|
||||
EqualsEqualsEqualsToken = 32,
|
||||
ExclamationEqualsEqualsToken = 33,
|
||||
EqualsGreaterThanToken = 34,
|
||||
PlusToken = 35,
|
||||
MinusToken = 36,
|
||||
AsteriskToken = 37,
|
||||
SlashToken = 38,
|
||||
PercentToken = 39,
|
||||
PlusPlusToken = 40,
|
||||
MinusMinusToken = 41,
|
||||
LessThanLessThanToken = 42,
|
||||
GreaterThanGreaterThanToken = 43,
|
||||
GreaterThanGreaterThanGreaterThanToken = 44,
|
||||
AmpersandToken = 45,
|
||||
BarToken = 46,
|
||||
CaretToken = 47,
|
||||
ExclamationToken = 48,
|
||||
TildeToken = 49,
|
||||
AmpersandAmpersandToken = 50,
|
||||
BarBarToken = 51,
|
||||
QuestionToken = 52,
|
||||
ColonToken = 53,
|
||||
AtToken = 54,
|
||||
EqualsToken = 55,
|
||||
PlusEqualsToken = 56,
|
||||
MinusEqualsToken = 57,
|
||||
AsteriskEqualsToken = 58,
|
||||
SlashEqualsToken = 59,
|
||||
PercentEqualsToken = 60,
|
||||
LessThanLessThanEqualsToken = 61,
|
||||
GreaterThanGreaterThanEqualsToken = 62,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 63,
|
||||
AmpersandEqualsToken = 64,
|
||||
BarEqualsToken = 65,
|
||||
CaretEqualsToken = 66,
|
||||
Identifier = 67,
|
||||
BreakKeyword = 68,
|
||||
CaseKeyword = 69,
|
||||
CatchKeyword = 70,
|
||||
ClassKeyword = 71,
|
||||
ConstKeyword = 72,
|
||||
ContinueKeyword = 73,
|
||||
DebuggerKeyword = 74,
|
||||
DefaultKeyword = 75,
|
||||
DeleteKeyword = 76,
|
||||
DoKeyword = 77,
|
||||
ElseKeyword = 78,
|
||||
EnumKeyword = 79,
|
||||
ExportKeyword = 80,
|
||||
ExtendsKeyword = 81,
|
||||
FalseKeyword = 82,
|
||||
FinallyKeyword = 83,
|
||||
ForKeyword = 84,
|
||||
FunctionKeyword = 85,
|
||||
IfKeyword = 86,
|
||||
ImportKeyword = 87,
|
||||
InKeyword = 88,
|
||||
InstanceOfKeyword = 89,
|
||||
NewKeyword = 90,
|
||||
NullKeyword = 91,
|
||||
ReturnKeyword = 92,
|
||||
SuperKeyword = 93,
|
||||
SwitchKeyword = 94,
|
||||
ThisKeyword = 95,
|
||||
ThrowKeyword = 96,
|
||||
TrueKeyword = 97,
|
||||
TryKeyword = 98,
|
||||
TypeOfKeyword = 99,
|
||||
VarKeyword = 100,
|
||||
VoidKeyword = 101,
|
||||
WhileKeyword = 102,
|
||||
WithKeyword = 103,
|
||||
ImplementsKeyword = 104,
|
||||
InterfaceKeyword = 105,
|
||||
LetKeyword = 106,
|
||||
PackageKeyword = 107,
|
||||
PrivateKeyword = 108,
|
||||
ProtectedKeyword = 109,
|
||||
PublicKeyword = 110,
|
||||
StaticKeyword = 111,
|
||||
YieldKeyword = 112,
|
||||
AbstractKeyword = 113,
|
||||
AsKeyword = 114,
|
||||
AnyKeyword = 115,
|
||||
AsyncKeyword = 116,
|
||||
AwaitKeyword = 117,
|
||||
BooleanKeyword = 118,
|
||||
ConstructorKeyword = 119,
|
||||
DeclareKeyword = 120,
|
||||
GetKeyword = 121,
|
||||
IsKeyword = 122,
|
||||
ModuleKeyword = 123,
|
||||
NamespaceKeyword = 124,
|
||||
RequireKeyword = 125,
|
||||
NumberKeyword = 126,
|
||||
SetKeyword = 127,
|
||||
StringKeyword = 128,
|
||||
SymbolKeyword = 129,
|
||||
TypeKeyword = 130,
|
||||
FromKeyword = 131,
|
||||
OfKeyword = 132,
|
||||
QualifiedName = 133,
|
||||
ComputedPropertyName = 134,
|
||||
TypeParameter = 135,
|
||||
Parameter = 136,
|
||||
Decorator = 137,
|
||||
PropertySignature = 138,
|
||||
PropertyDeclaration = 139,
|
||||
MethodSignature = 140,
|
||||
MethodDeclaration = 141,
|
||||
Constructor = 142,
|
||||
GetAccessor = 143,
|
||||
SetAccessor = 144,
|
||||
CallSignature = 145,
|
||||
ConstructSignature = 146,
|
||||
IndexSignature = 147,
|
||||
TypePredicate = 148,
|
||||
TypeReference = 149,
|
||||
FunctionType = 150,
|
||||
ConstructorType = 151,
|
||||
TypeQuery = 152,
|
||||
TypeLiteral = 153,
|
||||
ArrayType = 154,
|
||||
TupleType = 155,
|
||||
UnionType = 156,
|
||||
IntersectionType = 157,
|
||||
ParenthesizedType = 158,
|
||||
ObjectBindingPattern = 159,
|
||||
ArrayBindingPattern = 160,
|
||||
BindingElement = 161,
|
||||
ArrayLiteralExpression = 162,
|
||||
ObjectLiteralExpression = 163,
|
||||
PropertyAccessExpression = 164,
|
||||
ElementAccessExpression = 165,
|
||||
CallExpression = 166,
|
||||
NewExpression = 167,
|
||||
TaggedTemplateExpression = 168,
|
||||
TypeAssertionExpression = 169,
|
||||
ParenthesizedExpression = 170,
|
||||
FunctionExpression = 171,
|
||||
ArrowFunction = 172,
|
||||
DeleteExpression = 173,
|
||||
TypeOfExpression = 174,
|
||||
VoidExpression = 175,
|
||||
AwaitExpression = 176,
|
||||
PrefixUnaryExpression = 177,
|
||||
PostfixUnaryExpression = 178,
|
||||
BinaryExpression = 179,
|
||||
ConditionalExpression = 180,
|
||||
TemplateExpression = 181,
|
||||
YieldExpression = 182,
|
||||
SpreadElementExpression = 183,
|
||||
ClassExpression = 184,
|
||||
OmittedExpression = 185,
|
||||
ExpressionWithTypeArguments = 186,
|
||||
AsExpression = 187,
|
||||
TemplateSpan = 188,
|
||||
SemicolonClassElement = 189,
|
||||
Block = 190,
|
||||
VariableStatement = 191,
|
||||
EmptyStatement = 192,
|
||||
ExpressionStatement = 193,
|
||||
IfStatement = 194,
|
||||
DoStatement = 195,
|
||||
WhileStatement = 196,
|
||||
ForStatement = 197,
|
||||
ForInStatement = 198,
|
||||
ForOfStatement = 199,
|
||||
ContinueStatement = 200,
|
||||
BreakStatement = 201,
|
||||
ReturnStatement = 202,
|
||||
WithStatement = 203,
|
||||
SwitchStatement = 204,
|
||||
LabeledStatement = 205,
|
||||
ThrowStatement = 206,
|
||||
TryStatement = 207,
|
||||
DebuggerStatement = 208,
|
||||
VariableDeclaration = 209,
|
||||
VariableDeclarationList = 210,
|
||||
FunctionDeclaration = 211,
|
||||
ClassDeclaration = 212,
|
||||
InterfaceDeclaration = 213,
|
||||
TypeAliasDeclaration = 214,
|
||||
EnumDeclaration = 215,
|
||||
ModuleDeclaration = 216,
|
||||
ModuleBlock = 217,
|
||||
CaseBlock = 218,
|
||||
ImportEqualsDeclaration = 219,
|
||||
ImportDeclaration = 220,
|
||||
ImportClause = 221,
|
||||
NamespaceImport = 222,
|
||||
NamedImports = 223,
|
||||
ImportSpecifier = 224,
|
||||
ExportAssignment = 225,
|
||||
ExportDeclaration = 226,
|
||||
NamedExports = 227,
|
||||
ExportSpecifier = 228,
|
||||
MissingDeclaration = 229,
|
||||
ExternalModuleReference = 230,
|
||||
JsxElement = 231,
|
||||
JsxSelfClosingElement = 232,
|
||||
JsxOpeningElement = 233,
|
||||
JsxText = 234,
|
||||
JsxClosingElement = 235,
|
||||
JsxAttribute = 236,
|
||||
JsxSpreadAttribute = 237,
|
||||
JsxExpression = 238,
|
||||
CaseClause = 239,
|
||||
DefaultClause = 240,
|
||||
HeritageClause = 241,
|
||||
CatchClause = 242,
|
||||
PropertyAssignment = 243,
|
||||
ShorthandPropertyAssignment = 244,
|
||||
EnumMember = 245,
|
||||
SourceFile = 246,
|
||||
JSDocTypeExpression = 247,
|
||||
JSDocAllType = 248,
|
||||
JSDocUnknownType = 249,
|
||||
JSDocArrayType = 250,
|
||||
JSDocUnionType = 251,
|
||||
JSDocTupleType = 252,
|
||||
JSDocNullableType = 253,
|
||||
JSDocNonNullableType = 254,
|
||||
JSDocRecordType = 255,
|
||||
JSDocRecordMember = 256,
|
||||
JSDocTypeReference = 257,
|
||||
JSDocOptionalType = 258,
|
||||
JSDocFunctionType = 259,
|
||||
JSDocVariadicType = 260,
|
||||
JSDocConstructorType = 261,
|
||||
JSDocThisType = 262,
|
||||
JSDocComment = 263,
|
||||
JSDocTag = 264,
|
||||
JSDocParameterTag = 265,
|
||||
JSDocReturnTag = 266,
|
||||
JSDocTypeTag = 267,
|
||||
JSDocTemplateTag = 268,
|
||||
SyntaxList = 269,
|
||||
Count = 270,
|
||||
FirstAssignment = 55,
|
||||
LastAssignment = 66,
|
||||
FirstReservedWord = 68,
|
||||
LastReservedWord = 103,
|
||||
FirstKeyword = 68,
|
||||
LastKeyword = 132,
|
||||
FirstFutureReservedWord = 104,
|
||||
LastFutureReservedWord = 112,
|
||||
FirstTypeNode = 149,
|
||||
LastTypeNode = 158,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 66,
|
||||
FirstToken = 0,
|
||||
LastToken = 131,
|
||||
LastToken = 132,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
LastLiteralToken = 10,
|
||||
FirstTemplateToken = 10,
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 65,
|
||||
FirstNode = 132,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
LastLiteralToken = 11,
|
||||
FirstTemplateToken = 11,
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 66,
|
||||
FirstNode = 133,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -452,9 +454,9 @@ declare namespace ts {
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
* Examples:
|
||||
* FunctionDeclaration
|
||||
* MethodDeclaration
|
||||
* AccessorDeclaration
|
||||
* - FunctionDeclaration
|
||||
* - MethodDeclaration
|
||||
* - AccessorDeclaration
|
||||
*/
|
||||
interface FunctionLikeDeclaration extends SignatureDeclaration {
|
||||
_functionLikeDeclarationBrand: any;
|
||||
@@ -944,7 +946,7 @@ declare namespace ts {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
interface ParseConfigHost {
|
||||
interface ParseConfigHost extends ModuleResolutionHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
interface WriteFileCallback {
|
||||
@@ -958,6 +960,10 @@ declare namespace ts {
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
interface Program extends ScriptReferenceHost {
|
||||
/**
|
||||
* Get a list of root file names that were passed to a 'createProgram'
|
||||
*/
|
||||
getRootFileNames(): string[];
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
@@ -1019,11 +1025,6 @@ declare namespace ts {
|
||||
emitSkipped: boolean;
|
||||
diagnostics: Diagnostic[];
|
||||
}
|
||||
interface TypeCheckerHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
getSourceFiles(): SourceFile[];
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
}
|
||||
interface TypeChecker {
|
||||
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
|
||||
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
||||
@@ -1031,6 +1032,7 @@ declare namespace ts {
|
||||
getPropertyOfType(type: Type, propertyName: string): Symbol;
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getBaseTypes(type: InterfaceType): ObjectType[];
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
@@ -1054,6 +1056,7 @@ declare namespace ts {
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
|
||||
getJsxIntrinsicTagNames(): Symbol[];
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1198,7 +1201,7 @@ declare namespace ts {
|
||||
Anonymous = 65536,
|
||||
Instantiated = 131072,
|
||||
ObjectLiteral = 524288,
|
||||
ESSymbol = 4194304,
|
||||
ESSymbol = 16777216,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 80896,
|
||||
@@ -1218,8 +1221,6 @@ declare namespace ts {
|
||||
typeParameters: TypeParameter[];
|
||||
outerTypeParameters: TypeParameter[];
|
||||
localTypeParameters: TypeParameter[];
|
||||
resolvedBaseConstructorType?: Type;
|
||||
resolvedBaseTypes: ObjectType[];
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
@@ -1315,6 +1316,7 @@ declare namespace ts {
|
||||
noLib?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outFile?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
@@ -1367,14 +1369,25 @@ declare namespace ts {
|
||||
fileNames: string[];
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
interface CompilerHost {
|
||||
interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string;
|
||||
}
|
||||
interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
interface TextSpan {
|
||||
start: number;
|
||||
@@ -1448,8 +1461,11 @@ declare namespace ts {
|
||||
function couldStartTrivia(text: string, pos: number): boolean;
|
||||
function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
/** Optionally, get the shebang */
|
||||
function getShebang(text: string): string;
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
||||
}
|
||||
declare namespace ts {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
@@ -1489,13 +1505,14 @@ declare namespace ts {
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare namespace ts {
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
@@ -1559,6 +1576,7 @@ declare namespace ts {
|
||||
getConstructSignatures(): Signature[];
|
||||
getStringIndexType(): Type;
|
||||
getNumberIndexType(): Type;
|
||||
getBaseTypes(): ObjectType[];
|
||||
}
|
||||
interface Signature {
|
||||
getDeclaration(): SignatureDeclaration;
|
||||
@@ -1600,6 +1618,7 @@ declare namespace ts {
|
||||
interface PreProcessedFileInfo {
|
||||
referencedFiles: FileReference[];
|
||||
importedFiles: FileReference[];
|
||||
ambientExternalModules: string[];
|
||||
isLibFile: boolean;
|
||||
}
|
||||
interface HostCancellationToken {
|
||||
@@ -1620,6 +1639,7 @@ declare namespace ts {
|
||||
trace?(s: string): void;
|
||||
error?(s: string): void;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
interface LanguageService {
|
||||
cleanupSemanticCache(): void;
|
||||
@@ -1660,6 +1680,7 @@ declare namespace ts {
|
||||
getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[];
|
||||
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[];
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[];
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
|
||||
getEmitOutput(fileName: string): EmitOutput;
|
||||
getProgram(): Program;
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
@@ -1696,6 +1717,11 @@ declare namespace ts {
|
||||
span: TextSpan;
|
||||
newText: string;
|
||||
}
|
||||
interface TextInsertion {
|
||||
newText: string;
|
||||
/** The position in newText the caret should point to after the insertion. */
|
||||
caretOffset: number;
|
||||
}
|
||||
interface RenameLocation {
|
||||
textSpan: TextSpan;
|
||||
fileName: string;
|
||||
@@ -1716,6 +1742,7 @@ declare namespace ts {
|
||||
const writtenReference: string;
|
||||
}
|
||||
interface HighlightSpan {
|
||||
fileName?: string;
|
||||
textSpan: TextSpan;
|
||||
kind: string;
|
||||
}
|
||||
@@ -1743,6 +1770,7 @@ declare namespace ts {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number | string;
|
||||
@@ -1985,6 +2013,7 @@ declare namespace ts {
|
||||
* @param compilationSettings The compilation settings used to acquire the file
|
||||
*/
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
|
||||
reportStats(): string;
|
||||
}
|
||||
module ScriptElementKind {
|
||||
const unknown: string;
|
||||
@@ -2071,10 +2100,24 @@ declare namespace ts {
|
||||
}
|
||||
function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
|
||||
function getDefaultCompilerOptions(): CompilerOptions;
|
||||
interface TranspileOptions {
|
||||
compilerOptions?: CompilerOptions;
|
||||
fileName?: string;
|
||||
reportDiagnostics?: boolean;
|
||||
moduleName?: string;
|
||||
renamedDependencies?: Map<string>;
|
||||
}
|
||||
interface TranspileOutput {
|
||||
outputText: string;
|
||||
diagnostics?: Diagnostic[];
|
||||
sourceMapText?: string;
|
||||
}
|
||||
function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
|
||||
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
||||
+7845
-6469
File diff suppressed because it is too large
Load Diff
@@ -43,5 +43,11 @@
|
||||
"build:compiler": "jake local",
|
||||
"build:tests": "jake tests",
|
||||
"clean": "jake clean"
|
||||
},
|
||||
"browser": {
|
||||
"buffer": false,
|
||||
"fs": false,
|
||||
"os": false,
|
||||
"path": false
|
||||
}
|
||||
}
|
||||
|
||||
+88
-66
@@ -388,7 +388,7 @@ namespace ts {
|
||||
return node1.pos <= node2.pos;
|
||||
}
|
||||
|
||||
if (!compilerOptions.out) {
|
||||
if (!compilerOptions.outFile && !compilerOptions.out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -965,7 +965,9 @@ namespace ts {
|
||||
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
|
||||
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
|
||||
|
||||
if (!moduleName) return;
|
||||
if (!moduleName) {
|
||||
return;
|
||||
}
|
||||
let isRelative = isExternalModuleNameRelative(moduleName);
|
||||
if (!isRelative) {
|
||||
let symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule);
|
||||
@@ -973,20 +975,9 @@ namespace ts {
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
let fileName: string;
|
||||
let sourceFile: SourceFile;
|
||||
while (true) {
|
||||
fileName = normalizePath(combinePaths(searchPath, moduleName));
|
||||
sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension));
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
|
||||
let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
let sourceFile = fileName && host.getSourceFile(fileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
@@ -2175,10 +2166,13 @@ namespace ts {
|
||||
function collectLinkedAliases(node: Identifier): Node[] {
|
||||
let exportSymbol: Symbol;
|
||||
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent);
|
||||
let exportSpecifier = <ExportSpecifier>node.parent;
|
||||
exportSymbol = (<ExportDeclaration>exportSpecifier.parent.parent).moduleSpecifier ?
|
||||
getExternalModuleMember(<ExportDeclaration>exportSpecifier.parent.parent, exportSpecifier) :
|
||||
resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
|
||||
}
|
||||
let result: Node[] = [];
|
||||
if (exportSymbol) {
|
||||
@@ -3131,52 +3125,66 @@ namespace ts {
|
||||
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
|
||||
}
|
||||
|
||||
function findMatchingSignature(signature: Signature, signatureList: Signature[]): Signature {
|
||||
for (let s of signatureList) {
|
||||
// Only signatures with no type parameters may differ in return types
|
||||
if (compareSignatures(signature, s, /*compareReturnTypes*/ !!signature.typeParameters, compareTypes)) {
|
||||
function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature {
|
||||
for (let s of signatureList) {
|
||||
if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findMatchingSignatures(signature: Signature, signatureLists: Signature[][]): Signature[] {
|
||||
function findMatchingSignatures(signatureLists: Signature[][], signature: Signature, listIndex: number): Signature[] {
|
||||
if (signature.typeParameters) {
|
||||
// We require an exact match for generic signatures, so we only return signatures from the first
|
||||
// signature list and only if they have exact matches in the other signature lists.
|
||||
if (listIndex > 0) {
|
||||
return undefined;
|
||||
}
|
||||
for (let i = 1; i < signatureLists.length; i++) {
|
||||
if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return [signature];
|
||||
}
|
||||
let result: Signature[] = undefined;
|
||||
for (let i = 1; i < signatureLists.length; i++) {
|
||||
let match = findMatchingSignature(signature, signatureLists[i]);
|
||||
for (let i = 0; i < signatureLists.length; i++) {
|
||||
// Allow matching non-generic signatures to have excess parameters and different return types
|
||||
let match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
if (!result) {
|
||||
result = [signature];
|
||||
}
|
||||
if (match !== signature) {
|
||||
result.push(match);
|
||||
if (!contains(result, match)) {
|
||||
(result || (result = [])).push(match);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// The signatures of a union type are those signatures that are present and identical in each of the
|
||||
// constituent types, except that non-generic signatures may differ in return types. When signatures
|
||||
// differ in return types, the resulting return type is the union of the constituent return types.
|
||||
// The signatures of a union type are those signatures that are present in each of the constituent types.
|
||||
// Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional
|
||||
// parameters and may differ in return types. When signatures differ in return types, the resulting return
|
||||
// type is the union of the constituent return types.
|
||||
function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] {
|
||||
let signatureLists = map(types, t => getSignaturesOfType(t, kind));
|
||||
let result: Signature[] = undefined;
|
||||
for (let source of signatureLists[0]) {
|
||||
let unionSignatures = findMatchingSignatures(source, signatureLists);
|
||||
if (unionSignatures) {
|
||||
let signature: Signature = undefined;
|
||||
if (unionSignatures.length === 1 || source.typeParameters) {
|
||||
signature = source;
|
||||
for (let i = 0; i < signatureLists.length; i++) {
|
||||
for (let 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)) {
|
||||
let 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);
|
||||
// Clear resolved return type we possibly got from cloneSignature
|
||||
s.resolvedReturnType = undefined;
|
||||
s.unionSignatures = unionSignatures;
|
||||
}
|
||||
(result || (result = [])).push(s);
|
||||
}
|
||||
}
|
||||
else {
|
||||
signature = cloneSignature(source);
|
||||
// Clear resolved return type we possibly got from cloneSignature
|
||||
signature.resolvedReturnType = undefined;
|
||||
signature.unionSignatures = unionSignatures;
|
||||
}
|
||||
(result || (result = [])).push(signature);
|
||||
}
|
||||
}
|
||||
return result || emptyArray;
|
||||
@@ -5272,7 +5280,7 @@ namespace ts {
|
||||
}
|
||||
let result = Ternary.True;
|
||||
for (let i = 0, len = sourceSignatures.length; i < len; ++i) {
|
||||
let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*compareReturnTypes*/ true, isRelatedTo);
|
||||
let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo);
|
||||
if (!related) {
|
||||
return Ternary.False;
|
||||
}
|
||||
@@ -5402,14 +5410,18 @@ namespace ts {
|
||||
return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
|
||||
}
|
||||
|
||||
function compareSignatures(source: Signature, target: Signature, compareReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary {
|
||||
function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary {
|
||||
if (source === target) {
|
||||
return Ternary.True;
|
||||
}
|
||||
if (source.parameters.length !== target.parameters.length ||
|
||||
source.minArgumentCount !== target.minArgumentCount ||
|
||||
source.hasRestParameter !== target.hasRestParameter) {
|
||||
return Ternary.False;
|
||||
if (!partialMatch ||
|
||||
source.parameters.length < target.parameters.length && !source.hasRestParameter ||
|
||||
source.minArgumentCount > target.minArgumentCount) {
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
let result = Ternary.True;
|
||||
if (source.typeParameters && target.typeParameters) {
|
||||
@@ -5431,16 +5443,18 @@ namespace ts {
|
||||
// M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
|
||||
source = getErasedSignature(source);
|
||||
target = getErasedSignature(target);
|
||||
for (let i = 0, len = source.parameters.length; i < len; i++) {
|
||||
let s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
|
||||
let t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]);
|
||||
let sourceLen = source.parameters.length;
|
||||
let targetLen = target.parameters.length;
|
||||
for (let i = 0; i < targetLen; i++) {
|
||||
let s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
|
||||
let t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]);
|
||||
let related = compareTypes(s, t);
|
||||
if (!related) {
|
||||
return Ternary.False;
|
||||
}
|
||||
result &= related;
|
||||
}
|
||||
if (compareReturnTypes) {
|
||||
if (!ignoreReturnTypes) {
|
||||
result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
|
||||
}
|
||||
return result;
|
||||
@@ -6954,20 +6968,13 @@ namespace ts {
|
||||
let signatureList: Signature[];
|
||||
let types = (<UnionType>type).types;
|
||||
for (let current of types) {
|
||||
// The signature set of all constituent type with call signatures should match
|
||||
// So number of signatures allowed is either 0 or 1
|
||||
if (signatureList &&
|
||||
getSignaturesOfStructuredType(current, SignatureKind.Call).length > 1) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let signature = getNonGenericSignature(current);
|
||||
if (signature) {
|
||||
if (!signatureList) {
|
||||
// This signature will contribute to contextual union signature
|
||||
signatureList = [signature];
|
||||
}
|
||||
else if (!compareSignatures(signatureList[0], signature, /*compareReturnTypes*/ false, compareTypes)) {
|
||||
else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) {
|
||||
// Signatures aren't identical, do not use
|
||||
return undefined;
|
||||
}
|
||||
@@ -11377,9 +11384,16 @@ namespace ts {
|
||||
// serialize the type metadata.
|
||||
if (node && node.kind === SyntaxKind.TypeReference) {
|
||||
let root = getFirstIdentifier((<TypeReferenceNode>node).typeName);
|
||||
let rootSymbol = resolveName(root, root.text, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {
|
||||
markAliasSymbolAsReferenced(rootSymbol);
|
||||
let meaning = root.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace;
|
||||
// Resolve type so we know which symbol is referenced
|
||||
let rootSymbol = resolveName(root, root.text, meaning | SymbolFlags.Alias, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
// Resolved symbol is alias
|
||||
if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias) {
|
||||
let aliasTarget = resolveAlias(rootSymbol);
|
||||
// If alias has value symbol - mark alias as referenced
|
||||
if (aliasTarget.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {
|
||||
markAliasSymbolAsReferenced(rootSymbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13315,7 +13329,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
if (languageVersion >= ScriptTarget.ES6 && !isInAmbientContext(node)) {
|
||||
// Import equals declaration is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead);
|
||||
}
|
||||
@@ -13838,7 +13852,11 @@ namespace ts {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (introducesArgumentsExoticObject(location)) {
|
||||
copySymbol(argumentsSymbol, meaning);
|
||||
}
|
||||
|
||||
memberFlags = location.flags;
|
||||
location = location.parent;
|
||||
}
|
||||
@@ -14391,6 +14409,10 @@ namespace ts {
|
||||
|
||||
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
|
||||
let typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true);
|
||||
// We might not be able to resolve type symbol so use unknown type in that case (eg error case)
|
||||
if (!typeSymbol) {
|
||||
return TypeReferenceSerializationKind.ObjectType;
|
||||
}
|
||||
let type = getDeclaredTypeOfSymbol(typeSymbol);
|
||||
if (type === unknownType) {
|
||||
return TypeReferenceSerializationKind.Unknown;
|
||||
|
||||
@@ -120,6 +120,13 @@ namespace ts {
|
||||
{
|
||||
name: "out",
|
||||
type: "string",
|
||||
isFilePath: false, // This is intentionally broken to support compatability with existing tsconfig files
|
||||
// for correct behaviour, please use outFile
|
||||
paramType: Diagnostics.FILE,
|
||||
},
|
||||
{
|
||||
name: "outFile",
|
||||
type: "string",
|
||||
isFilePath: true,
|
||||
description: Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
paramType: Diagnostics.FILE,
|
||||
@@ -218,7 +225,16 @@ namespace ts {
|
||||
type: "boolean",
|
||||
experimental: true,
|
||||
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "moduleResolution",
|
||||
type: {
|
||||
"node": ModuleResolutionKind.NodeJs,
|
||||
"classic": ModuleResolutionKind.Classic
|
||||
},
|
||||
experimental: true,
|
||||
description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6
|
||||
}
|
||||
];
|
||||
|
||||
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace ts {
|
||||
set,
|
||||
contains,
|
||||
remove,
|
||||
clear,
|
||||
forEachValue: forEachValueInMap
|
||||
};
|
||||
|
||||
@@ -51,6 +52,10 @@ namespace ts {
|
||||
function normalizeKey(key: string) {
|
||||
return getCanonicalFileName(normalizeSlashes(key));
|
||||
}
|
||||
|
||||
function clear() {
|
||||
files = {};
|
||||
}
|
||||
}
|
||||
|
||||
export const enum Comparison {
|
||||
@@ -716,7 +721,7 @@ namespace ts {
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedExtensions = [".tsx", ".ts", ".d.ts"];
|
||||
export const supportedExtensions = [".ts", ".tsx", ".d.ts"];
|
||||
|
||||
const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
|
||||
@@ -1574,7 +1574,7 @@ namespace ts {
|
||||
? referencedFile.fileName // Declaration file, use declaration file name
|
||||
: shouldEmitToOwnFile(referencedFile, compilerOptions)
|
||||
? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file
|
||||
: removeFileExtension(compilerOptions.out) + ".d.ts"; // Global out file
|
||||
: removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file
|
||||
|
||||
declFileName = getRelativePathToDirectoryOrUrl(
|
||||
getDirectoryPath(normalizeSlashes(jsFilePath)),
|
||||
|
||||
@@ -506,19 +506,11 @@ namespace ts {
|
||||
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." },
|
||||
Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." },
|
||||
Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." },
|
||||
Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
|
||||
Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." },
|
||||
Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." },
|
||||
Option_0_cannot_be_specified_with_option_1: { code: 5053, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." },
|
||||
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
|
||||
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." },
|
||||
@@ -569,11 +561,11 @@ namespace ts {
|
||||
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
|
||||
Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" },
|
||||
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
|
||||
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
|
||||
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
|
||||
@@ -2013,59 +2013,27 @@
|
||||
"category": "Error",
|
||||
"code": 5033
|
||||
},
|
||||
"Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": {
|
||||
"category": "Error",
|
||||
"code": 5038
|
||||
},
|
||||
"Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": {
|
||||
"category": "Error",
|
||||
"code": 5039
|
||||
},
|
||||
"Option 'noEmit' cannot be specified with option 'out' or 'outDir'.": {
|
||||
"category": "Error",
|
||||
"code": 5040
|
||||
},
|
||||
"Option 'noEmit' cannot be specified with option 'declaration'.": {
|
||||
"category": "Error",
|
||||
"code": 5041
|
||||
},
|
||||
"Option 'project' cannot be mixed with source files on a command line.": {
|
||||
"category": "Error",
|
||||
"code": 5042
|
||||
},
|
||||
"Option 'declaration' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5044
|
||||
},
|
||||
"Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5045
|
||||
},
|
||||
"Option 'out' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5046
|
||||
},
|
||||
"Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 5047
|
||||
},
|
||||
"Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"category": "Error",
|
||||
"code": 5048
|
||||
},
|
||||
"Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"category": "Error",
|
||||
"code": 5049
|
||||
},
|
||||
"Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"category": "Error",
|
||||
"code": 5050
|
||||
},
|
||||
"Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": {
|
||||
"category": "Error",
|
||||
"code": 5051
|
||||
},
|
||||
|
||||
"Option '{0}' cannot be specified without specifying option '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 5052
|
||||
},
|
||||
"Option '{0}' cannot be specified with option '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 5053
|
||||
},
|
||||
|
||||
"Concatenate and emit output to single file.": {
|
||||
"category": "Message",
|
||||
"code": 6001
|
||||
@@ -2266,10 +2234,6 @@
|
||||
"category": "Message",
|
||||
"code": 6081
|
||||
},
|
||||
"Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": {
|
||||
"category": "Error",
|
||||
"code": 6064
|
||||
},
|
||||
"Enables experimental support for ES7 decorators.": {
|
||||
"category": "Message",
|
||||
"code": 6065
|
||||
@@ -2286,6 +2250,10 @@
|
||||
"category": "Message",
|
||||
"code": 6068
|
||||
},
|
||||
"Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) .": {
|
||||
"category": "Message",
|
||||
"code": 6069
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
|
||||
+388
-69
@@ -78,18 +78,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
});
|
||||
|
||||
if (compilerOptions.out) {
|
||||
emitFile(compilerOptions.out);
|
||||
if (compilerOptions.outFile || compilerOptions.out) {
|
||||
emitFile(compilerOptions.outFile || compilerOptions.out);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service)
|
||||
if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) {
|
||||
let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js");
|
||||
let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js");
|
||||
emitFile(jsFilePath, targetSourceFile);
|
||||
}
|
||||
else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) {
|
||||
emitFile(compilerOptions.out);
|
||||
else if (!isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) {
|
||||
emitFile(compilerOptions.outFile || compilerOptions.out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
let writeComment = writeCommentRange;
|
||||
|
||||
/** Emit a node */
|
||||
let emit = emitNodeWithoutSourceMap;
|
||||
let emit = emitNodeWithCommentsAndWithoutSourcemap;
|
||||
|
||||
/** Called just before starting emit of a node */
|
||||
let emitStart = function (node: Node) { };
|
||||
@@ -687,9 +687,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitNodeWithCommentsAndWithSourcemap(node: Node) {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap);
|
||||
}
|
||||
|
||||
writeEmittedFiles = writeJavaScriptAndSourceMapFile;
|
||||
emit = emitNodeWithSourceMap;
|
||||
emit = emitNodeWithCommentsAndWithSourcemap;
|
||||
emitStart = recordEmitNodeStartSpan;
|
||||
emitEnd = recordEmitNodeEndSpan;
|
||||
emitToken = writeTextWithSpanRecord;
|
||||
@@ -1515,7 +1519,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return;
|
||||
}
|
||||
}
|
||||
writeTextOfNode(currentSourceFile, node);
|
||||
|
||||
if (nodeIsSynthesized(node)) {
|
||||
write(node.text);
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentSourceFile, node);
|
||||
}
|
||||
}
|
||||
|
||||
function isNameOfNestedRedeclaration(node: Identifier) {
|
||||
@@ -1542,6 +1552,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
else if (isNameOfNestedRedeclaration(node)) {
|
||||
write(getGeneratedNameForNode(node));
|
||||
}
|
||||
else if (nodeIsSynthesized(node)) {
|
||||
write(node.text);
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentSourceFile, node);
|
||||
}
|
||||
@@ -2126,7 +2139,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(node.right);
|
||||
emit(node.right);
|
||||
}
|
||||
|
||||
function emitEntityNameAsExpression(node: EntityName, useFallback: boolean) {
|
||||
@@ -2818,7 +2831,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitNodeWithoutSourceMap(counter);
|
||||
write(" < ");
|
||||
|
||||
emitNodeWithoutSourceMap(rhsReference);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(rhsReference);
|
||||
write(".length");
|
||||
|
||||
emitEnd(node.initializer);
|
||||
@@ -2853,7 +2866,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
else {
|
||||
// The following call does not include the initializer, so we have
|
||||
// to emit it separately.
|
||||
emitNodeWithoutSourceMap(declaration);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(declaration);
|
||||
write(" = ");
|
||||
emitNodeWithoutSourceMap(rhsIterationValue);
|
||||
}
|
||||
@@ -2876,7 +2889,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined);
|
||||
}
|
||||
else {
|
||||
emitNodeWithoutSourceMap(assignmentExpression);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression);
|
||||
}
|
||||
}
|
||||
emitEnd(node.initializer);
|
||||
@@ -3032,7 +3045,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("exports.");
|
||||
}
|
||||
}
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
emitEnd(node.name);
|
||||
}
|
||||
|
||||
@@ -3078,7 +3091,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("default");
|
||||
}
|
||||
else {
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
}
|
||||
write(`", `);
|
||||
emitDeclarationName(node);
|
||||
@@ -3116,7 +3129,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitStart(specifier.name);
|
||||
emitContainingModuleName(specifier);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
emitEnd(specifier.name);
|
||||
write(" = ");
|
||||
emitExpressionIdentifier(name);
|
||||
@@ -3131,7 +3144,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
write(`", `);
|
||||
emitExpressionIdentifier(specifier.propertyName || specifier.name);
|
||||
write(")");
|
||||
@@ -3176,7 +3189,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
@@ -3408,7 +3421,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
@@ -3564,9 +3577,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitEnd(parameter);
|
||||
write(" { ");
|
||||
emitStart(parameter);
|
||||
emitNodeWithoutSourceMap(paramName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(paramName);
|
||||
write(" = ");
|
||||
emitNodeWithoutSourceMap(initializer);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(initializer);
|
||||
emitEnd(parameter);
|
||||
write("; }");
|
||||
}
|
||||
@@ -3589,7 +3602,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitLeadingComments(restParam);
|
||||
emitStart(restParam);
|
||||
write("var ");
|
||||
emitNodeWithoutSourceMap(restParam.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
|
||||
write(" = [];");
|
||||
emitEnd(restParam);
|
||||
emitTrailingComments(restParam);
|
||||
@@ -3610,7 +3623,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
emitStart(restParam);
|
||||
emitNodeWithoutSourceMap(restParam.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
|
||||
write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];");
|
||||
emitEnd(restParam);
|
||||
decreaseIndent();
|
||||
@@ -3631,7 +3644,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
function emitDeclarationName(node: Declaration) {
|
||||
if (node.name) {
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
}
|
||||
else {
|
||||
write(getGeneratedNameForNode(node));
|
||||
@@ -3675,6 +3688,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
emitStart(node);
|
||||
// For targeting below es6, emit functions-like declaration including arrow function using function keyword.
|
||||
// When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead
|
||||
if (!shouldEmitAsArrowFunction(node)) {
|
||||
@@ -3700,6 +3714,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments((<FunctionDeclaration>node).name);
|
||||
}
|
||||
|
||||
emitEnd(node);
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
@@ -4055,10 +4071,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitMemberAccessForPropertyName(memberName: DeclarationName) {
|
||||
// TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here.
|
||||
// This does not emit source map because it is emitted by caller as caller
|
||||
// is aware how the property name changes to the property access
|
||||
// eg. public x = 10; becomes this.x and static x = 10 becomes className.x
|
||||
if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) {
|
||||
write("[");
|
||||
emitNodeWithoutSourceMap(memberName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(memberName);
|
||||
write("]");
|
||||
}
|
||||
else if (memberName.kind === SyntaxKind.ComputedPropertyName) {
|
||||
@@ -4066,7 +4084,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(memberName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(memberName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4134,10 +4152,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitMemberAccessForPropertyName((<MethodDeclaration>member).name);
|
||||
emitEnd((<MethodDeclaration>member).name);
|
||||
write(" = ");
|
||||
emitStart(member);
|
||||
emitFunctionDeclaration(<MethodDeclaration>member);
|
||||
emitEnd(member);
|
||||
emitEnd(member);
|
||||
write(";");
|
||||
emitTrailingComments(member);
|
||||
}
|
||||
@@ -5124,7 +5140,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
argumentsWritten++;
|
||||
}
|
||||
if (shouldEmitParamTypesMetadata(node)) {
|
||||
debugger;
|
||||
if (writeComma || argumentsWritten) {
|
||||
write(", ");
|
||||
}
|
||||
@@ -5343,13 +5358,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitExportMemberAssignments(<Identifier>node.name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
|
||||
* Here we check if alternative name was provided for a given moduleName and return it if possible.
|
||||
*/
|
||||
function tryRenameExternalModule(moduleName: LiteralExpression): string {
|
||||
if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) {
|
||||
return `"${currentSourceFile.renamedDependencies[moduleName.text]}"`
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function emitRequire(moduleName: Expression) {
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
write("require(");
|
||||
emitStart(moduleName);
|
||||
emitLiteral(<LiteralExpression>moduleName);
|
||||
emitEnd(moduleName);
|
||||
let text = tryRenameExternalModule(<LiteralExpression>moduleName);
|
||||
if (text) {
|
||||
write(text);
|
||||
}
|
||||
else {
|
||||
emitStart(moduleName);
|
||||
emitLiteral(<LiteralExpression>moduleName);
|
||||
emitEnd(moduleName);
|
||||
}
|
||||
emitToken(SyntaxKind.CloseParenToken, moduleName.end);
|
||||
}
|
||||
else {
|
||||
@@ -5563,11 +5595,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitStart(specifier);
|
||||
emitContainingModuleName(specifier);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
write(" = ");
|
||||
write(generatedName);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.propertyName || specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name);
|
||||
write(";");
|
||||
emitEnd(specifier);
|
||||
}
|
||||
@@ -5590,7 +5622,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
if (!node.exportClause || resolver.isValueAliasDeclaration(node)) {
|
||||
emitStart(node);
|
||||
write("export ");
|
||||
if (node.exportClause) {
|
||||
// export { x, y, ... }
|
||||
@@ -5603,10 +5634,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
if (node.moduleSpecifier) {
|
||||
write(" from ");
|
||||
emitNodeWithoutSourceMap(node.moduleSpecifier);
|
||||
emit(node.moduleSpecifier);
|
||||
}
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5620,13 +5650,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (needsComma) {
|
||||
write(", ");
|
||||
}
|
||||
emitStart(specifier);
|
||||
if (specifier.propertyName) {
|
||||
emitNodeWithoutSourceMap(specifier.propertyName);
|
||||
emit(specifier.propertyName);
|
||||
write(" as ");
|
||||
}
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitEnd(specifier);
|
||||
emit(specifier.name);
|
||||
needsComma = true;
|
||||
}
|
||||
}
|
||||
@@ -5752,7 +5780,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
|
||||
let moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
return getLiteralText(<LiteralExpression>moduleName);
|
||||
return tryRenameExternalModule(<LiteralExpression>moduleName) || getLiteralText(<LiteralExpression>moduleName);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -5913,7 +5941,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
writeLine();
|
||||
write("'");
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
emitNodeWithoutSourceMap(node);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node);
|
||||
}
|
||||
else {
|
||||
emitDeclarationName(<Declaration>node);
|
||||
@@ -6211,9 +6239,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
let e = (<ExportDeclaration>entry).exportClause.elements[i];
|
||||
write(`"`);
|
||||
emitNodeWithoutSourceMap(e.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(e.name);
|
||||
write(`": ${parameterName}["`);
|
||||
emitNodeWithoutSourceMap(e.propertyName || e.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name);
|
||||
write(`"]`);
|
||||
}
|
||||
decreaseIndent();
|
||||
@@ -6317,10 +6345,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
groupIndices[text] = dependencyGroups.length;
|
||||
dependencyGroups.push([externalImports[i]]);
|
||||
}
|
||||
|
||||
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
write(text);
|
||||
}
|
||||
write(`], function(${exportFunctionForFile}) {`);
|
||||
@@ -6492,9 +6521,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function trimReactWhitespace(node: JsxText): string {
|
||||
function trimReactWhitespaceAndApplyEntities(node: JsxText): string {
|
||||
let result: string = undefined;
|
||||
let text = getTextOfNode(node);
|
||||
let text = getTextOfNode(node, /*includeTrivia*/ true);
|
||||
let firstNonWhitespace = 0;
|
||||
let lastNonWhitespace = -1;
|
||||
|
||||
@@ -6517,19 +6546,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firstNonWhitespace !== -1) {
|
||||
let part = text.substr(firstNonWhitespace);
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + part;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
// Replace entities like
|
||||
result = result.replace(/&(\w+);/g, function(s: any, m: string) {
|
||||
if (entities[m] !== undefined) {
|
||||
return String.fromCharCode(entities[m]);
|
||||
}
|
||||
else {
|
||||
return s;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getTextToEmit(node: JsxText) {
|
||||
switch (compilerOptions.jsx) {
|
||||
case JsxEmit.React:
|
||||
let text = trimReactWhitespace(node);
|
||||
if (text.length === 0) {
|
||||
let text = trimReactWhitespaceAndApplyEntities(node);
|
||||
if (text === undefined || text.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
@@ -6537,7 +6579,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
case JsxEmit.Preserve:
|
||||
default:
|
||||
return getTextOfNode(node, true);
|
||||
return getTextOfNode(node, /*includeTrivia*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6545,13 +6587,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
switch (compilerOptions.jsx) {
|
||||
case JsxEmit.React:
|
||||
write("\"");
|
||||
write(trimReactWhitespace(node));
|
||||
write(trimReactWhitespaceAndApplyEntities(node));
|
||||
write("\"");
|
||||
break;
|
||||
|
||||
case JsxEmit.Preserve:
|
||||
default: // Emit JSX-preserve as default when no --jsx flag is specified
|
||||
writer.writeLiteral(getTextOfNode(node, true));
|
||||
writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6669,28 +6711,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitLeadingComments(node.endOfFileToken);
|
||||
}
|
||||
|
||||
function emitNodeWithoutSourceMap(node: Node): void {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
function emitNodeWithCommentsAndWithoutSourcemap(node: Node): void {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap);
|
||||
}
|
||||
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
function emitNodeConsideringCommentsOption(node: Node, emitNodeConsideringSourcemap: (node: Node) => void): void {
|
||||
if (node) {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitCommentsOnNotEmittedNode(node);
|
||||
}
|
||||
|
||||
let emitComments = shouldEmitLeadingAndTrailingComments(node);
|
||||
if (emitComments) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
if (isSpecializedCommentHandling(node)) {
|
||||
// This is the node that will handle its own comments and sourcemap
|
||||
return emitNodeWithoutSourceMap(node);
|
||||
}
|
||||
|
||||
emitJavaScriptWorker(node);
|
||||
let emitComments = shouldEmitLeadingAndTrailingComments(node);
|
||||
if (emitComments) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
emitNodeConsideringSourcemap(node);
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
function emitNodeWithoutSourceMap(node: Node): void {
|
||||
if (node) {
|
||||
emitJavaScriptWorker(node);
|
||||
}
|
||||
}
|
||||
|
||||
function isSpecializedCommentHandling(node: Node): boolean {
|
||||
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.
|
||||
@@ -6700,8 +6755,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableStatement:
|
||||
return shouldEmitLeadingAndTrailingCommentsForVariableStatement(<VariableStatement>node);
|
||||
|
||||
@@ -6716,6 +6775,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return shouldEmitEnumDeclaration(<EnumDeclaration>node);
|
||||
}
|
||||
|
||||
// If the node is emitted in specialized fashion, dont emit comments as this node will handle
|
||||
// emitting comments when emitting itself
|
||||
Debug.assert(!isSpecializedCommentHandling(node));
|
||||
|
||||
// If this is the expression body of an arrow function that we're down-leveling,
|
||||
// then we don't want to emit comments when we emit the body. It will have already
|
||||
// been taken care of when we emitted the 'return' statement for the function
|
||||
@@ -7123,4 +7186,260 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var entities: Map<number> = {
|
||||
"quot": 0x0022,
|
||||
"amp": 0x0026,
|
||||
"apos": 0x0027,
|
||||
"lt": 0x003C,
|
||||
"gt": 0x003E,
|
||||
"nbsp": 0x00A0,
|
||||
"iexcl": 0x00A1,
|
||||
"cent": 0x00A2,
|
||||
"pound": 0x00A3,
|
||||
"curren": 0x00A4,
|
||||
"yen": 0x00A5,
|
||||
"brvbar": 0x00A6,
|
||||
"sect": 0x00A7,
|
||||
"uml": 0x00A8,
|
||||
"copy": 0x00A9,
|
||||
"ordf": 0x00AA,
|
||||
"laquo": 0x00AB,
|
||||
"not": 0x00AC,
|
||||
"shy": 0x00AD,
|
||||
"reg": 0x00AE,
|
||||
"macr": 0x00AF,
|
||||
"deg": 0x00B0,
|
||||
"plusmn": 0x00B1,
|
||||
"sup2": 0x00B2,
|
||||
"sup3": 0x00B3,
|
||||
"acute": 0x00B4,
|
||||
"micro": 0x00B5,
|
||||
"para": 0x00B6,
|
||||
"middot": 0x00B7,
|
||||
"cedil": 0x00B8,
|
||||
"sup1": 0x00B9,
|
||||
"ordm": 0x00BA,
|
||||
"raquo": 0x00BB,
|
||||
"frac14": 0x00BC,
|
||||
"frac12": 0x00BD,
|
||||
"frac34": 0x00BE,
|
||||
"iquest": 0x00BF,
|
||||
"Agrave": 0x00C0,
|
||||
"Aacute": 0x00C1,
|
||||
"Acirc": 0x00C2,
|
||||
"Atilde": 0x00C3,
|
||||
"Auml": 0x00C4,
|
||||
"Aring": 0x00C5,
|
||||
"AElig": 0x00C6,
|
||||
"Ccedil": 0x00C7,
|
||||
"Egrave": 0x00C8,
|
||||
"Eacute": 0x00C9,
|
||||
"Ecirc": 0x00CA,
|
||||
"Euml": 0x00CB,
|
||||
"Igrave": 0x00CC,
|
||||
"Iacute": 0x00CD,
|
||||
"Icirc": 0x00CE,
|
||||
"Iuml": 0x00CF,
|
||||
"ETH": 0x00D0,
|
||||
"Ntilde": 0x00D1,
|
||||
"Ograve": 0x00D2,
|
||||
"Oacute": 0x00D3,
|
||||
"Ocirc": 0x00D4,
|
||||
"Otilde": 0x00D5,
|
||||
"Ouml": 0x00D6,
|
||||
"times": 0x00D7,
|
||||
"Oslash": 0x00D8,
|
||||
"Ugrave": 0x00D9,
|
||||
"Uacute": 0x00DA,
|
||||
"Ucirc": 0x00DB,
|
||||
"Uuml": 0x00DC,
|
||||
"Yacute": 0x00DD,
|
||||
"THORN": 0x00DE,
|
||||
"szlig": 0x00DF,
|
||||
"agrave": 0x00E0,
|
||||
"aacute": 0x00E1,
|
||||
"acirc": 0x00E2,
|
||||
"atilde": 0x00E3,
|
||||
"auml": 0x00E4,
|
||||
"aring": 0x00E5,
|
||||
"aelig": 0x00E6,
|
||||
"ccedil": 0x00E7,
|
||||
"egrave": 0x00E8,
|
||||
"eacute": 0x00E9,
|
||||
"ecirc": 0x00EA,
|
||||
"euml": 0x00EB,
|
||||
"igrave": 0x00EC,
|
||||
"iacute": 0x00ED,
|
||||
"icirc": 0x00EE,
|
||||
"iuml": 0x00EF,
|
||||
"eth": 0x00F0,
|
||||
"ntilde": 0x00F1,
|
||||
"ograve": 0x00F2,
|
||||
"oacute": 0x00F3,
|
||||
"ocirc": 0x00F4,
|
||||
"otilde": 0x00F5,
|
||||
"ouml": 0x00F6,
|
||||
"divide": 0x00F7,
|
||||
"oslash": 0x00F8,
|
||||
"ugrave": 0x00F9,
|
||||
"uacute": 0x00FA,
|
||||
"ucirc": 0x00FB,
|
||||
"uuml": 0x00FC,
|
||||
"yacute": 0x00FD,
|
||||
"thorn": 0x00FE,
|
||||
"yuml": 0x00FF,
|
||||
"OElig": 0x0152,
|
||||
"oelig": 0x0153,
|
||||
"Scaron": 0x0160,
|
||||
"scaron": 0x0161,
|
||||
"Yuml": 0x0178,
|
||||
"fnof": 0x0192,
|
||||
"circ": 0x02C6,
|
||||
"tilde": 0x02DC,
|
||||
"Alpha": 0x0391,
|
||||
"Beta": 0x0392,
|
||||
"Gamma": 0x0393,
|
||||
"Delta": 0x0394,
|
||||
"Epsilon": 0x0395,
|
||||
"Zeta": 0x0396,
|
||||
"Eta": 0x0397,
|
||||
"Theta": 0x0398,
|
||||
"Iota": 0x0399,
|
||||
"Kappa": 0x039A,
|
||||
"Lambda": 0x039B,
|
||||
"Mu": 0x039C,
|
||||
"Nu": 0x039D,
|
||||
"Xi": 0x039E,
|
||||
"Omicron": 0x039F,
|
||||
"Pi": 0x03A0,
|
||||
"Rho": 0x03A1,
|
||||
"Sigma": 0x03A3,
|
||||
"Tau": 0x03A4,
|
||||
"Upsilon": 0x03A5,
|
||||
"Phi": 0x03A6,
|
||||
"Chi": 0x03A7,
|
||||
"Psi": 0x03A8,
|
||||
"Omega": 0x03A9,
|
||||
"alpha": 0x03B1,
|
||||
"beta": 0x03B2,
|
||||
"gamma": 0x03B3,
|
||||
"delta": 0x03B4,
|
||||
"epsilon": 0x03B5,
|
||||
"zeta": 0x03B6,
|
||||
"eta": 0x03B7,
|
||||
"theta": 0x03B8,
|
||||
"iota": 0x03B9,
|
||||
"kappa": 0x03BA,
|
||||
"lambda": 0x03BB,
|
||||
"mu": 0x03BC,
|
||||
"nu": 0x03BD,
|
||||
"xi": 0x03BE,
|
||||
"omicron": 0x03BF,
|
||||
"pi": 0x03C0,
|
||||
"rho": 0x03C1,
|
||||
"sigmaf": 0x03C2,
|
||||
"sigma": 0x03C3,
|
||||
"tau": 0x03C4,
|
||||
"upsilon": 0x03C5,
|
||||
"phi": 0x03C6,
|
||||
"chi": 0x03C7,
|
||||
"psi": 0x03C8,
|
||||
"omega": 0x03C9,
|
||||
"thetasym": 0x03D1,
|
||||
"upsih": 0x03D2,
|
||||
"piv": 0x03D6,
|
||||
"ensp": 0x2002,
|
||||
"emsp": 0x2003,
|
||||
"thinsp": 0x2009,
|
||||
"zwnj": 0x200C,
|
||||
"zwj": 0x200D,
|
||||
"lrm": 0x200E,
|
||||
"rlm": 0x200F,
|
||||
"ndash": 0x2013,
|
||||
"mdash": 0x2014,
|
||||
"lsquo": 0x2018,
|
||||
"rsquo": 0x2019,
|
||||
"sbquo": 0x201A,
|
||||
"ldquo": 0x201C,
|
||||
"rdquo": 0x201D,
|
||||
"bdquo": 0x201E,
|
||||
"dagger": 0x2020,
|
||||
"Dagger": 0x2021,
|
||||
"bull": 0x2022,
|
||||
"hellip": 0x2026,
|
||||
"permil": 0x2030,
|
||||
"prime": 0x2032,
|
||||
"Prime": 0x2033,
|
||||
"lsaquo": 0x2039,
|
||||
"rsaquo": 0x203A,
|
||||
"oline": 0x203E,
|
||||
"frasl": 0x2044,
|
||||
"euro": 0x20AC,
|
||||
"image": 0x2111,
|
||||
"weierp": 0x2118,
|
||||
"real": 0x211C,
|
||||
"trade": 0x2122,
|
||||
"alefsym": 0x2135,
|
||||
"larr": 0x2190,
|
||||
"uarr": 0x2191,
|
||||
"rarr": 0x2192,
|
||||
"darr": 0x2193,
|
||||
"harr": 0x2194,
|
||||
"crarr": 0x21B5,
|
||||
"lArr": 0x21D0,
|
||||
"uArr": 0x21D1,
|
||||
"rArr": 0x21D2,
|
||||
"dArr": 0x21D3,
|
||||
"hArr": 0x21D4,
|
||||
"forall": 0x2200,
|
||||
"part": 0x2202,
|
||||
"exist": 0x2203,
|
||||
"empty": 0x2205,
|
||||
"nabla": 0x2207,
|
||||
"isin": 0x2208,
|
||||
"notin": 0x2209,
|
||||
"ni": 0x220B,
|
||||
"prod": 0x220F,
|
||||
"sum": 0x2211,
|
||||
"minus": 0x2212,
|
||||
"lowast": 0x2217,
|
||||
"radic": 0x221A,
|
||||
"prop": 0x221D,
|
||||
"infin": 0x221E,
|
||||
"ang": 0x2220,
|
||||
"and": 0x2227,
|
||||
"or": 0x2228,
|
||||
"cap": 0x2229,
|
||||
"cup": 0x222A,
|
||||
"int": 0x222B,
|
||||
"there4": 0x2234,
|
||||
"sim": 0x223C,
|
||||
"cong": 0x2245,
|
||||
"asymp": 0x2248,
|
||||
"ne": 0x2260,
|
||||
"equiv": 0x2261,
|
||||
"le": 0x2264,
|
||||
"ge": 0x2265,
|
||||
"sub": 0x2282,
|
||||
"sup": 0x2283,
|
||||
"nsub": 0x2284,
|
||||
"sube": 0x2286,
|
||||
"supe": 0x2287,
|
||||
"oplus": 0x2295,
|
||||
"otimes": 0x2297,
|
||||
"perp": 0x22A5,
|
||||
"sdot": 0x22C5,
|
||||
"lceil": 0x2308,
|
||||
"rceil": 0x2309,
|
||||
"lfloor": 0x230A,
|
||||
"rfloor": 0x230B,
|
||||
"lang": 0x2329,
|
||||
"rang": 0x232A,
|
||||
"loz": 0x25CA,
|
||||
"spades": 0x2660,
|
||||
"clubs": 0x2663,
|
||||
"hearts": 0x2665,
|
||||
"diams": 0x2666
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5831,7 +5831,6 @@ namespace ts {
|
||||
|
||||
if (!name) {
|
||||
parseErrorAtPosition(pos, 0, Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let preName: Identifier, postName: Identifier;
|
||||
|
||||
+436
-89
@@ -8,6 +8,9 @@ namespace ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
|
||||
let emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.6.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
@@ -25,6 +28,201 @@ namespace ts {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function resolveTripleslashReference(moduleName: string, containingFile: string): string {
|
||||
let basePath = getDirectoryPath(containingFile);
|
||||
let referencedFileName = isRootedDiskPath(moduleName) ? moduleName : combinePaths(basePath, moduleName);
|
||||
return normalizePath(referencedFileName);
|
||||
}
|
||||
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
|
||||
let moduleResolution = compilerOptions.moduleResolution !== undefined
|
||||
? compilerOptions.moduleResolution
|
||||
: compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
|
||||
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.NodeJs: return nodeModuleNameResolver(moduleName, containingFile, host);
|
||||
case ModuleResolutionKind.Classic: return classicNameResolver(moduleName, containingFile, compilerOptions, host);
|
||||
}
|
||||
}
|
||||
|
||||
export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule {
|
||||
let containingDirectory = getDirectoryPath(containingFile);
|
||||
|
||||
if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) {
|
||||
let failedLookupLocations: string[] = [];
|
||||
let candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
||||
let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
|
||||
if (resolvedFileName) {
|
||||
return { resolvedFileName, failedLookupLocations };
|
||||
}
|
||||
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
return { resolvedFileName, failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
|
||||
}
|
||||
}
|
||||
|
||||
function loadNodeModuleFromFile(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string {
|
||||
if (loadOnlyDts) {
|
||||
return tryLoad(".d.ts");
|
||||
}
|
||||
else {
|
||||
return forEach(supportedExtensions, tryLoad);
|
||||
}
|
||||
|
||||
function tryLoad(ext: string): string {
|
||||
let fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;
|
||||
if (host.fileExists(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
else {
|
||||
failedLookupLocation.push(fileName);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadNodeModuleFromDirectory(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string {
|
||||
let packageJsonPath = combinePaths(candidate, "package.json");
|
||||
if (host.fileExists(packageJsonPath)) {
|
||||
|
||||
let jsonContent: { typings?: string };
|
||||
|
||||
try {
|
||||
let jsonText = 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) {
|
||||
let result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results
|
||||
failedLookupLocation.push(packageJsonPath);
|
||||
}
|
||||
|
||||
return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host);
|
||||
}
|
||||
|
||||
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModule {
|
||||
let failedLookupLocations: string[] = [];
|
||||
directory = normalizeSlashes(directory);
|
||||
while (true) {
|
||||
let baseName = getBaseFileName(directory);
|
||||
if (baseName !== "node_modules") {
|
||||
let nodeModulesFolder = combinePaths(directory, "node_modules");
|
||||
let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName));
|
||||
let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations };
|
||||
}
|
||||
|
||||
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations };
|
||||
}
|
||||
}
|
||||
|
||||
let parentPath = getDirectoryPath(directory);
|
||||
if (parentPath === directory) {
|
||||
break;
|
||||
}
|
||||
|
||||
directory = parentPath;
|
||||
}
|
||||
|
||||
return { resolvedFileName: undefined, failedLookupLocations };
|
||||
}
|
||||
|
||||
export function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule {
|
||||
Debug.assert(baseUrl !== undefined);
|
||||
|
||||
let normalizedModuleName = normalizeSlashes(moduleName);
|
||||
let basePart = useBaseUrl(moduleName) ? baseUrl : getDirectoryPath(containingFile);
|
||||
let candidate = normalizePath(combinePaths(basePart, moduleName));
|
||||
|
||||
let failedLookupLocations: string[] = [];
|
||||
|
||||
return forEach(supportedExtensions, ext => tryLoadFile(candidate + ext)) || { resolvedFileName: undefined, failedLookupLocations };
|
||||
|
||||
function tryLoadFile(location: string): ResolvedModule {
|
||||
if (host.fileExists(location)) {
|
||||
return { resolvedFileName: location, failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(location);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function nameStartsWithDotSlashOrDotDotSlash(name: string) {
|
||||
let i = name.lastIndexOf("./", 1);
|
||||
return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot);
|
||||
}
|
||||
|
||||
function useBaseUrl(moduleName: string): boolean {
|
||||
// path is not rooted
|
||||
// module name does not start with './' or '../'
|
||||
return getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
|
||||
}
|
||||
|
||||
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
|
||||
|
||||
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
|
||||
let searchPath = getDirectoryPath(containingFile);
|
||||
let searchName: string;
|
||||
|
||||
let failedLookupLocations: string[] = [];
|
||||
|
||||
let referencedSourceFile: string;
|
||||
while (true) {
|
||||
searchName = normalizePath(combinePaths(searchPath, moduleName));
|
||||
referencedSourceFile = forEach(supportedExtensions, extension => {
|
||||
if (extension === ".tsx" && !compilerOptions.jsx) {
|
||||
// resolve .tsx files only if jsx support is enabled
|
||||
// 'logical not' handles both undefined and None cases
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let candidate = searchName + extension;
|
||||
if (host.fileExists(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(candidate);
|
||||
}
|
||||
});
|
||||
|
||||
if (referencedSourceFile) {
|
||||
break;
|
||||
}
|
||||
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations };
|
||||
}
|
||||
|
||||
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
|
||||
let currentDirectory: string;
|
||||
@@ -92,7 +290,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
const newLine = getNewLineCharacter(options);
|
||||
|
||||
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),
|
||||
@@ -100,7 +299,9 @@ namespace ts {
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getCanonicalFileName,
|
||||
getNewLine: () => newLine
|
||||
getNewLine: () => newLine,
|
||||
fileExists: fileName => sys.fileExists(fileName),
|
||||
readFile: fileName => sys.readFile(fileName)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -143,7 +344,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program {
|
||||
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
|
||||
let program: Program;
|
||||
let files: SourceFile[] = [];
|
||||
let diagnostics = createDiagnosticCollection();
|
||||
@@ -158,24 +359,46 @@ namespace ts {
|
||||
let start = new Date().getTime();
|
||||
|
||||
host = host || createCompilerHost(options);
|
||||
|
||||
const resolveModuleNamesWorker =
|
||||
host.resolveModuleNames ||
|
||||
((moduleNames, containingFile) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedFileName));
|
||||
|
||||
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
|
||||
|
||||
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 (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
|
||||
let oldOptions = oldProgram.getCompilerOptions();
|
||||
if ((oldOptions.module !== options.module) ||
|
||||
(oldOptions.noResolve !== options.noResolve) ||
|
||||
(oldOptions.target !== options.target) ||
|
||||
(oldOptions.noLib !== options.noLib) ||
|
||||
(oldOptions.jsx !== options.jsx)) {
|
||||
oldProgram = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tryReuseStructureFromOldProgram()) {
|
||||
forEach(rootNames, name => processRootFile(name, 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), true);
|
||||
}
|
||||
}
|
||||
|
||||
verifyCompilerOptions();
|
||||
|
||||
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
||||
oldProgram = undefined;
|
||||
|
||||
programTime += new Date().getTime() - start;
|
||||
|
||||
program = {
|
||||
getRootFileNames: () => rootNames,
|
||||
getSourceFile: getSourceFile,
|
||||
getSourceFiles: () => files,
|
||||
getCompilerOptions: () => options,
|
||||
@@ -211,6 +434,82 @@ namespace ts {
|
||||
return classifiableNames;
|
||||
}
|
||||
|
||||
function tryReuseStructureFromOldProgram(): boolean {
|
||||
if (!oldProgram) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Debug.assert(!oldProgram.structureIsReused);
|
||||
|
||||
// there is an old program, check if we can reuse its structure
|
||||
let oldRootNames = oldProgram.getRootFileNames();
|
||||
if (!arrayIsEqualTo(oldRootNames, rootNames)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if program source files has changed in the way that can affect structure of the program
|
||||
let newSourceFiles: SourceFile[] = [];
|
||||
for (let oldSourceFile of oldProgram.getSourceFiles()) {
|
||||
let newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
if (!newSourceFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (oldSourceFile !== newSourceFile) {
|
||||
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
||||
// value of no-default-lib has changed
|
||||
// this will affect if default library is injected into the list of files
|
||||
return false;
|
||||
}
|
||||
|
||||
// check tripleslash references
|
||||
if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
||||
// tripleslash references has changed
|
||||
return false;
|
||||
}
|
||||
|
||||
// check imports
|
||||
collectExternalModuleReferences(newSourceFile);
|
||||
if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
||||
// imports has changed
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resolveModuleNamesWorker) {
|
||||
let moduleNames = map(newSourceFile.imports, name => name.text);
|
||||
let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
// ensure that module resolution results are still correct
|
||||
for (let i = 0; i < moduleNames.length; ++i) {
|
||||
let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the cache of module resolutions from the old source file
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
}
|
||||
else {
|
||||
// file has no changes - use it as is
|
||||
newSourceFile = oldSourceFile;
|
||||
}
|
||||
|
||||
// if file has passed all checks it should be safe to reuse it
|
||||
newSourceFiles.push(newSourceFile);
|
||||
}
|
||||
|
||||
// update fileName -> file mapping
|
||||
for (let file of newSourceFiles) {
|
||||
filesByName.set(file.fileName, file);
|
||||
}
|
||||
|
||||
files = newSourceFiles;
|
||||
|
||||
oldProgram.structureIsReused = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost {
|
||||
return {
|
||||
getCanonicalFileName: fileName => host.getCanonicalFileName(fileName),
|
||||
@@ -253,7 +552,7 @@ namespace ts {
|
||||
// This is because in the -out scenario all files need to be emitted, and therefore all
|
||||
// files need to be type checked. And the way to specify that all files need to be type
|
||||
// checked is to not pass the file to getEmitResolver.
|
||||
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out)? undefined : sourceFile);
|
||||
|
||||
let start = new Date().getTime();
|
||||
|
||||
@@ -370,16 +669,66 @@ namespace ts {
|
||||
|
||||
function processRootFile(fileName: string, isDefaultLib: boolean) {
|
||||
processSourceFile(normalizePath(fileName), isDefaultLib);
|
||||
}
|
||||
|
||||
function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean {
|
||||
return a.fileName === b.fileName;
|
||||
}
|
||||
|
||||
function moduleNameIsEqualTo(a: LiteralExpression, b: LiteralExpression): boolean {
|
||||
return a.text === b.text;
|
||||
}
|
||||
|
||||
function collectExternalModuleReferences(file: SourceFile): void {
|
||||
if (file.imports) {
|
||||
return;
|
||||
}
|
||||
|
||||
let imports: LiteralExpression[];
|
||||
for (let node of file.statements) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
let moduleNameExpr = getExternalModuleName(node);
|
||||
if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) {
|
||||
break;
|
||||
}
|
||||
if (!(<LiteralExpression>moduleNameExpr).text) {
|
||||
break;
|
||||
}
|
||||
|
||||
(imports || (imports = [])).push(<LiteralExpression>moduleNameExpr);
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An AmbientExternalModuleDeclaration declares an external module.
|
||||
// This type of declaration is permitted only in the global module.
|
||||
// The StringLiteral must specify a top - level external module name.
|
||||
// Relative external module names are not permitted
|
||||
forEachChild((<ModuleDeclaration>node).body, node => {
|
||||
if (isExternalModuleImportEqualsDeclaration(node) &&
|
||||
getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
|
||||
let moduleName = <LiteralExpression>getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
if (moduleName) {
|
||||
(imports || (imports = [])).push(moduleName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
file.imports = imports || emptyArray;
|
||||
}
|
||||
|
||||
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
|
||||
let start: number;
|
||||
let length: number;
|
||||
let diagnosticArgument: string[];
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
let diagnostic: DiagnosticMessage;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) {
|
||||
@@ -411,8 +760,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument));
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
|
||||
@@ -421,7 +770,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Get source file from normalized fileName
|
||||
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile {
|
||||
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile {
|
||||
let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
if (filesByName.contains(canonicalName)) {
|
||||
// We've already looked for this file, use cached result
|
||||
@@ -436,8 +785,8 @@ namespace ts {
|
||||
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
let file = host.getSourceFile(fileName, options.target, hostErrorMessage => {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refStart, refLength,
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
@@ -450,12 +799,15 @@ namespace ts {
|
||||
|
||||
// Set the source file for normalized absolute path
|
||||
filesByName.set(canonicalAbsolutePath, file);
|
||||
|
||||
|
||||
let basePath = getDirectoryPath(fileName);
|
||||
if (!options.noResolve) {
|
||||
let basePath = getDirectoryPath(fileName);
|
||||
processReferencedFiles(file, basePath);
|
||||
processImportedModules(file, basePath);
|
||||
}
|
||||
|
||||
// always process imported modules to record module name resolutions
|
||||
processImportedModules(file, basePath);
|
||||
|
||||
if (isDefaultLib) {
|
||||
file.isDefaultLib = true;
|
||||
files.unshift(file);
|
||||
@@ -473,8 +825,13 @@ namespace ts {
|
||||
if (file && host.useCaseSensitiveFileNames()) {
|
||||
let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refStart, refLength,
|
||||
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
return file;
|
||||
@@ -483,60 +840,33 @@ namespace ts {
|
||||
|
||||
function processReferencedFiles(file: SourceFile, basePath: string) {
|
||||
forEach(file.referencedFiles, ref => {
|
||||
let referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName);
|
||||
processSourceFile(normalizePath(referencedFileName), /* isDefaultLib */ false, file, ref.pos, ref.end);
|
||||
let referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
|
||||
processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function processImportedModules(file: SourceFile, basePath: string) {
|
||||
forEach(file.statements, node => {
|
||||
if (node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration) {
|
||||
let moduleNameExpr = getExternalModuleName(node);
|
||||
if (moduleNameExpr && moduleNameExpr.kind === SyntaxKind.StringLiteral) {
|
||||
let moduleNameText = (<LiteralExpression>moduleNameExpr).text;
|
||||
if (moduleNameText) {
|
||||
let searchPath = basePath;
|
||||
let searchName: string;
|
||||
while (true) {
|
||||
searchName = normalizePath(combinePaths(searchPath, moduleNameText));
|
||||
if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) {
|
||||
break;
|
||||
}
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
}
|
||||
collectExternalModuleReferences(file);
|
||||
if (file.imports.length) {
|
||||
file.resolvedModules = {};
|
||||
let moduleNames = map(file.imports, name => name.text);
|
||||
let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (let i = 0; i < file.imports.length; ++i) {
|
||||
let resolution = resolutions[i];
|
||||
setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
}
|
||||
}
|
||||
else if (node.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An AmbientExternalModuleDeclaration declares an external module.
|
||||
// This type of declaration is permitted only in the global module.
|
||||
// The StringLiteral must specify a top - level external module name.
|
||||
// Relative external module names are not permitted
|
||||
forEachChild((<ModuleDeclaration>node).body, node => {
|
||||
if (isExternalModuleImportEqualsDeclaration(node) &&
|
||||
getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
|
||||
|
||||
let nameLiteral = <LiteralExpression>getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
let moduleName = nameLiteral.text;
|
||||
if (moduleName) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
let searchName = normalizePath(combinePaths(basePath, moduleName));
|
||||
forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// no imports - drop cached module resolutions
|
||||
file.resolvedModules = undefined;
|
||||
}
|
||||
return;
|
||||
|
||||
function findModuleSourceFile(fileName: string, nameLiteral: Expression) {
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos);
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,27 +933,31 @@ namespace ts {
|
||||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
}
|
||||
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
}
|
||||
|
||||
if (options.out) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
}
|
||||
|
||||
if (options.outFile) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,18 +968,23 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (options.out && options.outFile) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
}
|
||||
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let languageVersion = options.target || ScriptTarget.ES3;
|
||||
let outFile = options.outFile || options.out;
|
||||
|
||||
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (options.isolatedModules) {
|
||||
@@ -675,7 +1014,7 @@ namespace ts {
|
||||
if (options.outDir || // there is --outDir specified
|
||||
options.sourceRoot || // there is --sourceRoot specified
|
||||
(options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated
|
||||
(!options.out || firstExternalModuleSourceFile !== undefined))) {
|
||||
(!outFile || firstExternalModuleSourceFile !== undefined))) {
|
||||
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
// If a rootDir is specified and is valid use it as the commonSourceDirectory
|
||||
@@ -695,18 +1034,26 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (options.noEmit) {
|
||||
if (options.out || options.outDir) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir));
|
||||
if (options.out) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
}
|
||||
|
||||
if (options.outFile) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
}
|
||||
|
||||
if (options.outDir) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
}
|
||||
|
||||
if (options.declaration) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
|
||||
@@ -472,7 +472,7 @@ namespace ts {
|
||||
break;
|
||||
|
||||
case CharacterCodes.hash:
|
||||
if (isShebangTrivia(text, pos)) {
|
||||
if (pos === 0 && isShebangTrivia(text, pos)) {
|
||||
pos = scanShebangTrivia(text, pos);
|
||||
continue;
|
||||
}
|
||||
@@ -672,7 +672,6 @@ namespace ts {
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
// Creates a scanner over a (possibly unspecified) range of a piece of text.
|
||||
export function createScanner(languageVersion: ScriptTarget,
|
||||
skipTrivia: boolean,
|
||||
|
||||
+3
-1
@@ -334,7 +334,9 @@ namespace ts {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return getWScriptSystem();
|
||||
}
|
||||
else if (typeof module !== "undefined" && module.exports) {
|
||||
else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
|
||||
// process and process.nextTick checks if current environment is node-like
|
||||
// process.browser check excludes webpack and browserify
|
||||
return getNodeSystem();
|
||||
}
|
||||
else {
|
||||
|
||||
+53
-4
@@ -9,6 +9,7 @@ namespace ts {
|
||||
contains(fileName: string): boolean;
|
||||
remove(fileName: string): void;
|
||||
forEachValue(f: (v: T) => void): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export interface TextRange {
|
||||
@@ -1243,6 +1244,10 @@ namespace ts {
|
||||
moduleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
languageVariant: LanguageVariant;
|
||||
|
||||
// this map is used by transpiler to supply alternative names for dependencies (i.e. in case of bundling)
|
||||
/* @internal */
|
||||
renamedDependencies?: Map<string>;
|
||||
|
||||
/**
|
||||
* lib.d.ts should have a reference comment like
|
||||
@@ -1275,8 +1280,12 @@ namespace ts {
|
||||
// Stores a line map for the file.
|
||||
// This field should never be used directly to obtain line map, use getLineMap function instead.
|
||||
/* @internal */ lineMap: number[];
|
||||
|
||||
/* @internal */ classifiableNames?: Map<string>;
|
||||
// Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
|
||||
// It is used to resolve module names in the checker.
|
||||
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
|
||||
/* @internal */ resolvedModules: Map<string>;
|
||||
/* @internal */ imports: LiteralExpression[];
|
||||
}
|
||||
|
||||
export interface ScriptReferenceHost {
|
||||
@@ -1285,7 +1294,7 @@ namespace ts {
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
|
||||
export interface ParseConfigHost {
|
||||
export interface ParseConfigHost extends ModuleResolutionHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
|
||||
@@ -1303,6 +1312,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface Program extends ScriptReferenceHost {
|
||||
|
||||
/**
|
||||
* Get a list of root file names that were passed to a 'createProgram'
|
||||
*/
|
||||
getRootFileNames(): string[]
|
||||
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
@@ -1343,6 +1358,9 @@ namespace ts {
|
||||
/* @internal */ getIdentifierCount(): number;
|
||||
/* @internal */ getSymbolCount(): number;
|
||||
/* @internal */ getTypeCount(): number;
|
||||
|
||||
// For testing purposes only.
|
||||
/* @internal */ structureIsReused?: boolean;
|
||||
}
|
||||
|
||||
export interface SourceMapSpan {
|
||||
@@ -1393,6 +1411,7 @@ namespace ts {
|
||||
/* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface TypeCheckerHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
|
||||
@@ -1990,7 +2009,12 @@ namespace ts {
|
||||
Error,
|
||||
Message,
|
||||
}
|
||||
|
||||
|
||||
export const enum ModuleResolutionKind {
|
||||
Classic = 1,
|
||||
NodeJs = 2
|
||||
}
|
||||
|
||||
export interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
@@ -2014,6 +2038,7 @@ namespace ts {
|
||||
noLib?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outFile?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
@@ -2029,6 +2054,7 @@ namespace ts {
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
@@ -2229,9 +2255,23 @@ namespace ts {
|
||||
byteOrderMark = 0xFEFF,
|
||||
tab = 0x09, // \t
|
||||
verticalTab = 0x0B, // \v
|
||||
}
|
||||
|
||||
export interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
// readFile function is used to read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json'
|
||||
// to determine location of bundled typings for node module
|
||||
readFile(fileName: string): string;
|
||||
}
|
||||
|
||||
export interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
|
||||
export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
|
||||
export interface CompilerHost {
|
||||
export interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
@@ -2240,6 +2280,15 @@ namespace ts {
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
|
||||
/*
|
||||
* CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of
|
||||
* module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler
|
||||
* will appply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions).
|
||||
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
|
||||
* 'throw new Error("NotImplemented")'
|
||||
*/
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
|
||||
export interface TextSpan {
|
||||
|
||||
@@ -80,6 +80,41 @@ namespace ts {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
export function arrayIsEqualTo<T>(arr1: T[], arr2: T[], comparer?: (a: T, b: T) => boolean): boolean {
|
||||
if (!arr1 || !arr2) {
|
||||
return arr1 === arr2;
|
||||
}
|
||||
|
||||
if (arr1.length !== arr2.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < arr1.length; ++i) {
|
||||
let equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i];
|
||||
if (!equals) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean {
|
||||
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
|
||||
export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
|
||||
export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
}
|
||||
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
export function containsParseError(node: Node): boolean {
|
||||
aggregateChildData(node);
|
||||
@@ -205,7 +240,7 @@ namespace ts {
|
||||
// Make an identifier from an external module name by extracting the string after the last "/" and replacing
|
||||
// all non-alphanumeric characters with underscores
|
||||
export function makeIdentifierFromModuleName(moduleName: string): string {
|
||||
return getBaseFileName(moduleName).replace(/\W/g, "_");
|
||||
return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
|
||||
}
|
||||
|
||||
export function isBlockOrCatchScoped(declaration: Declaration) {
|
||||
@@ -385,7 +420,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) {
|
||||
let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ?
concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) :
getLeadingCommentRangesOfNode(node, sourceFileOfNode);
|
||||
let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ?
|
||||
concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
|
||||
getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) :
|
||||
getLeadingCommentRangesOfNode(node, sourceFileOfNode);
|
||||
return filter(commentRanges, isJsDocComment);
|
||||
|
||||
function isJsDocComment(comment: CommentRange) {
|
||||
@@ -604,6 +642,20 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function introducesArgumentsExoticObject(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isFunctionBlock(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent);
|
||||
}
|
||||
@@ -927,6 +979,7 @@ namespace ts {
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return node === (<ComputedPropertyName>parent).expression;
|
||||
case SyntaxKind.Decorator:
|
||||
case SyntaxKind.JsxExpression:
|
||||
return true;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return (<ExpressionWithTypeArguments>parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
||||
@@ -1715,7 +1768,7 @@ namespace ts {
|
||||
|
||||
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
|
||||
if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) {
|
||||
// 1. in-browser single file compilation scenario
|
||||
// 2. non .js file
|
||||
return compilerOptions.isolatedModules || !fileExtensionIs(sourceFile.fileName, ".js");
|
||||
|
||||
+40
-18
@@ -123,18 +123,20 @@ module FourSlash {
|
||||
mapRoot: "mapRoot",
|
||||
module: "module",
|
||||
out: "out",
|
||||
outFile: "outFile",
|
||||
outDir: "outDir",
|
||||
sourceMap: "sourceMap",
|
||||
sourceRoot: "sourceRoot",
|
||||
allowNonTsExtensions: "allowNonTsExtensions",
|
||||
resolveReference: "ResolveReference", // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file
|
||||
jsx: "jsx",
|
||||
};
|
||||
|
||||
// List of allowed metadata names
|
||||
let fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference];
|
||||
let globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration,
|
||||
metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,
|
||||
metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot];
|
||||
metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,metadataOptionNames.outFile,
|
||||
metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot, metadataOptionNames.jsx];
|
||||
|
||||
function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions {
|
||||
let settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 };
|
||||
@@ -169,6 +171,9 @@ module FourSlash {
|
||||
case metadataOptionNames.out:
|
||||
settings.out = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.outFile:
|
||||
settings.outFile = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.outDir:
|
||||
settings.outDir = globalOptions[prop];
|
||||
break;
|
||||
@@ -178,6 +183,20 @@ module FourSlash {
|
||||
case metadataOptionNames.sourceRoot:
|
||||
settings.sourceRoot = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.jsx:
|
||||
switch (globalOptions[prop].toLowerCase()) {
|
||||
case "react":
|
||||
settings.jsx = ts.JsxEmit.React;
|
||||
break;
|
||||
case "preserve":
|
||||
settings.jsx = ts.JsxEmit.Preserve;
|
||||
break;
|
||||
default:
|
||||
ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None");
|
||||
settings.jsx = ts.JsxEmit.None;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,7 +304,9 @@ module FourSlash {
|
||||
case FourSlashTestType.Native:
|
||||
return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.Shims:
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ false, cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.ShimsWithPreprocess:
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ true, cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.Server:
|
||||
return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
default:
|
||||
@@ -356,7 +377,7 @@ module FourSlash {
|
||||
this.formatCodeOptions = {
|
||||
IndentSize: 4,
|
||||
TabSize: 4,
|
||||
NewLineCharacter: ts.sys.newLine,
|
||||
NewLineCharacter: Harness.IO.newLine(),
|
||||
ConvertTabsToSpaces: true,
|
||||
InsertSpaceAfterCommaDelimiter: true,
|
||||
InsertSpaceAfterSemicolonInForStatements: true,
|
||||
@@ -364,6 +385,7 @@ module FourSlash {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
};
|
||||
@@ -533,7 +555,7 @@ module FourSlash {
|
||||
errors.forEach(function (error: ts.Diagnostic) {
|
||||
Harness.IO.log(" minChar: " + error.start +
|
||||
", limChar: " + (error.start + error.length) +
|
||||
", message: " + ts.flattenDiagnosticMessageText(error.messageText, ts.sys.newLine) + "\n");
|
||||
", message: " + ts.flattenDiagnosticMessageText(error.messageText, Harness.IO.newLine()) + "\n");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1244,21 +1266,21 @@ module FourSlash {
|
||||
emitFiles.forEach(emitFile => {
|
||||
let emitOutput = this.languageService.getEmitOutput(emitFile.fileName);
|
||||
// Print emitOutputStatus in readable format
|
||||
resultString += "EmitSkipped: " + emitOutput.emitSkipped + ts.sys.newLine;
|
||||
resultString += "EmitSkipped: " + emitOutput.emitSkipped + Harness.IO.newLine();
|
||||
|
||||
if (emitOutput.emitSkipped) {
|
||||
resultString += "Diagnostics:" + ts.sys.newLine;
|
||||
resultString += "Diagnostics:" + Harness.IO.newLine();
|
||||
let diagnostics = ts.getPreEmitDiagnostics(this.languageService.getProgram());
|
||||
for (let i = 0, n = diagnostics.length; i < n; i++) {
|
||||
resultString += " " + diagnostics[0].messageText + ts.sys.newLine;
|
||||
resultString += " " + diagnostics[0].messageText + Harness.IO.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
emitOutput.outputFiles.forEach((outputFile, idx, array) => {
|
||||
let fileName = "FileName : " + outputFile.name + ts.sys.newLine;
|
||||
let fileName = "FileName : " + outputFile.name + Harness.IO.newLine();
|
||||
resultString = resultString + fileName + outputFile.text;
|
||||
});
|
||||
resultString += ts.sys.newLine;
|
||||
resultString += Harness.IO.newLine();
|
||||
});
|
||||
|
||||
return resultString;
|
||||
@@ -1295,7 +1317,7 @@ module FourSlash {
|
||||
Harness.IO.log(
|
||||
"start: " + err.start +
|
||||
", length: " + err.length +
|
||||
", message: " + ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine));
|
||||
", message: " + ts.flattenDiagnosticMessageText(err.messageText, Harness.IO.newLine()));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1869,9 +1891,9 @@ module FourSlash {
|
||||
}
|
||||
|
||||
function jsonMismatchString() {
|
||||
return ts.sys.newLine +
|
||||
"expected: '" + ts.sys.newLine + JSON.stringify(expected, (k, v) => v, 2) + "'" + ts.sys.newLine +
|
||||
"actual: '" + ts.sys.newLine + JSON.stringify(actual, (k, v) => v, 2) + "'";
|
||||
return Harness.IO.newLine() +
|
||||
"expected: '" + Harness.IO.newLine() + JSON.stringify(expected, (k, v) => v, 2) + "'" + Harness.IO.newLine() +
|
||||
"actual: '" + Harness.IO.newLine() + JSON.stringify(actual, (k, v) => v, 2) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2380,7 +2402,7 @@ module FourSlash {
|
||||
let host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined }],
|
||||
(fn, contents) => fourslashJsOutput = contents,
|
||||
ts.ScriptTarget.Latest,
|
||||
ts.sys.useCaseSensitiveFileNames);
|
||||
Harness.IO.useCaseSensitiveFileNames());
|
||||
|
||||
let program = ts.createProgram([Harness.Compiler.fourslashFileName], { noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
|
||||
@@ -2402,16 +2424,16 @@ module FourSlash {
|
||||
],
|
||||
(fn, contents) => result = contents,
|
||||
ts.ScriptTarget.Latest,
|
||||
ts.sys.useCaseSensitiveFileNames);
|
||||
Harness.IO.useCaseSensitiveFileNames());
|
||||
|
||||
let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { outFile: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
|
||||
let sourceFile = host.getSourceFile(fileName, ts.ScriptTarget.ES3);
|
||||
|
||||
let diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);
|
||||
if (diagnostics.length > 0) {
|
||||
throw new Error(`Error compiling ${fileName}: ` +
|
||||
diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, ts.sys.newLine)).join("\r\n"));
|
||||
diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, Harness.IO.newLine())).join("\r\n"));
|
||||
}
|
||||
|
||||
program.emit(sourceFile);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
const enum FourSlashTestType {
|
||||
Native,
|
||||
Shims,
|
||||
ShimsWithPreprocess,
|
||||
Server
|
||||
}
|
||||
|
||||
@@ -23,6 +24,10 @@ class FourSlashRunner extends RunnerBase {
|
||||
this.basePath = "tests/cases/fourslash/shims";
|
||||
this.testSuiteName = "fourslash-shims";
|
||||
break;
|
||||
case FourSlashTestType.ShimsWithPreprocess:
|
||||
this.basePath = 'tests/cases/fourslash/shims-pp';
|
||||
this.testSuiteName = 'fourslash-shims-pp';
|
||||
break;
|
||||
case FourSlashTestType.Server:
|
||||
this.basePath = "tests/cases/fourslash/server";
|
||||
this.testSuiteName = "fourslash-server";
|
||||
|
||||
+106
-57
@@ -26,7 +26,6 @@
|
||||
|
||||
// Block scoped definitions work poorly for global variables, temporarily enable var
|
||||
/* tslint:disable:no-var-keyword */
|
||||
var Buffer: BufferConstructor = require("buffer").Buffer;
|
||||
|
||||
// this will work in the browser via browserify
|
||||
var _chai: typeof chai = require("chai");
|
||||
@@ -55,9 +54,17 @@ module Utils {
|
||||
return ExecutionEnvironment.Node;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export let currentExecutionEnvironment = getExecutionEnvironment();
|
||||
|
||||
const Buffer: BufferConstructor = currentExecutionEnvironment !== ExecutionEnvironment.Browser
|
||||
? require("buffer").Buffer
|
||||
: undefined;
|
||||
|
||||
export function encodeString(s: string): string {
|
||||
return Buffer ? (new Buffer(s)).toString("utf8") : s;
|
||||
}
|
||||
|
||||
export function evalFile(fileContents: string, fileName: string, nodeContext?: any) {
|
||||
let environment = getExecutionEnvironment();
|
||||
switch (environment) {
|
||||
@@ -102,7 +109,7 @@ module Utils {
|
||||
|
||||
let content: string = undefined;
|
||||
try {
|
||||
content = ts.sys.readFile(Harness.userSpecifiedRoot + path);
|
||||
content = Harness.IO.readFile(Harness.userSpecifiedRoot + path);
|
||||
}
|
||||
catch (err) {
|
||||
return undefined;
|
||||
@@ -190,7 +197,7 @@ module Utils {
|
||||
return {
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine),
|
||||
messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, Harness.IO.newLine()),
|
||||
category: (<any>ts).DiagnosticCategory[diagnostic.category],
|
||||
code: diagnostic.code
|
||||
};
|
||||
@@ -323,8 +330,8 @@ module Utils {
|
||||
assert.equal(d1.start, d2.start, "d1.start !== d2.start");
|
||||
assert.equal(d1.length, d2.length, "d1.length !== d2.length");
|
||||
assert.equal(
|
||||
ts.flattenDiagnosticMessageText(d1.messageText, ts.sys.newLine),
|
||||
ts.flattenDiagnosticMessageText(d2.messageText, ts.sys.newLine), "d1.messageText !== d2.messageText");
|
||||
ts.flattenDiagnosticMessageText(d1.messageText, Harness.IO.newLine()),
|
||||
ts.flattenDiagnosticMessageText(d2.messageText, Harness.IO.newLine()), "d1.messageText !== d2.messageText");
|
||||
assert.equal(d1.category, d2.category, "d1.category !== d2.category");
|
||||
assert.equal(d1.code, d2.code, "d1.code !== d2.code");
|
||||
}
|
||||
@@ -404,6 +411,10 @@ module Harness.Path {
|
||||
|
||||
module Harness {
|
||||
export interface IO {
|
||||
newLine(): string;
|
||||
getCurrentDirectory(): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
resolvePath(path: string): string;
|
||||
readFile(path: string): string;
|
||||
writeFile(path: string, contents: string): void;
|
||||
directoryName(path: string): string;
|
||||
@@ -416,7 +427,10 @@ module Harness {
|
||||
getMemoryUsage?(): number;
|
||||
}
|
||||
export var IO: IO;
|
||||
|
||||
|
||||
// harness always uses one kind of new line
|
||||
const harnessNewLine = "\r\n";
|
||||
|
||||
module IOImpl {
|
||||
declare class Enumerator {
|
||||
public atEnd(): boolean;
|
||||
@@ -433,12 +447,17 @@ module Harness {
|
||||
fso = {};
|
||||
}
|
||||
|
||||
export let readFile: typeof IO.readFile = ts.sys.readFile;
|
||||
export let writeFile: typeof IO.writeFile = ts.sys.writeFile;
|
||||
export let directoryName: typeof IO.directoryName = fso.GetParentFolderName;
|
||||
export let directoryExists: typeof IO.directoryExists = fso.FolderExists;
|
||||
export let fileExists: typeof IO.fileExists = fso.FileExists;
|
||||
export let log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine;
|
||||
export const resolvePath = (path: string) => ts.sys.resolvePath(path);
|
||||
export const getCurrentDirectory = () => ts.sys.getCurrentDirectory();
|
||||
export const newLine = () => harnessNewLine;
|
||||
export const useCaseSensitiveFileNames = () => ts.sys.useCaseSensitiveFileNames;
|
||||
|
||||
export const readFile: typeof IO.readFile = path => ts.sys.readFile(path);
|
||||
export const writeFile: typeof IO.writeFile = (path, content) => ts.sys.writeFile(path, content);
|
||||
export const directoryName: typeof IO.directoryName = fso.GetParentFolderName;
|
||||
export const directoryExists: typeof IO.directoryExists = fso.FolderExists;
|
||||
export const fileExists: typeof IO.fileExists = fso.FileExists;
|
||||
export const log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine;
|
||||
|
||||
export function createDirectory(path: string) {
|
||||
if (directoryExists(path)) {
|
||||
@@ -493,11 +512,16 @@ module Harness {
|
||||
} else {
|
||||
fs = pathModule = {};
|
||||
}
|
||||
|
||||
export const resolvePath = (path: string) => ts.sys.resolvePath(path);
|
||||
export const getCurrentDirectory = () => ts.sys.getCurrentDirectory();
|
||||
export const newLine = () => harnessNewLine;
|
||||
export const useCaseSensitiveFileNames = () => ts.sys.useCaseSensitiveFileNames;
|
||||
|
||||
export let readFile: typeof IO.readFile = ts.sys.readFile;
|
||||
export let writeFile: typeof IO.writeFile = ts.sys.writeFile;
|
||||
export let fileExists: typeof IO.fileExists = fs.existsSync;
|
||||
export let log: typeof IO.log = s => console.log(s);
|
||||
export const readFile: typeof IO.readFile = path => ts.sys.readFile(path);
|
||||
export const writeFile: typeof IO.writeFile = (path, content) => ts.sys.writeFile(path, content);
|
||||
export const fileExists: typeof IO.fileExists = fs.existsSync;
|
||||
export const log: typeof IO.log = s => console.log(s);
|
||||
|
||||
export function createDirectory(path: string) {
|
||||
if (!directoryExists(path)) {
|
||||
@@ -562,9 +586,9 @@ module Harness {
|
||||
export module Network {
|
||||
let serverRoot = "http://localhost:8888/";
|
||||
|
||||
// Unused?
|
||||
let newLine = "\r\n";
|
||||
let currentDirectory = () => "";
|
||||
export const newLine = () => harnessNewLine;
|
||||
export const useCaseSensitiveFileNames = () => false;
|
||||
export const getCurrentDirectory = () => "";
|
||||
let supportsCodePage = () => false;
|
||||
|
||||
module Http {
|
||||
@@ -616,6 +640,7 @@ module Harness {
|
||||
xhr.send(contents);
|
||||
}
|
||||
catch (e) {
|
||||
log(`XHR Error: ${e}`);
|
||||
return { status: 500, responseText: null };
|
||||
}
|
||||
|
||||
@@ -655,6 +680,7 @@ module Harness {
|
||||
return dirPath;
|
||||
}
|
||||
export let directoryName: typeof IO.directoryName = Utils.memoize(directoryNameImpl);
|
||||
export const resolvePath = (path: string) => directoryName(path);
|
||||
|
||||
export function fileExists(path: string): boolean {
|
||||
let response = Http.getFileFromServerSync(serverRoot + path);
|
||||
@@ -840,7 +866,7 @@ module Harness {
|
||||
export let fourslashSourceFile: ts.SourceFile;
|
||||
|
||||
export function getCanonicalFileName(fileName: string): string {
|
||||
return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
return Harness.IO.useCaseSensitiveFileNames() ? fileName : fileName.toLowerCase();
|
||||
}
|
||||
|
||||
export function createCompilerHost(
|
||||
@@ -858,7 +884,7 @@ module Harness {
|
||||
}
|
||||
|
||||
let filemap: { [fileName: string]: ts.SourceFile; } = {};
|
||||
let getCurrentDirectory = currentDirectory === undefined ? ts.sys.getCurrentDirectory : () => currentDirectory;
|
||||
let getCurrentDirectory = currentDirectory === undefined ? Harness.IO.getCurrentDirectory : () => currentDirectory;
|
||||
|
||||
// Register input files
|
||||
function register(file: { unitName: string; content: string; }) {
|
||||
@@ -868,41 +894,45 @@ module Harness {
|
||||
}
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
|
||||
function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) {
|
||||
fn = ts.normalizePath(fn);
|
||||
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
|
||||
return filemap[getCanonicalFileName(fn)];
|
||||
}
|
||||
else if (currentDirectory) {
|
||||
let canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory));
|
||||
return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined;
|
||||
}
|
||||
else if (fn === fourslashFileName) {
|
||||
let 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;
|
||||
}
|
||||
}
|
||||
|
||||
let newLine =
|
||||
newLineKind === ts.NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed :
|
||||
newLineKind === ts.NewLineKind.LineFeed ? lineFeed :
|
||||
ts.sys.newLine;
|
||||
Harness.IO.newLine();
|
||||
|
||||
return {
|
||||
getCurrentDirectory,
|
||||
getSourceFile: (fn, languageVersion) => {
|
||||
fn = ts.normalizePath(fn);
|
||||
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
|
||||
return filemap[getCanonicalFileName(fn)];
|
||||
}
|
||||
else if (currentDirectory) {
|
||||
let canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory));
|
||||
return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined;
|
||||
}
|
||||
else if (fn === fourslashFileName) {
|
||||
let 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;
|
||||
}
|
||||
},
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => defaultLibFileName,
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => newLine
|
||||
getNewLine: () => newLine,
|
||||
fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined,
|
||||
readFile: (fileName: string): string => { throw new Error("NotYetImplemented"); }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -984,7 +1014,7 @@ module Harness {
|
||||
// Treat them as library files, so include them in build, but not in baselines.
|
||||
let includeBuiltFiles: { unitName: string; content: string }[] = [];
|
||||
|
||||
let useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||
let useCaseSensitiveFileNames = Harness.IO.useCaseSensitiveFileNames();
|
||||
this.settings.forEach(setCompilerOptionForSetting);
|
||||
|
||||
let fileOutputs: GeneratedFile[] = [];
|
||||
@@ -1002,11 +1032,9 @@ module Harness {
|
||||
let errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
this.lastErrors = errors;
|
||||
|
||||
let result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps);
|
||||
let result = new CompilerResult(fileOutputs, errors, program, Harness.IO.getCurrentDirectory(), emitResult.sourceMaps);
|
||||
onComplete(result, program);
|
||||
|
||||
// reset what newline means in case the last test changed it
|
||||
ts.sys.newLine = newLine;
|
||||
return options;
|
||||
|
||||
function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) {
|
||||
@@ -1021,6 +1049,13 @@ module Harness {
|
||||
options.module = ts.ModuleKind.UMD;
|
||||
} else if (setting.value.toLowerCase() === "commonjs") {
|
||||
options.module = ts.ModuleKind.CommonJS;
|
||||
if (options.moduleResolution === undefined) {
|
||||
// TODO: currently we have relative module names pretty much in all tests that use CommonJS module target.
|
||||
// Such names could never be resolved in Node however classic resolution strategy still can handle them.
|
||||
// Changing all module names to relative will be a major overhaul in code (but we'll do this anyway) so as a temporary measure
|
||||
// we'll use ts.ModuleResolutionKind.Classic for CommonJS modules.
|
||||
options.moduleResolution = ts.ModuleResolutionKind.Classic;
|
||||
}
|
||||
} else if (setting.value.toLowerCase() === "system") {
|
||||
options.module = ts.ModuleKind.System;
|
||||
} else if (setting.value.toLowerCase() === "unspecified") {
|
||||
@@ -1032,7 +1067,16 @@ module Harness {
|
||||
options.module = <any>setting.value;
|
||||
}
|
||||
break;
|
||||
|
||||
case "moduleresolution":
|
||||
switch((setting.value || "").toLowerCase()) {
|
||||
case "classic":
|
||||
options.moduleResolution = ts.ModuleResolutionKind.Classic;
|
||||
break;
|
||||
case "node":
|
||||
options.moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "target":
|
||||
case "codegentarget":
|
||||
if (typeof setting.value === "string") {
|
||||
@@ -1087,6 +1131,10 @@ module Harness {
|
||||
options.out = setting.value;
|
||||
break;
|
||||
|
||||
case "outfile":
|
||||
options.outFile = setting.value;
|
||||
break;
|
||||
|
||||
case "outdiroption":
|
||||
case "outdir":
|
||||
options.outDir = setting.value;
|
||||
@@ -1225,7 +1273,8 @@ module Harness {
|
||||
assert(sourceFile, "Program has no source file with name '" + fileName + "'");
|
||||
// Is this file going to be emitted separately
|
||||
let sourceFileName: string;
|
||||
if (ts.isExternalModule(sourceFile) || !options.out) {
|
||||
let outFile = options.outFile || options.out;
|
||||
if (ts.isExternalModule(sourceFile) || !outFile) {
|
||||
if (options.outDir) {
|
||||
let sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, result.currentDirectoryForProgram);
|
||||
sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), "");
|
||||
@@ -1237,7 +1286,7 @@ module Harness {
|
||||
}
|
||||
else {
|
||||
// Goes to single --out file
|
||||
sourceFileName = options.out;
|
||||
sourceFileName = outFile;
|
||||
}
|
||||
|
||||
let dTsFileName = ts.removeFileExtension(sourceFileName) + ".d.ts";
|
||||
@@ -1269,7 +1318,7 @@ module Harness {
|
||||
errorOutput += diagnostic.file.fileName + "(" + (lineAndCharacter.line + 1) + "," + (lineAndCharacter.character + 1) + "): ";
|
||||
}
|
||||
|
||||
errorOutput += ts.DiagnosticCategory[diagnostic.category].toLowerCase() + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine;
|
||||
errorOutput += ts.DiagnosticCategory[diagnostic.category].toLowerCase() + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, Harness.IO.newLine()) + Harness.IO.newLine();
|
||||
});
|
||||
|
||||
return errorOutput;
|
||||
@@ -1282,7 +1331,7 @@ module Harness {
|
||||
let totalErrorsReported = 0;
|
||||
|
||||
function outputErrorText(error: ts.Diagnostic) {
|
||||
let message = ts.flattenDiagnosticMessageText(error.messageText, ts.sys.newLine);
|
||||
let message = ts.flattenDiagnosticMessageText(error.messageText, Harness.IO.newLine());
|
||||
|
||||
let errLines = RunnerBase.removeFullPaths(message)
|
||||
.split("\n")
|
||||
@@ -1379,7 +1428,7 @@ module Harness {
|
||||
assert.equal(totalErrorsReported + numLibraryDiagnostics + numTest262HarnessDiagnostics, diagnostics.length, "total number of errors");
|
||||
|
||||
return minimalDiagnosticsToString(diagnostics) +
|
||||
ts.sys.newLine + ts.sys.newLine + outputLines.join("\r\n");
|
||||
Harness.IO.newLine() + Harness.IO.newLine() + outputLines.join("\r\n");
|
||||
}
|
||||
|
||||
export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[]): string {
|
||||
@@ -1715,7 +1764,7 @@ module Harness {
|
||||
}
|
||||
|
||||
function writeComparison(expected: string, actual: string, relativeFileName: string, actualFileName: string, descriptionForDescribe: string) {
|
||||
let encoded_actual = (new Buffer(actual)).toString("utf8");
|
||||
let encoded_actual = Utils.encodeString(actual);
|
||||
if (expected != encoded_actual) {
|
||||
// Overwrite & issue error
|
||||
let errMsg = "The baseline file " + relativeFileName + " has changed";
|
||||
|
||||
@@ -203,9 +203,35 @@ module Harness.LanguageService {
|
||||
/// Shim adapter
|
||||
class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost {
|
||||
private nativeHost: NativeLanguageServiceHost;
|
||||
constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
|
||||
public getModuleResolutionsForFile: (fileName: string)=> string;
|
||||
|
||||
constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
super(cancellationToken, options);
|
||||
this.nativeHost = new NativeLanguageServiceHost(cancellationToken, options);
|
||||
|
||||
if (preprocessToResolve) {
|
||||
let compilerOptions = this.nativeHost.getCompilationSettings()
|
||||
let moduleResolutionHost: ts.ModuleResolutionHost = {
|
||||
fileExists: fileName => this.getScriptInfo(fileName) !== undefined,
|
||||
readFile: fileName => {
|
||||
let scriptInfo = this.getScriptInfo(fileName);
|
||||
return scriptInfo && scriptInfo.content;
|
||||
}
|
||||
};
|
||||
this.getModuleResolutionsForFile = (fileName) => {
|
||||
let scriptInfo = this.getScriptInfo(fileName);
|
||||
let preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ true);
|
||||
let imports: ts.Map<string> = {};
|
||||
for (let module of preprocessInfo.importedFiles) {
|
||||
let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost);
|
||||
if (resolutionInfo.resolvedFileName) {
|
||||
imports[module.fileName] = resolutionInfo.resolvedFileName;
|
||||
}
|
||||
}
|
||||
return JSON.stringify(imports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getFilenames(): string[] { return this.nativeHost.getFilenames(); }
|
||||
@@ -229,7 +255,11 @@ module Harness.LanguageService {
|
||||
readDirectory(rootDir: string, extension: string): string {
|
||||
throw new Error("NYI");
|
||||
}
|
||||
|
||||
fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
|
||||
readFile(fileName: string) {
|
||||
let snapshot = this.nativeHost.getScriptSnapshot(fileName);
|
||||
return snapshot && snapshot.getText(0, snapshot.getLength());
|
||||
}
|
||||
log(s: string): void { this.nativeHost.log(s); }
|
||||
trace(s: string): void { this.nativeHost.trace(s); }
|
||||
error(s: string): void { this.nativeHost.error(s); }
|
||||
@@ -399,8 +429,8 @@ module Harness.LanguageService {
|
||||
export class ShimLanugageServiceAdapter implements LanguageServiceAdapter {
|
||||
private host: ShimLanguageServiceHost;
|
||||
private factory: ts.TypeScriptServicesFactory;
|
||||
constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
this.host = new ShimLanguageServiceHost(cancellationToken, options);
|
||||
constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
this.host = new ShimLanguageServiceHost(preprocessToResolve, cancellationToken, options);
|
||||
this.factory = new TypeScript.Services.TypeScriptServicesFactory();
|
||||
}
|
||||
getHost() { return this.host; }
|
||||
@@ -419,6 +449,7 @@ module Harness.LanguageService {
|
||||
let convertResult: ts.PreProcessedFileInfo = {
|
||||
referencedFiles: [],
|
||||
importedFiles: [],
|
||||
ambientExternalModules: [],
|
||||
isLibFile: shimResult.isLibFile
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class ProjectRunner extends RunnerBase {
|
||||
|
||||
let testFileText: string = null;
|
||||
try {
|
||||
testFileText = ts.sys.readFile(testCaseFileName);
|
||||
testFileText = Harness.IO.readFile(testCaseFileName);
|
||||
}
|
||||
catch (e) {
|
||||
assert(false, "Unable to open testcase file: " + testCaseFileName + ": " + e.message);
|
||||
@@ -98,7 +98,7 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
function cleanProjectUrl(url: string) {
|
||||
let diskProjectPath = ts.normalizeSlashes(ts.sys.resolvePath(testCase.projectRoot));
|
||||
let diskProjectPath = ts.normalizeSlashes(Harness.IO.resolvePath(testCase.projectRoot));
|
||||
let projectRootUrl = "file:///" + diskProjectPath;
|
||||
let normalizedProjectRoot = ts.normalizeSlashes(testCase.projectRoot);
|
||||
diskProjectPath = diskProjectPath.substr(0, diskProjectPath.lastIndexOf(normalizedProjectRoot));
|
||||
@@ -122,7 +122,7 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
function getCurrentDirectory() {
|
||||
return ts.sys.resolvePath(testCase.projectRoot);
|
||||
return Harness.IO.resolvePath(testCase.projectRoot);
|
||||
}
|
||||
|
||||
function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: () => string[],
|
||||
@@ -158,11 +158,12 @@ class ProjectRunner extends RunnerBase {
|
||||
return {
|
||||
declaration: !!testCase.declaration,
|
||||
sourceMap: !!testCase.sourceMap,
|
||||
out: testCase.out,
|
||||
outFile: testCase.out,
|
||||
outDir: testCase.outDir,
|
||||
mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? ts.sys.resolvePath(testCase.mapRoot) : testCase.mapRoot,
|
||||
sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? ts.sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot,
|
||||
mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? Harness.IO.resolvePath(testCase.mapRoot) : testCase.mapRoot,
|
||||
sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? Harness.IO.resolvePath(testCase.sourceRoot) : testCase.sourceRoot,
|
||||
module: moduleKind,
|
||||
moduleResolution: ts.ModuleResolutionKind.Classic, // currently all tests use classic module resolution kind, this will change in the future
|
||||
noResolve: testCase.noResolve,
|
||||
rootDir: testCase.rootDir
|
||||
};
|
||||
@@ -190,8 +191,10 @@ class ProjectRunner extends RunnerBase {
|
||||
writeFile,
|
||||
getCurrentDirectory,
|
||||
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
useCaseSensitiveFileNames: () => Harness.IO.useCaseSensitiveFileNames(),
|
||||
getNewLine: () => Harness.IO.newLine(),
|
||||
fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined,
|
||||
readFile: fileName => Harness.IO.readFile(fileName)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -214,7 +217,7 @@ class ProjectRunner extends RunnerBase {
|
||||
function getSourceFileText(fileName: string): string {
|
||||
let text: string = undefined;
|
||||
try {
|
||||
text = ts.sys.readFile(ts.isRootedDiskPath(fileName)
|
||||
text = Harness.IO.readFile(ts.isRootedDiskPath(fileName)
|
||||
? fileName
|
||||
: ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName));
|
||||
}
|
||||
@@ -261,14 +264,14 @@ class ProjectRunner extends RunnerBase {
|
||||
// Actual writing of file as in tc.ts
|
||||
function ensureDirectoryStructure(directoryname: string) {
|
||||
if (directoryname) {
|
||||
if (!ts.sys.directoryExists(directoryname)) {
|
||||
if (!Harness.IO.directoryExists(directoryname)) {
|
||||
ensureDirectoryStructure(ts.getDirectoryPath(directoryname));
|
||||
ts.sys.createDirectory(directoryname);
|
||||
Harness.IO.createDirectory(directoryname);
|
||||
}
|
||||
}
|
||||
}
|
||||
ensureDirectoryStructure(ts.getDirectoryPath(ts.normalizePath(outputFilePath)));
|
||||
ts.sys.writeFile(outputFilePath, data, writeByteOrderMark);
|
||||
Harness.IO.writeFile(outputFilePath, data);
|
||||
|
||||
outputFiles.push({ emittedFileName: fileName, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark });
|
||||
}
|
||||
@@ -297,7 +300,7 @@ class ProjectRunner extends RunnerBase {
|
||||
allInputFiles.unshift(findOutpuDtsFile(outputDtsFileName));
|
||||
}
|
||||
else {
|
||||
let outputDtsFileName = ts.removeFileExtension(compilerOptions.out) + ".d.ts";
|
||||
let outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile|| compilerOptions.out) + ".d.ts";
|
||||
let outputDtsFile = findOutpuDtsFile(outputDtsFileName);
|
||||
if (!ts.contains(allInputFiles, outputDtsFile)) {
|
||||
allInputFiles.unshift(outputDtsFile);
|
||||
@@ -389,7 +392,7 @@ class ProjectRunner extends RunnerBase {
|
||||
|
||||
Harness.Baseline.runBaseline("Baseline of emitted result (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
|
||||
try {
|
||||
return ts.sys.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
return Harness.IO.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
|
||||
@@ -68,7 +68,10 @@ if (testConfigFile !== "") {
|
||||
case "fourslash-shims":
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
break;
|
||||
case "fourslash-server":
|
||||
case 'fourslash-shims-pp':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess));
|
||||
break;
|
||||
case 'fourslash-server':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
break;
|
||||
case "fourslash-generated":
|
||||
@@ -98,10 +101,9 @@ if (runners.length === 0) {
|
||||
// language services
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Native));
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess));
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
// runners.push(new GeneratedFourslashRunner());
|
||||
}
|
||||
|
||||
ts.sys.newLine = "\r\n";
|
||||
|
||||
runTests(runners);
|
||||
|
||||
Vendored
+2650
-9
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -8,4 +8,4 @@ interface NodeList {
|
||||
|
||||
interface NodeListOf<TNode extends Node> {
|
||||
[Symbol.iterator](): IterableIterator<TNode>
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+20
-11
@@ -2459,7 +2459,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @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 | Window;
|
||||
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.
|
||||
@@ -2916,6 +2916,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitMatchesSelector(selectors: string): boolean;
|
||||
webkitRequestFullScreen(): void;
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
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;
|
||||
@@ -3030,7 +3031,7 @@ interface File extends Blob {
|
||||
|
||||
declare var File: {
|
||||
prototype: File;
|
||||
new(): File;
|
||||
new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
@@ -3903,7 +3904,6 @@ interface HTMLElement extends Element {
|
||||
contains(child: HTMLElement): boolean;
|
||||
dragDrop(): boolean;
|
||||
focus(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
@@ -6865,7 +6865,7 @@ interface IDBDatabase extends EventTarget {
|
||||
createObjectStore(name: string, optionalParameters?: any): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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;
|
||||
}
|
||||
@@ -6986,7 +6986,7 @@ interface IDBTransaction extends EventTarget {
|
||||
READ_ONLY: string;
|
||||
READ_WRITE: string;
|
||||
VERSION_CHANGE: string;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
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;
|
||||
@@ -7016,11 +7016,14 @@ interface ImageData {
|
||||
width: number;
|
||||
}
|
||||
|
||||
declare var ImageData: {
|
||||
interface ImageDataConstructor {
|
||||
prototype: ImageData;
|
||||
new(): ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
}
|
||||
|
||||
declare var ImageData: ImageDataConstructor;
|
||||
|
||||
interface KeyboardEvent extends UIEvent {
|
||||
altKey: boolean;
|
||||
char: string;
|
||||
@@ -12169,7 +12172,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
LOADING: number;
|
||||
OPENED: number;
|
||||
UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12439,7 +12442,7 @@ interface MSBaseReader {
|
||||
DONE: number;
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12595,7 +12598,7 @@ interface XMLHttpRequestEventTarget {
|
||||
onloadstart: (ev: Event) => any;
|
||||
onprogress: (ev: ProgressEvent) => any;
|
||||
ontimeout: (ev: ProgressEvent) => any;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12612,11 +12615,17 @@ interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
[index: number]: TNode;
|
||||
}
|
||||
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface FilePropertyBag {
|
||||
type?: string;
|
||||
lastModified?: number;
|
||||
}
|
||||
|
||||
interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
@@ -12952,4 +12961,4 @@ 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;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
Vendored
+146
-2535
File diff suppressed because it is too large
Load Diff
Vendored
-2305
File diff suppressed because it is too large
Load Diff
Vendored
+124
-18
@@ -3,10 +3,28 @@
|
||||
/// IE Worker APIs
|
||||
/////////////////////////////
|
||||
|
||||
interface EventInit {
|
||||
bubbles?: boolean;
|
||||
cancelable?: boolean;
|
||||
}
|
||||
|
||||
interface EventListener {
|
||||
(evt: Event): void;
|
||||
}
|
||||
|
||||
interface AudioBuffer {
|
||||
duration: number;
|
||||
length: number;
|
||||
numberOfChannels: number;
|
||||
sampleRate: number;
|
||||
getChannelData(channel: number): any;
|
||||
}
|
||||
|
||||
declare var AudioBuffer: {
|
||||
prototype: AudioBuffer;
|
||||
new(): AudioBuffer;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
size: number;
|
||||
type: string;
|
||||
@@ -60,6 +78,21 @@ declare var Console: {
|
||||
new(): Console;
|
||||
}
|
||||
|
||||
interface Coordinates {
|
||||
accuracy: number;
|
||||
altitude: number;
|
||||
altitudeAccuracy: number;
|
||||
heading: number;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
speed: number;
|
||||
}
|
||||
|
||||
declare var Coordinates: {
|
||||
prototype: Coordinates;
|
||||
new(): Coordinates;
|
||||
}
|
||||
|
||||
interface DOMError {
|
||||
name: string;
|
||||
toString(): string;
|
||||
@@ -210,7 +243,7 @@ interface File extends Blob {
|
||||
|
||||
declare var File: {
|
||||
prototype: File;
|
||||
new(): File;
|
||||
new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
@@ -281,7 +314,7 @@ interface IDBDatabase extends EventTarget {
|
||||
createObjectStore(name: string, optionalParameters?: any): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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;
|
||||
}
|
||||
@@ -402,7 +435,7 @@ interface IDBTransaction extends EventTarget {
|
||||
READ_ONLY: string;
|
||||
READ_WRITE: string;
|
||||
VERSION_CHANGE: string;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
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;
|
||||
@@ -432,11 +465,14 @@ interface ImageData {
|
||||
width: number;
|
||||
}
|
||||
|
||||
declare var ImageData: {
|
||||
interface ImageDataConstructor {
|
||||
prototype: ImageData;
|
||||
new(): ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
}
|
||||
|
||||
declare var ImageData: ImageDataConstructor;
|
||||
|
||||
interface MSApp {
|
||||
clearTemporaryWebDataAsync(): MSAppAsyncOperation;
|
||||
createBlobFromRandomAccessStream(type: string, seeker: any): Blob;
|
||||
@@ -460,6 +496,29 @@ interface MSApp {
|
||||
}
|
||||
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;
|
||||
@@ -496,6 +555,18 @@ declare var MSStreamReader: {
|
||||
new(): MSStreamReader;
|
||||
}
|
||||
|
||||
interface MediaQueryList {
|
||||
matches: boolean;
|
||||
media: string;
|
||||
addListener(listener: MediaQueryListListener): void;
|
||||
removeListener(listener: MediaQueryListListener): void;
|
||||
}
|
||||
|
||||
declare var MediaQueryList: {
|
||||
prototype: MediaQueryList;
|
||||
new(): MediaQueryList;
|
||||
}
|
||||
|
||||
interface MessageChannel {
|
||||
port1: MessagePort;
|
||||
port2: MessagePort;
|
||||
@@ -533,6 +604,33 @@ declare var MessagePort: {
|
||||
new(): MessagePort;
|
||||
}
|
||||
|
||||
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 ProgressEvent extends Event {
|
||||
lengthComputable: boolean;
|
||||
loaded: number;
|
||||
@@ -620,7 +718,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
LOADING: number;
|
||||
OPENED: number;
|
||||
UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -642,6 +740,15 @@ declare var XMLHttpRequest: {
|
||||
create(): XMLHttpRequest;
|
||||
}
|
||||
|
||||
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var XMLHttpRequestUpload: {
|
||||
prototype: XMLHttpRequestUpload;
|
||||
new(): XMLHttpRequestUpload;
|
||||
}
|
||||
|
||||
interface AbstractWorker {
|
||||
onerror: (ev: Event) => any;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
@@ -661,7 +768,7 @@ interface MSBaseReader {
|
||||
DONE: number;
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -702,7 +809,7 @@ interface XMLHttpRequestEventTarget {
|
||||
onloadstart: (ev: Event) => any;
|
||||
onprogress: (ev: ProgressEvent) => any;
|
||||
ontimeout: (ev: ProgressEvent) => any;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => 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: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -788,17 +895,16 @@ interface WorkerUtils extends Object, WindowBase64 {
|
||||
}
|
||||
|
||||
|
||||
interface NodeListOf<TNode extends Node> 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;
|
||||
}
|
||||
@@ -820,11 +926,11 @@ interface MediaQueryListListener {
|
||||
interface MSLaunchUriCallback {
|
||||
(): void;
|
||||
}
|
||||
interface FrameRequestCallback {
|
||||
(time: number): void;
|
||||
interface MSUnsafeFunctionCallback {
|
||||
(): any;
|
||||
}
|
||||
interface MutationCallback {
|
||||
(mutations: MutationRecord[], observer: MutationObserver): void;
|
||||
interface MSExecAtPriorityFunctionCallback {
|
||||
(...args: any[]): any;
|
||||
}
|
||||
interface DecodeSuccessCallback {
|
||||
(decodedData: AudioBuffer): void;
|
||||
|
||||
+243
-49
@@ -78,15 +78,76 @@ namespace ts.server {
|
||||
return this.snap().getChangeRange(oldSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface TimestampedResolvedModule extends ResolvedModule {
|
||||
lastCheckTime: number;
|
||||
}
|
||||
|
||||
export class LSHost implements ts.LanguageServiceHost {
|
||||
ls: ts.LanguageService = null;
|
||||
compilationSettings: ts.CompilerOptions;
|
||||
filenameToScript: ts.Map<ScriptInfo> = {};
|
||||
roots: ScriptInfo[] = [];
|
||||
|
||||
private resolvedModuleNames: ts.FileMap<Map<TimestampedResolvedModule>>;
|
||||
private moduleResolutionHost: ts.ModuleResolutionHost;
|
||||
|
||||
constructor(public host: ServerHost, public project: Project) {
|
||||
this.resolvedModuleNames = ts.createFileMap<Map<TimestampedResolvedModule>>(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames))
|
||||
this.moduleResolutionHost = {
|
||||
fileExists: fileName => this.fileExists(fileName),
|
||||
readFile: fileName => this.host.readFile(fileName)
|
||||
}
|
||||
}
|
||||
|
||||
resolveModuleNames(moduleNames: string[], containingFile: string): string[] {
|
||||
let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile);
|
||||
|
||||
let newResolutions: Map<TimestampedResolvedModule> = {};
|
||||
let resolvedFileNames: string[] = [];
|
||||
|
||||
let compilerOptions = this.getCompilationSettings();
|
||||
|
||||
for (let moduleName of moduleNames) {
|
||||
// check if this is a duplicate entry in the list
|
||||
let resolution = lookUp(newResolutions, moduleName);
|
||||
if (!resolution) {
|
||||
let existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName);
|
||||
if (moduleResolutionIsValid(existingResolution)) {
|
||||
// ok, it is safe to use existing module resolution results
|
||||
resolution = existingResolution;
|
||||
}
|
||||
else {
|
||||
resolution = <TimestampedResolvedModule>resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost);
|
||||
resolution.lastCheckTime = Date.now();
|
||||
newResolutions[moduleName] = resolution;
|
||||
}
|
||||
}
|
||||
|
||||
ts.Debug.assert(resolution !== undefined);
|
||||
|
||||
resolvedFileNames.push(resolution.resolvedFileName);
|
||||
}
|
||||
|
||||
// replace old results with a new one
|
||||
this.resolvedModuleNames.set(containingFile, newResolutions);
|
||||
return resolvedFileNames;
|
||||
|
||||
function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean {
|
||||
if (!resolution) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resolution.resolvedFileName) {
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
return true;
|
||||
}
|
||||
|
||||
// consider situation if we have no candidate locations as valid resolution.
|
||||
// after all there is no point to invalidate it if we have no idea where to look for the module.
|
||||
return resolution.failedLookupLocations.length === 0;
|
||||
}
|
||||
}
|
||||
|
||||
getDefaultLibFileName() {
|
||||
var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath()));
|
||||
@@ -102,6 +163,8 @@ namespace ts.server {
|
||||
|
||||
setCompilationSettings(opt: ts.CompilerOptions) {
|
||||
this.compilationSettings = opt;
|
||||
// conservatively assume that changing compiler options might affect module resolution strategy
|
||||
this.resolvedModuleNames.clear();
|
||||
}
|
||||
|
||||
lineAffectsRefs(filename: string, line: number) {
|
||||
@@ -137,6 +200,7 @@ namespace ts.server {
|
||||
removeReferencedFile(info: ScriptInfo) {
|
||||
if (!info.isOpen) {
|
||||
this.filenameToScript[info.fileName] = undefined;
|
||||
this.resolvedModuleNames.remove(info.fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +224,14 @@ namespace ts.server {
|
||||
this.roots.push(info);
|
||||
}
|
||||
}
|
||||
|
||||
removeRoot(info: ScriptInfo) {
|
||||
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
|
||||
if (scriptInfo) {
|
||||
this.filenameToScript[info.fileName] = undefined;
|
||||
this.roots = copyListRemovingItem(info, this.roots);
|
||||
}
|
||||
}
|
||||
|
||||
saveTo(filename: string, tmpfilename: string) {
|
||||
var script = this.getScriptInfo(filename);
|
||||
@@ -281,6 +353,7 @@ namespace ts.server {
|
||||
export class Project {
|
||||
compilerService: CompilerService;
|
||||
projectFilename: string;
|
||||
projectFileWatcher: FileWatcher;
|
||||
program: ts.Program;
|
||||
filenameToSourceFile: ts.Map<ts.SourceFile> = {};
|
||||
updateGraphSeq = 0;
|
||||
@@ -288,7 +361,7 @@ namespace ts.server {
|
||||
openRefCount = 0;
|
||||
|
||||
constructor(public projectService: ProjectService, public projectOptions?: ProjectOptions) {
|
||||
this.compilerService = new CompilerService(this,projectOptions && projectOptions.compilerOptions);
|
||||
this.compilerService = new CompilerService(this, projectOptions && projectOptions.compilerOptions);
|
||||
}
|
||||
|
||||
addOpenRef() {
|
||||
@@ -359,6 +432,12 @@ namespace ts.server {
|
||||
info.defaultProject = this;
|
||||
this.compilerService.host.addRoot(info);
|
||||
}
|
||||
|
||||
// remove a root file from project
|
||||
removeRoot(info: ScriptInfo) {
|
||||
info.defaultProject = undefined;
|
||||
this.compilerService.host.removeRoot(info);
|
||||
}
|
||||
|
||||
filesToString() {
|
||||
var strBuilder = "";
|
||||
@@ -453,6 +532,12 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
watchedProjectConfigFileChanged(project: Project) {
|
||||
this.log("Config File Changed: " + project.projectFilename);
|
||||
this.updateConfiguredProject(project);
|
||||
this.updateProjectStructure();
|
||||
}
|
||||
|
||||
log(msg: string, type = "Err") {
|
||||
this.psLogger.msg(msg, type);
|
||||
}
|
||||
@@ -529,6 +614,19 @@ namespace ts.server {
|
||||
}
|
||||
this.configuredProjects = configuredProjects;
|
||||
}
|
||||
|
||||
removeConfiguredProject(project: Project) {
|
||||
project.projectFileWatcher.close();
|
||||
this.configuredProjects = copyListRemovingItem(project, this.configuredProjects);
|
||||
|
||||
let fileNames = project.getFileNames();
|
||||
for (let fileName of fileNames) {
|
||||
let info = this.getScriptInfo(fileName);
|
||||
if (info.defaultProject == project){
|
||||
info.defaultProject = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setConfiguredProjectRoot(info: ScriptInfo) {
|
||||
for (var i = 0, len = this.configuredProjects.length; i < len; i++) {
|
||||
@@ -583,7 +681,6 @@ namespace ts.server {
|
||||
/**
|
||||
* Remove this file from the set of open, non-configured files.
|
||||
* @param info The file that has been closed or newly configured
|
||||
* @param openedByConfig True if info has become a root of a configured project
|
||||
*/
|
||||
closeOpenFile(info: ScriptInfo) {
|
||||
var openFileRoots: ScriptInfo[] = [];
|
||||
@@ -672,18 +769,42 @@ namespace ts.server {
|
||||
return referencingProjects;
|
||||
}
|
||||
|
||||
reloadProjects() {
|
||||
// First check if there is new tsconfig file added for inferred project roots
|
||||
for (let info of this.openFileRoots) {
|
||||
this.openOrUpdateConfiguredProjectForFile(info.fileName);
|
||||
}
|
||||
this.updateProjectStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to update the project structure for every projects.
|
||||
* It is called on the premise that all the configured projects are
|
||||
* up to date.
|
||||
*/
|
||||
updateProjectStructure() {
|
||||
this.log("updating project structure from ...", "Info");
|
||||
this.printProjects();
|
||||
|
||||
let unattachedOpenFiles: ScriptInfo[] = [];
|
||||
let openFileRootsConfigured: ScriptInfo[] = [];
|
||||
for (let info of this.openFileRootsConfigured) {
|
||||
let project = info.defaultProject;
|
||||
if (!project || !(project.getSourceFile(info))) {
|
||||
info.defaultProject = undefined;
|
||||
unattachedOpenFiles.push(info);
|
||||
}
|
||||
else {
|
||||
openFileRootsConfigured.push(info);
|
||||
}
|
||||
}
|
||||
this.openFileRootsConfigured = openFileRootsConfigured;
|
||||
|
||||
// First loop through all open files that are referenced by projects but are not
|
||||
// project roots. For each referenced file, see if the default project still
|
||||
// references that file. If so, then just keep the file in the referenced list.
|
||||
// If not, add the file to an unattached list, to be rechecked later.
|
||||
|
||||
var openFilesReferenced: ScriptInfo[] = [];
|
||||
var unattachedOpenFiles: ScriptInfo[] = [];
|
||||
|
||||
for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) {
|
||||
var referencedFile = this.openFilesReferenced[i];
|
||||
referencedFile.defaultProject.updateGraph();
|
||||
@@ -793,31 +914,39 @@ namespace ts.server {
|
||||
* Open file whose contents is managed by the client
|
||||
* @param filename is absolute pathname
|
||||
*/
|
||||
|
||||
openClientFile(fileName: string) {
|
||||
var searchPath = ts.normalizePath(getDirectoryPath(fileName));
|
||||
this.log("Search path: " + searchPath,"Info");
|
||||
var configFileName = this.findConfigFile(searchPath);
|
||||
if (configFileName) {
|
||||
this.log("Config file name: " + configFileName, "Info");
|
||||
} else {
|
||||
this.log("no config file");
|
||||
}
|
||||
if (configFileName && (!this.configProjectIsActive(configFileName))) {
|
||||
var configResult = this.openConfigFile(configFileName, fileName);
|
||||
if (!configResult.success) {
|
||||
this.log("Error opening config file " + configFileName + " " + configResult.errorMsg);
|
||||
}
|
||||
else {
|
||||
this.log("Opened configuration file " + configFileName,"Info");
|
||||
this.configuredProjects.push(configResult.project);
|
||||
}
|
||||
}
|
||||
this.openOrUpdateConfiguredProjectForFile(fileName);
|
||||
var info = this.openFile(fileName, true);
|
||||
this.addOpenFile(info);
|
||||
this.printProjects();
|
||||
return info;
|
||||
}
|
||||
|
||||
openOrUpdateConfiguredProjectForFile(fileName: string) {
|
||||
let searchPath = ts.normalizePath(getDirectoryPath(fileName));
|
||||
this.log("Search path: " + searchPath,"Info");
|
||||
let configFileName = this.findConfigFile(searchPath);
|
||||
if (configFileName) {
|
||||
this.log("Config file name: " + configFileName, "Info");
|
||||
let project = this.findConfiguredProjectByConfigFile(configFileName);
|
||||
if (!project) {
|
||||
var configResult = this.openConfigFile(configFileName, fileName);
|
||||
if (!configResult.success) {
|
||||
this.log("Error opening config file " + configFileName + " " + configResult.errorMsg);
|
||||
}
|
||||
else {
|
||||
this.log("Opened configuration file " + configFileName,"Info");
|
||||
this.configuredProjects.push(configResult.project);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.updateConfiguredProject(project);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.log("No config files found.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close file whose contents is managed by the client
|
||||
@@ -895,49 +1024,113 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
configProjectIsActive(fileName: string) {
|
||||
for (var i = 0, len = this.configuredProjects.length; i < len; i++) {
|
||||
if (this.configuredProjects[i].projectFilename == fileName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return this.findConfiguredProjectByConfigFile(fileName) === undefined;
|
||||
}
|
||||
|
||||
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
|
||||
findConfiguredProjectByConfigFile(configFileName: string) {
|
||||
for (var i = 0, len = this.configuredProjects.length; i < len; i++) {
|
||||
if (this.configuredProjects[i].projectFilename == configFileName) {
|
||||
return this.configuredProjects[i];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
configFileToProjectOptions(configFilename: string): { succeeded: boolean, projectOptions?: ProjectOptions, error?: ProjectOpenResult } {
|
||||
configFilename = ts.normalizePath(configFilename);
|
||||
// file references will be relative to dirPath (or absolute)
|
||||
var dirPath = ts.getDirectoryPath(configFilename);
|
||||
var contents = this.host.readFile(configFilename)
|
||||
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.parseConfigFileText(configFilename, contents);
|
||||
if (rawConfig.error) {
|
||||
return rawConfig.error;
|
||||
return { succeeded: false, error: rawConfig.error };
|
||||
}
|
||||
else {
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, this.host, dirPath);
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
return { errorMsg: "tsconfig option errors" };
|
||||
return { succeeded: false, error: { errorMsg: "tsconfig option errors" }};
|
||||
}
|
||||
else if (parsedCommandLine.fileNames) {
|
||||
else if (parsedCommandLine.fileNames == null) {
|
||||
return { succeeded: false, error: { errorMsg: "no files found" }}
|
||||
}
|
||||
else {
|
||||
var projectOptions: ProjectOptions = {
|
||||
files: parsedCommandLine.fileNames,
|
||||
compilerOptions: parsedCommandLine.options
|
||||
};
|
||||
var proj = this.createProject(configFilename, projectOptions);
|
||||
for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) {
|
||||
var rootFilename = parsedCommandLine.fileNames[i];
|
||||
if (this.host.fileExists(rootFilename)) {
|
||||
var info = this.openFile(rootFilename, clientFileName == rootFilename);
|
||||
proj.addRoot(info);
|
||||
}
|
||||
else {
|
||||
return { errorMsg: "specified file " + rootFilename + " not found" };
|
||||
}
|
||||
return { succeeded: true, projectOptions };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
|
||||
let { succeeded, projectOptions, error } = this.configFileToProjectOptions(configFilename);
|
||||
if (!succeeded) {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
let proj = this.createProject(configFilename, projectOptions);
|
||||
for (let i = 0, len = projectOptions.files.length; i < len; i++) {
|
||||
let rootFilename = projectOptions.files[i];
|
||||
if (this.host.fileExists(rootFilename)) {
|
||||
let info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename);
|
||||
proj.addRoot(info);
|
||||
}
|
||||
proj.finishGraph();
|
||||
return { success: true, project: proj };
|
||||
else {
|
||||
return { errorMsg: "specified file " + rootFilename + " not found" };
|
||||
}
|
||||
}
|
||||
proj.finishGraph();
|
||||
proj.projectFileWatcher = this.host.watchFile(configFilename, _ => this.watchedProjectConfigFileChanged(proj));
|
||||
return { success: true, project: proj };
|
||||
}
|
||||
}
|
||||
|
||||
updateConfiguredProject(project: Project) {
|
||||
if (!this.host.fileExists(project.projectFilename)) {
|
||||
this.log("Config file deleted");
|
||||
this.removeConfiguredProject(project);
|
||||
}
|
||||
else {
|
||||
let { succeeded, projectOptions, error } = this.configFileToProjectOptions(project.projectFilename);
|
||||
if (!succeeded) {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
return { errorMsg: "no files found" };
|
||||
let oldFileNames = project.compilerService.host.roots.map(info => info.fileName);
|
||||
let newFileNames = projectOptions.files;
|
||||
let fileNamesToRemove = oldFileNames.filter(f => newFileNames.indexOf(f) < 0);
|
||||
let fileNamesToAdd = newFileNames.filter(f => oldFileNames.indexOf(f) < 0);
|
||||
|
||||
for (let fileName of fileNamesToRemove) {
|
||||
let info = this.getScriptInfo(fileName);
|
||||
project.removeRoot(info);
|
||||
}
|
||||
|
||||
for (let fileName of fileNamesToAdd) {
|
||||
let info = this.getScriptInfo(fileName);
|
||||
if (!info) {
|
||||
info = this.openFile(fileName, false);
|
||||
}
|
||||
else {
|
||||
// if the root file was opened by client, it would belong to either
|
||||
// openFileRoots or openFileReferenced.
|
||||
if (info.isOpen) {
|
||||
if (this.openFileRoots.indexOf(info) >= 0) {
|
||||
this.openFileRoots = copyListRemovingItem(info, this.openFileRoots);
|
||||
}
|
||||
if (this.openFilesReferenced.indexOf(info) >= 0) {
|
||||
this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced);
|
||||
}
|
||||
this.openFileRootsConfigured.push(info);
|
||||
}
|
||||
}
|
||||
project.addRoot(info);
|
||||
}
|
||||
|
||||
project.setProjectOptions(projectOptions);
|
||||
project.finishGraph();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -990,6 +1183,7 @@ namespace ts.server {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
}
|
||||
|
||||
Vendored
+9
@@ -31,6 +31,12 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
arguments?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to reload the project structure for all the opened files
|
||||
*/
|
||||
export interface ReloadProjectsRequest extends Message {
|
||||
}
|
||||
|
||||
/**
|
||||
* Server-initiated event message
|
||||
@@ -452,6 +458,9 @@ declare namespace ts.server.protocol {
|
||||
|
||||
/** Defines space handling after opening and before closing non empty parenthesis. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
|
||||
/** Defines space handling after opening and before closing non empty brackets. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
|
||||
|
||||
/** Defines whether an open brace is put onto a new line for functions or not. Default value is false. */
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace ts.server {
|
||||
export const SignatureHelp = "signatureHelp";
|
||||
export const TypeDefinition = "typeDefinition";
|
||||
export const ProjectInfo = "projectInfo";
|
||||
export const ReloadProjects = "reloadProjects";
|
||||
export const Unknown = "unknown";
|
||||
}
|
||||
|
||||
@@ -226,6 +227,10 @@ namespace ts.server {
|
||||
this.syntacticCheck(file, project);
|
||||
this.semanticCheck(file, project);
|
||||
}
|
||||
|
||||
private reloadProjects() {
|
||||
this.projectService.reloadProjects();
|
||||
}
|
||||
|
||||
private updateProjectStructure(seq: number, matchSeq: (seq: number) => boolean, ms = 1500) {
|
||||
setTimeout(() => {
|
||||
@@ -1033,6 +1038,10 @@ namespace ts.server {
|
||||
var { file, needFileNameList } = <protocol.ProjectInfoRequestArgs>request.arguments;
|
||||
return {response: this.getProjectInfo(file, needFileNameList), responseRequired: true};
|
||||
},
|
||||
[CommandNames.ReloadProjects]: (request: protocol.ReloadProjectsRequest) => {
|
||||
this.reloadProjects();
|
||||
return {responseRequired: false};
|
||||
}
|
||||
};
|
||||
public addProtocolHandler(command: string, handler: (request: protocol.Request) => {response?: any, responseRequired: boolean}) {
|
||||
if (this.handlers[command]) {
|
||||
|
||||
@@ -39,12 +39,12 @@ namespace ts.formatting {
|
||||
public SpaceBetweenCloseBraceAndWhile: Rule;
|
||||
public NoSpaceAfterCloseBrace: Rule;
|
||||
|
||||
// No space for indexer and dot
|
||||
// No space for dot
|
||||
public NoSpaceBeforeDot: Rule;
|
||||
public NoSpaceAfterDot: Rule;
|
||||
|
||||
// No space before and after indexer
|
||||
public NoSpaceBeforeOpenBracket: Rule;
|
||||
public NoSpaceAfterOpenBracket: Rule;
|
||||
public NoSpaceBeforeCloseBracket: Rule;
|
||||
public NoSpaceAfterCloseBracket: Rule;
|
||||
|
||||
// Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}.
|
||||
@@ -191,6 +191,13 @@ namespace ts.formatting {
|
||||
public NoSpaceAfterOpenParen: Rule;
|
||||
public NoSpaceBeforeCloseParen: Rule;
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
public SpaceAfterOpenBracket: Rule;
|
||||
public SpaceBeforeCloseBracket: Rule;
|
||||
public NoSpaceBetweenBrackets: Rule;
|
||||
public NoSpaceAfterOpenBracket: Rule;
|
||||
public NoSpaceBeforeCloseBracket: Rule;
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
public SpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
@@ -232,13 +239,13 @@ namespace ts.formatting {
|
||||
this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// No space for indexer and dot
|
||||
// No space for dot
|
||||
this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// No space before and after indexer
|
||||
this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext ), RuleAction.Delete));
|
||||
|
||||
// Place a space before open brace in a function declaration
|
||||
this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments;
|
||||
@@ -405,8 +412,8 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeSemicolon,
|
||||
this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,
|
||||
this.NoSpaceBeforeComma,
|
||||
this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket,
|
||||
this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket,
|
||||
this.NoSpaceBeforeOpenBracket,
|
||||
this.NoSpaceAfterCloseBracket,
|
||||
this.SpaceAfterSemicolon,
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl,
|
||||
this.SpaceBetweenStatements, this.SpaceAfterTryFinally
|
||||
@@ -451,6 +458,13 @@ namespace ts.formatting {
|
||||
this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
@@ -715,6 +729,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
@@ -725,6 +740,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -71,6 +71,17 @@ namespace ts.formatting {
|
||||
rules.push(this.globalRules.NoSpaceBetweenParens);
|
||||
}
|
||||
|
||||
if ( options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets ) {
|
||||
rules.push( this.globalRules.SpaceAfterOpenBracket );
|
||||
rules.push( this.globalRules.SpaceBeforeCloseBracket );
|
||||
rules.push( this.globalRules.NoSpaceBetweenBrackets );
|
||||
}
|
||||
else {
|
||||
rules.push( this.globalRules.NoSpaceAfterOpenBracket );
|
||||
rules.push( this.globalRules.NoSpaceBeforeCloseBracket );
|
||||
rules.push( this.globalRules.NoSpaceBetweenBrackets );
|
||||
}
|
||||
|
||||
if (options.InsertSpaceAfterSemicolonInForStatements) {
|
||||
rules.push(this.globalRules.SpaceAfterSemicolonInFor);
|
||||
}
|
||||
|
||||
@@ -428,6 +428,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.JsxElement:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+280
-134
File diff suppressed because it is too large
Load Diff
+31
-3
@@ -60,10 +60,12 @@ namespace ts {
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
|
||||
getModuleResolutionsForFile?(fileName: string): string;
|
||||
}
|
||||
|
||||
/** Public interface of the the of a config service shim instance.*/
|
||||
export interface CoreServicesShimHost extends Logger {
|
||||
export interface CoreServicesShimHost extends Logger, ModuleResolutionHost {
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type: string[]
|
||||
*
|
||||
@@ -270,8 +272,18 @@ namespace ts {
|
||||
private files: string[];
|
||||
private loggingEnabled = false;
|
||||
private tracingEnabled = false;
|
||||
|
||||
|
||||
public resolveModuleNames: (moduleName: string[], containingFile: string) => string[];
|
||||
|
||||
constructor(private shimHost: LanguageServiceShimHost) {
|
||||
// if shimHost is a COM object then property check will become method call with no arguments.
|
||||
// 'in' does not have this effect.
|
||||
if ("getModuleResolutionsForFile" in this.shimHost) {
|
||||
this.resolveModuleNames = (moduleNames: string[], containingFile: string) => {
|
||||
let resolutionsInFile = <Map<string>>JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile));
|
||||
return map(moduleNames, name => lookUp(resolutionsInFile, name));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public log(s: string): void {
|
||||
@@ -410,6 +422,14 @@ namespace ts {
|
||||
}
|
||||
return JSON.parse(encoded);
|
||||
}
|
||||
|
||||
public fileExists(fileName: string): boolean {
|
||||
return this.shimHost.fileExists(fileName);
|
||||
}
|
||||
|
||||
public readFile(fileName: string): string {
|
||||
return this.shimHost.readFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): any {
|
||||
@@ -918,6 +938,13 @@ namespace ts {
|
||||
private forwardJSONCall(actionDescription: string, action: () => any): any {
|
||||
return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
|
||||
}
|
||||
|
||||
public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string {
|
||||
return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => {
|
||||
let compilerOptions = <CompilerOptions>JSON.parse(compilerOptionsJson);
|
||||
return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
|
||||
});
|
||||
}
|
||||
|
||||
public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -927,6 +954,7 @@ namespace ts {
|
||||
var convertResult = {
|
||||
referencedFiles: <IFileReference[]>[],
|
||||
importedFiles: <IFileReference[]>[],
|
||||
ambientExternalModules: result.ambientExternalModules,
|
||||
isLibFile: result.isLibFile
|
||||
};
|
||||
|
||||
@@ -1069,4 +1097,4 @@ module TypeScript.Services {
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
let toolsVersion = "1.5";
|
||||
const toolsVersion = "1.6";
|
||||
|
||||
@@ -469,6 +469,39 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the corresponding JSDocTag node if the position is in a jsDoc comment
|
||||
*/
|
||||
export function getJsDocTagAtPosition(sourceFile: SourceFile, position: number): JSDocTag {
|
||||
let node = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (isToken(node)) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VarKeyword:
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
// if the current token is var, let or const, skip the VariableDeclarationList
|
||||
node = node.parent === undefined ? undefined : node.parent.parent;
|
||||
break;
|
||||
default:
|
||||
node = node.parent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (node) {
|
||||
let jsDocComment = node.jsDocComment;
|
||||
if (jsDocComment) {
|
||||
for (let tag of jsDocComment.tags) {
|
||||
if (tag.pos <= position && position <= tag.end) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function nodeHasTokens(n: Node): boolean {
|
||||
// If we have a token or node that has a non-zero width, it must have tokens.
|
||||
// Note, that getWidth() does not take trivia into account.
|
||||
@@ -640,7 +673,6 @@ namespace ts {
|
||||
else if (flags & SymbolFlags.TypeAlias) { return SymbolDisplayPartKind.aliasName; }
|
||||
else if (flags & SymbolFlags.Alias) { return SymbolDisplayPartKind.aliasName; }
|
||||
|
||||
|
||||
return SymbolDisplayPartKind.text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3890, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3840, 52), Decl(lib.d.ts, 3946, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3890, 31))
|
||||
|
||||
let result = [];
|
||||
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
|
||||
|
||||
@@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];
|
||||
|
||||
interface myArray extends Array<Number> { }
|
||||
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
|
||||
interface myArray2 extends Array<Number|String> { }
|
||||
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1))
|
||||
|
||||
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
|
||||
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
>foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
};
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
declare var p: Promise<number>;
|
||||
>p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
@@ -22,7 +22,7 @@ async function f0() { }
|
||||
|
||||
async function f1(): Promise<void> { }
|
||||
>f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38))
|
||||
@@ -33,7 +33,7 @@ let f4 = async function() { }
|
||||
|
||||
let f5 = async function(): Promise<void> { }
|
||||
>f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3))
|
||||
@@ -44,7 +44,7 @@ let f7 = async () => { };
|
||||
|
||||
let f8 = async (): Promise<void> => { };
|
||||
>f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3))
|
||||
@@ -60,7 +60,7 @@ let f11 = async () => mp;
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
@@ -76,7 +76,7 @@ let o = {
|
||||
|
||||
async m2(): Promise<void> { },
|
||||
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31))
|
||||
@@ -92,7 +92,7 @@ class C {
|
||||
|
||||
async m2(): Promise<void> { }
|
||||
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30))
|
||||
@@ -103,7 +103,7 @@ class C {
|
||||
|
||||
static async m5(): Promise<void> { }
|
||||
>m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
|
||||
async function await(): Promise<void> {
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = await p || a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = await p && a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: number;
|
||||
|
||||
declare var p: Promise<number>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = await p + a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = await p, a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var o: { a: boolean; };
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = fn(a, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = fn(await p, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = fn(a, await p, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = (await pfn)(a, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = o.fn(a, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = o.fn(await p, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = o.fn(a, await p, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
>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<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11))
|
||||
|
||||
"before";
|
||||
var b = (await po).fn(a, a, a);
|
||||
|
||||
@@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc");
|
||||
>a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3))
|
||||
|
||||
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1368, 1))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 4009, 1))
|
||||
>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))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [tests/cases/compiler/commonjsSafeImport.ts] ////
|
||||
|
||||
//// [10_lib.ts]
|
||||
|
||||
export function Foo() {}
|
||||
|
||||
//// [main.ts]
|
||||
import { Foo } from './10_lib';
|
||||
|
||||
Foo();
|
||||
|
||||
|
||||
//// [10_lib.js]
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
//// [main.js]
|
||||
var _10_lib_1 = require('./10_lib');
|
||||
_10_lib_1.Foo();
|
||||
|
||||
|
||||
//// [10_lib.d.ts]
|
||||
export declare function Foo(): void;
|
||||
//// [main.d.ts]
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/10_lib.ts ===
|
||||
|
||||
export function Foo() {}
|
||||
>Foo : Symbol(Foo, Decl(10_lib.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/main.ts ===
|
||||
import { Foo } from './10_lib';
|
||||
>Foo : Symbol(Foo, Decl(main.ts, 0, 8))
|
||||
|
||||
Foo();
|
||||
>Foo : Symbol(Foo, Decl(main.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/10_lib.ts ===
|
||||
|
||||
export function Foo() {}
|
||||
>Foo : () => void
|
||||
|
||||
=== tests/cases/compiler/main.ts ===
|
||||
import { Foo } from './10_lib';
|
||||
>Foo : () => void
|
||||
|
||||
Foo();
|
||||
>Foo() : void
|
||||
>Foo : () => void
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [computedPropertyNamesSourceMap2_ES5.js.map]
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"}
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACIA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"}
|
||||
@@ -28,26 +28,28 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
2 > ^^^
|
||||
3 > ^^^^^^^
|
||||
4 > ^
|
||||
5 > ^^^->
|
||||
5 > ^^^
|
||||
1->{
|
||||
>
|
||||
2 > [
|
||||
3 > "hello"
|
||||
4 > ]
|
||||
5 >
|
||||
1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
|
||||
3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
|
||||
4 >Emitted(2, 16) Source(2, 14) + SourceIndex(0)
|
||||
5 >Emitted(2, 19) Source(2, 5) + SourceIndex(0)
|
||||
---
|
||||
>>> debugger;
|
||||
1->^^^^^^^^
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
3 > ^
|
||||
1->() {
|
||||
1 >["hello"]() {
|
||||
>
|
||||
2 > debugger
|
||||
3 > ;
|
||||
1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
|
||||
1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
|
||||
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"])
|
||||
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"])
|
||||
---
|
||||
|
||||
@@ -82,5 +82,7 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any
|
||||
>IWithCallSignatures : Symbol(IWithCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 9, 1))
|
||||
>IWithCallSignatures4 : Symbol(IWithCallSignatures4, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 18, 1))
|
||||
>a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52))
|
||||
>a.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
>a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52))
|
||||
>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any
|
||||
>x4 : IWithCallSignatures | IWithCallSignatures4
|
||||
>IWithCallSignatures : IWithCallSignatures
|
||||
>IWithCallSignatures4 : IWithCallSignatures4
|
||||
>a => /*here a should be any*/ a.toString() : (a: any) => any
|
||||
>a : any
|
||||
>a.toString() : any
|
||||
>a.toString : any
|
||||
>a : any
|
||||
>toString : any
|
||||
>a => /*here a should be any*/ a.toString() : (a: number) => string
|
||||
>a : number
|
||||
>a.toString() : string
|
||||
>a.toString : (radix?: number) => string
|
||||
>a : number
|
||||
>toString : (radix?: number) => string
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,8 +10,7 @@ sourceFile:contextualTyping.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>// CONTEXT: Class property declaration
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >// DEFAULT INTERFACES
|
||||
>interface IFoo {
|
||||
> n: number;
|
||||
@@ -24,21 +23,23 @@ sourceFile:contextualTyping.ts
|
||||
> foo: IFoo;
|
||||
>}
|
||||
>
|
||||
>// CONTEXT: Class property declaration
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Class property declaration
|
||||
1 >Emitted(1, 1) Source(14, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(13, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 39) Source(13, 39) + SourceIndex(0)
|
||||
2 >// CONTEXT: Class property declaration
|
||||
1 >Emitted(1, 1) Source(13, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 39) Source(13, 39) + SourceIndex(0)
|
||||
---
|
||||
>>>var C1T5 = (function () {
|
||||
>>> function C1T5() {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(3, 5) Source(14, 1) + SourceIndex(0) name (C1T5)
|
||||
1 >Emitted(2, 1) Source(14, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function C1T5() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(3, 5) Source(14, 1) + SourceIndex(0) name (C1T5)
|
||||
---
|
||||
>>> this.foo = function (i) {
|
||||
1->^^^^^^^^
|
||||
@@ -127,17 +128,13 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Module property declaration
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Module property declaration
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Module property declaration
|
||||
1->Emitted(10, 1) Source(21, 1) + SourceIndex(0)
|
||||
2 >Emitted(10, 1) Source(20, 1) + SourceIndex(0)
|
||||
3 >Emitted(10, 40) Source(20, 40) + SourceIndex(0)
|
||||
2 >// CONTEXT: Module property declaration
|
||||
1->Emitted(10, 1) Source(20, 1) + SourceIndex(0)
|
||||
2 >Emitted(10, 40) Source(20, 40) + SourceIndex(0)
|
||||
---
|
||||
>>>var C2T5;
|
||||
1 >
|
||||
@@ -257,66 +254,65 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Variable declaration
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Variable declaration
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Variable declaration
|
||||
1->Emitted(17, 1) Source(28, 1) + SourceIndex(0)
|
||||
2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0)
|
||||
3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0)
|
||||
2 >// CONTEXT: Variable declaration
|
||||
1->Emitted(17, 1) Source(27, 1) + SourceIndex(0)
|
||||
2 >Emitted(17, 33) Source(27, 33) + SourceIndex(0)
|
||||
---
|
||||
>>>var c3t1 = (function (s) { return s; });
|
||||
1->^^^^
|
||||
2 > ^^^^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^
|
||||
8 > ^^^^^^
|
||||
9 > ^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^
|
||||
9 > ^^^^^^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
16> ^
|
||||
1->
|
||||
>var
|
||||
2 > c3t1
|
||||
3 > : (s: string) => string =
|
||||
4 > (
|
||||
5 > function(
|
||||
6 > s
|
||||
7 > ) {
|
||||
8 > return
|
||||
9 >
|
||||
10> s
|
||||
11>
|
||||
12>
|
||||
13> }
|
||||
14> )
|
||||
15> ;
|
||||
1->Emitted(18, 5) Source(28, 5) + SourceIndex(0)
|
||||
2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0)
|
||||
3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0)
|
||||
4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0)
|
||||
5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0)
|
||||
6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0)
|
||||
7 >Emitted(18, 28) Source(28, 50) + SourceIndex(0)
|
||||
8 >Emitted(18, 34) Source(28, 56) + SourceIndex(0)
|
||||
9 >Emitted(18, 35) Source(28, 57) + SourceIndex(0)
|
||||
10>Emitted(18, 36) Source(28, 58) + SourceIndex(0)
|
||||
11>Emitted(18, 37) Source(28, 58) + SourceIndex(0)
|
||||
12>Emitted(18, 38) Source(28, 59) + SourceIndex(0)
|
||||
13>Emitted(18, 39) Source(28, 60) + SourceIndex(0)
|
||||
14>Emitted(18, 40) Source(28, 61) + SourceIndex(0)
|
||||
15>Emitted(18, 41) Source(28, 62) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c3t1
|
||||
4 > : (s: string) => string =
|
||||
5 > (
|
||||
6 > function(
|
||||
7 > s
|
||||
8 > ) {
|
||||
9 > return
|
||||
10>
|
||||
11> s
|
||||
12>
|
||||
13>
|
||||
14> }
|
||||
15> )
|
||||
16> ;
|
||||
1->Emitted(18, 1) Source(28, 1) + SourceIndex(0)
|
||||
2 >Emitted(18, 5) Source(28, 5) + SourceIndex(0)
|
||||
3 >Emitted(18, 9) Source(28, 9) + SourceIndex(0)
|
||||
4 >Emitted(18, 12) Source(28, 35) + SourceIndex(0)
|
||||
5 >Emitted(18, 13) Source(28, 36) + SourceIndex(0)
|
||||
6 >Emitted(18, 23) Source(28, 45) + SourceIndex(0)
|
||||
7 >Emitted(18, 24) Source(28, 46) + SourceIndex(0)
|
||||
8 >Emitted(18, 28) Source(28, 50) + SourceIndex(0)
|
||||
9 >Emitted(18, 34) Source(28, 56) + SourceIndex(0)
|
||||
10>Emitted(18, 35) Source(28, 57) + SourceIndex(0)
|
||||
11>Emitted(18, 36) Source(28, 58) + SourceIndex(0)
|
||||
12>Emitted(18, 37) Source(28, 58) + SourceIndex(0)
|
||||
13>Emitted(18, 38) Source(28, 59) + SourceIndex(0)
|
||||
14>Emitted(18, 39) Source(28, 60) + SourceIndex(0)
|
||||
15>Emitted(18, 40) Source(28, 61) + SourceIndex(0)
|
||||
16>Emitted(18, 41) Source(28, 62) + SourceIndex(0)
|
||||
---
|
||||
>>>var c3t2 = ({
|
||||
1 >
|
||||
@@ -945,27 +941,28 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Class property assignment
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Class property assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Class property assignment
|
||||
1->Emitted(40, 1) Source(56, 1) + SourceIndex(0)
|
||||
2 >Emitted(40, 1) Source(55, 1) + SourceIndex(0)
|
||||
3 >Emitted(40, 38) Source(55, 38) + SourceIndex(0)
|
||||
2 >// CONTEXT: Class property assignment
|
||||
1->Emitted(40, 1) Source(55, 1) + SourceIndex(0)
|
||||
2 >Emitted(40, 38) Source(55, 38) + SourceIndex(0)
|
||||
---
|
||||
>>>var C4T5 = (function () {
|
||||
>>> function C4T5() {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>class C4T5 {
|
||||
>
|
||||
1 >Emitted(41, 1) Source(56, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function C4T5() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->class C4T5 {
|
||||
> foo: (i: number, s: string) => string;
|
||||
>
|
||||
1 >Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5)
|
||||
1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5)
|
||||
---
|
||||
>>> this.foo = function (i, s) {
|
||||
1->^^^^^^^^
|
||||
@@ -1070,17 +1067,13 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Module property assignment
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Module property assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Module property assignment
|
||||
1->Emitted(49, 1) Source(66, 1) + SourceIndex(0)
|
||||
2 >Emitted(49, 1) Source(65, 1) + SourceIndex(0)
|
||||
3 >Emitted(49, 39) Source(65, 39) + SourceIndex(0)
|
||||
2 >// CONTEXT: Module property assignment
|
||||
1->Emitted(49, 1) Source(65, 1) + SourceIndex(0)
|
||||
2 >Emitted(49, 39) Source(65, 39) + SourceIndex(0)
|
||||
---
|
||||
>>>var C5T5;
|
||||
1 >
|
||||
@@ -1209,30 +1202,29 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Variable assignment
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Variable assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Variable assignment
|
||||
1->Emitted(56, 1) Source(74, 1) + SourceIndex(0)
|
||||
2 >Emitted(56, 1) Source(73, 1) + SourceIndex(0)
|
||||
3 >Emitted(56, 32) Source(73, 32) + SourceIndex(0)
|
||||
2 >// CONTEXT: Variable assignment
|
||||
1->Emitted(56, 1) Source(73, 1) + SourceIndex(0)
|
||||
2 >Emitted(56, 32) Source(73, 32) + SourceIndex(0)
|
||||
---
|
||||
>>>var c6t5;
|
||||
1 >^^^^
|
||||
2 > ^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > c6t5: (n: number) => IFoo
|
||||
3 > ;
|
||||
1 >Emitted(57, 5) Source(74, 5) + SourceIndex(0)
|
||||
2 >Emitted(57, 9) Source(74, 30) + SourceIndex(0)
|
||||
3 >Emitted(57, 10) Source(74, 31) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c6t5: (n: number) => IFoo
|
||||
4 > ;
|
||||
1 >Emitted(57, 1) Source(74, 1) + SourceIndex(0)
|
||||
2 >Emitted(57, 5) Source(74, 5) + SourceIndex(0)
|
||||
3 >Emitted(57, 9) Source(74, 30) + SourceIndex(0)
|
||||
4 >Emitted(57, 10) Source(74, 31) + SourceIndex(0)
|
||||
---
|
||||
>>>c6t5 = function (n) { return ({}); };
|
||||
1->
|
||||
@@ -1284,30 +1276,29 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Array index assignment
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >
|
||||
>
|
||||
>// CONTEXT: Array index assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Array index assignment
|
||||
1 >Emitted(59, 1) Source(78, 1) + SourceIndex(0)
|
||||
2 >Emitted(59, 1) Source(77, 1) + SourceIndex(0)
|
||||
3 >Emitted(59, 35) Source(77, 35) + SourceIndex(0)
|
||||
2 >// CONTEXT: Array index assignment
|
||||
1 >Emitted(59, 1) Source(77, 1) + SourceIndex(0)
|
||||
2 >Emitted(59, 35) Source(77, 35) + SourceIndex(0)
|
||||
---
|
||||
>>>var c7t2;
|
||||
1 >^^^^
|
||||
2 > ^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > c7t2: IFoo[]
|
||||
3 > ;
|
||||
1 >Emitted(60, 5) Source(78, 5) + SourceIndex(0)
|
||||
2 >Emitted(60, 9) Source(78, 17) + SourceIndex(0)
|
||||
3 >Emitted(60, 10) Source(78, 18) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c7t2: IFoo[]
|
||||
4 > ;
|
||||
1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0)
|
||||
2 >Emitted(60, 5) Source(78, 5) + SourceIndex(0)
|
||||
3 >Emitted(60, 9) Source(78, 17) + SourceIndex(0)
|
||||
4 >Emitted(60, 10) Source(78, 18) + SourceIndex(0)
|
||||
---
|
||||
>>>c7t2[0] = ({ n: 1 });
|
||||
1->
|
||||
@@ -2140,31 +2131,30 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Function call
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>// CONTEXT: Function call
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Function call
|
||||
1->Emitted(85, 1) Source(146, 1) + SourceIndex(0)
|
||||
2 >Emitted(85, 1) Source(145, 1) + SourceIndex(0)
|
||||
3 >Emitted(85, 26) Source(145, 26) + SourceIndex(0)
|
||||
2 >// CONTEXT: Function call
|
||||
1->Emitted(85, 1) Source(145, 1) + SourceIndex(0)
|
||||
2 >Emitted(85, 26) Source(145, 26) + SourceIndex(0)
|
||||
---
|
||||
>>>function c9t5(f) { }
|
||||
1 >^^^^^^^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^^
|
||||
5 > ^
|
||||
1 >
|
||||
>function c9t5(
|
||||
2 > f: (n: number) => IFoo
|
||||
3 > ) {
|
||||
4 > }
|
||||
1 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
|
||||
2 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
|
||||
3 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5)
|
||||
4 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5)
|
||||
>
|
||||
2 >function c9t5(
|
||||
3 > f: (n: number) => IFoo
|
||||
4 > ) {
|
||||
5 > }
|
||||
1 >Emitted(86, 1) Source(146, 1) + SourceIndex(0)
|
||||
2 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
|
||||
3 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
|
||||
4 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5)
|
||||
5 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5)
|
||||
---
|
||||
>>>;
|
||||
1 >
|
||||
@@ -2236,107 +2226,107 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Return statement
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Return statement
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Return statement
|
||||
1->Emitted(91, 1) Source(152, 1) + SourceIndex(0)
|
||||
2 >Emitted(91, 1) Source(151, 1) + SourceIndex(0)
|
||||
3 >Emitted(91, 29) Source(151, 29) + SourceIndex(0)
|
||||
2 >// CONTEXT: Return statement
|
||||
1->Emitted(91, 1) Source(151, 1) + SourceIndex(0)
|
||||
2 >Emitted(91, 29) Source(151, 29) + SourceIndex(0)
|
||||
---
|
||||
>>>var c10t5 = function () { return function (n) { return ({}); }; };
|
||||
1->^^^^
|
||||
2 > ^^^^^
|
||||
3 > ^^^
|
||||
4 > ^^^^^^^^^^^^^^
|
||||
5 > ^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^
|
||||
8 > ^
|
||||
9 > ^^^^
|
||||
10> ^^^^^^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^^
|
||||
14> ^
|
||||
15> ^
|
||||
16> ^
|
||||
17> ^
|
||||
18> ^
|
||||
19> ^
|
||||
20> ^
|
||||
21> ^
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^
|
||||
4 > ^^^
|
||||
5 > ^^^^^^^^^^^^^^
|
||||
6 > ^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^^^^^^^
|
||||
9 > ^
|
||||
10> ^^^^
|
||||
11> ^^^^^^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^^
|
||||
15> ^
|
||||
16> ^
|
||||
17> ^
|
||||
18> ^
|
||||
19> ^
|
||||
20> ^
|
||||
21> ^
|
||||
22> ^
|
||||
1->
|
||||
>var
|
||||
2 > c10t5
|
||||
3 > : () => (n: number) => IFoo =
|
||||
4 > function() {
|
||||
5 > return
|
||||
6 >
|
||||
7 > function(
|
||||
8 > n
|
||||
9 > ) {
|
||||
10> return
|
||||
11> <IFoo>
|
||||
12> (
|
||||
13> {}
|
||||
14> )
|
||||
15>
|
||||
16>
|
||||
17> }
|
||||
18>
|
||||
19>
|
||||
20> }
|
||||
21> ;
|
||||
1->Emitted(92, 5) Source(152, 5) + SourceIndex(0)
|
||||
2 >Emitted(92, 10) Source(152, 10) + SourceIndex(0)
|
||||
3 >Emitted(92, 13) Source(152, 40) + SourceIndex(0)
|
||||
4 >Emitted(92, 27) Source(152, 53) + SourceIndex(0)
|
||||
5 >Emitted(92, 33) Source(152, 59) + SourceIndex(0)
|
||||
6 >Emitted(92, 34) Source(152, 60) + SourceIndex(0)
|
||||
7 >Emitted(92, 44) Source(152, 69) + SourceIndex(0)
|
||||
8 >Emitted(92, 45) Source(152, 70) + SourceIndex(0)
|
||||
9 >Emitted(92, 49) Source(152, 74) + SourceIndex(0)
|
||||
10>Emitted(92, 55) Source(152, 80) + SourceIndex(0)
|
||||
11>Emitted(92, 56) Source(152, 87) + SourceIndex(0)
|
||||
12>Emitted(92, 57) Source(152, 88) + SourceIndex(0)
|
||||
13>Emitted(92, 59) Source(152, 90) + SourceIndex(0)
|
||||
14>Emitted(92, 60) Source(152, 91) + SourceIndex(0)
|
||||
15>Emitted(92, 61) Source(152, 91) + SourceIndex(0)
|
||||
16>Emitted(92, 62) Source(152, 92) + SourceIndex(0)
|
||||
17>Emitted(92, 63) Source(152, 93) + SourceIndex(0)
|
||||
18>Emitted(92, 64) Source(152, 93) + SourceIndex(0)
|
||||
19>Emitted(92, 65) Source(152, 94) + SourceIndex(0)
|
||||
20>Emitted(92, 66) Source(152, 95) + SourceIndex(0)
|
||||
21>Emitted(92, 67) Source(152, 96) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c10t5
|
||||
4 > : () => (n: number) => IFoo =
|
||||
5 > function() {
|
||||
6 > return
|
||||
7 >
|
||||
8 > function(
|
||||
9 > n
|
||||
10> ) {
|
||||
11> return
|
||||
12> <IFoo>
|
||||
13> (
|
||||
14> {}
|
||||
15> )
|
||||
16>
|
||||
17>
|
||||
18> }
|
||||
19>
|
||||
20>
|
||||
21> }
|
||||
22> ;
|
||||
1->Emitted(92, 1) Source(152, 1) + SourceIndex(0)
|
||||
2 >Emitted(92, 5) Source(152, 5) + SourceIndex(0)
|
||||
3 >Emitted(92, 10) Source(152, 10) + SourceIndex(0)
|
||||
4 >Emitted(92, 13) Source(152, 40) + SourceIndex(0)
|
||||
5 >Emitted(92, 27) Source(152, 53) + SourceIndex(0)
|
||||
6 >Emitted(92, 33) Source(152, 59) + SourceIndex(0)
|
||||
7 >Emitted(92, 34) Source(152, 60) + SourceIndex(0)
|
||||
8 >Emitted(92, 44) Source(152, 69) + SourceIndex(0)
|
||||
9 >Emitted(92, 45) Source(152, 70) + SourceIndex(0)
|
||||
10>Emitted(92, 49) Source(152, 74) + SourceIndex(0)
|
||||
11>Emitted(92, 55) Source(152, 80) + SourceIndex(0)
|
||||
12>Emitted(92, 56) Source(152, 87) + SourceIndex(0)
|
||||
13>Emitted(92, 57) Source(152, 88) + SourceIndex(0)
|
||||
14>Emitted(92, 59) Source(152, 90) + SourceIndex(0)
|
||||
15>Emitted(92, 60) Source(152, 91) + SourceIndex(0)
|
||||
16>Emitted(92, 61) Source(152, 91) + SourceIndex(0)
|
||||
17>Emitted(92, 62) Source(152, 92) + SourceIndex(0)
|
||||
18>Emitted(92, 63) Source(152, 93) + SourceIndex(0)
|
||||
19>Emitted(92, 64) Source(152, 93) + SourceIndex(0)
|
||||
20>Emitted(92, 65) Source(152, 94) + SourceIndex(0)
|
||||
21>Emitted(92, 66) Source(152, 95) + SourceIndex(0)
|
||||
22>Emitted(92, 67) Source(152, 96) + SourceIndex(0)
|
||||
---
|
||||
>>>// CONTEXT: Newing a class
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1 >
|
||||
>
|
||||
>// CONTEXT: Newing a class
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Newing a class
|
||||
1 >Emitted(93, 1) Source(155, 1) + SourceIndex(0)
|
||||
2 >Emitted(93, 1) Source(154, 1) + SourceIndex(0)
|
||||
3 >Emitted(93, 27) Source(154, 27) + SourceIndex(0)
|
||||
2 >// CONTEXT: Newing a class
|
||||
1 >Emitted(93, 1) Source(154, 1) + SourceIndex(0)
|
||||
2 >Emitted(93, 27) Source(154, 27) + SourceIndex(0)
|
||||
---
|
||||
>>>var C11t5 = (function () {
|
||||
1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
1->Emitted(94, 1) Source(155, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function C11t5(f) {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
1->
|
||||
>class C11t5 {
|
||||
1->class C11t5 {
|
||||
2 > constructor(
|
||||
3 > f: (n: number) => IFoo
|
||||
1->Emitted(95, 5) Source(155, 15) + SourceIndex(0) name (C11t5)
|
||||
@@ -2448,66 +2438,65 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Type annotated expression
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^->
|
||||
1 >
|
||||
>
|
||||
>// CONTEXT: Type annotated expression
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Type annotated expression
|
||||
1 >Emitted(101, 1) Source(159, 1) + SourceIndex(0)
|
||||
2 >Emitted(101, 1) Source(158, 1) + SourceIndex(0)
|
||||
3 >Emitted(101, 38) Source(158, 38) + SourceIndex(0)
|
||||
2 >// CONTEXT: Type annotated expression
|
||||
1 >Emitted(101, 1) Source(158, 1) + SourceIndex(0)
|
||||
2 >Emitted(101, 38) Source(158, 38) + SourceIndex(0)
|
||||
---
|
||||
>>>var c12t1 = (function (s) { return s; });
|
||||
1->^^^^
|
||||
2 > ^^^^^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^
|
||||
8 > ^^^^^^
|
||||
9 > ^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^
|
||||
9 > ^^^^^^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
16> ^
|
||||
1->
|
||||
>var
|
||||
2 > c12t1
|
||||
3 > = <(s: string) => string>
|
||||
4 > (
|
||||
5 > function(
|
||||
6 > s
|
||||
7 > ) {
|
||||
8 > return
|
||||
9 >
|
||||
10> s
|
||||
11>
|
||||
12>
|
||||
13> }
|
||||
14> )
|
||||
15> ;
|
||||
1->Emitted(102, 5) Source(159, 5) + SourceIndex(0)
|
||||
2 >Emitted(102, 10) Source(159, 10) + SourceIndex(0)
|
||||
3 >Emitted(102, 13) Source(159, 37) + SourceIndex(0)
|
||||
4 >Emitted(102, 14) Source(159, 38) + SourceIndex(0)
|
||||
5 >Emitted(102, 24) Source(159, 47) + SourceIndex(0)
|
||||
6 >Emitted(102, 25) Source(159, 48) + SourceIndex(0)
|
||||
7 >Emitted(102, 29) Source(159, 52) + SourceIndex(0)
|
||||
8 >Emitted(102, 35) Source(159, 58) + SourceIndex(0)
|
||||
9 >Emitted(102, 36) Source(159, 59) + SourceIndex(0)
|
||||
10>Emitted(102, 37) Source(159, 60) + SourceIndex(0)
|
||||
11>Emitted(102, 38) Source(159, 60) + SourceIndex(0)
|
||||
12>Emitted(102, 39) Source(159, 61) + SourceIndex(0)
|
||||
13>Emitted(102, 40) Source(159, 62) + SourceIndex(0)
|
||||
14>Emitted(102, 41) Source(159, 63) + SourceIndex(0)
|
||||
15>Emitted(102, 42) Source(159, 64) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c12t1
|
||||
4 > = <(s: string) => string>
|
||||
5 > (
|
||||
6 > function(
|
||||
7 > s
|
||||
8 > ) {
|
||||
9 > return
|
||||
10>
|
||||
11> s
|
||||
12>
|
||||
13>
|
||||
14> }
|
||||
15> )
|
||||
16> ;
|
||||
1->Emitted(102, 1) Source(159, 1) + SourceIndex(0)
|
||||
2 >Emitted(102, 5) Source(159, 5) + SourceIndex(0)
|
||||
3 >Emitted(102, 10) Source(159, 10) + SourceIndex(0)
|
||||
4 >Emitted(102, 13) Source(159, 37) + SourceIndex(0)
|
||||
5 >Emitted(102, 14) Source(159, 38) + SourceIndex(0)
|
||||
6 >Emitted(102, 24) Source(159, 47) + SourceIndex(0)
|
||||
7 >Emitted(102, 25) Source(159, 48) + SourceIndex(0)
|
||||
8 >Emitted(102, 29) Source(159, 52) + SourceIndex(0)
|
||||
9 >Emitted(102, 35) Source(159, 58) + SourceIndex(0)
|
||||
10>Emitted(102, 36) Source(159, 59) + SourceIndex(0)
|
||||
11>Emitted(102, 37) Source(159, 60) + SourceIndex(0)
|
||||
12>Emitted(102, 38) Source(159, 60) + SourceIndex(0)
|
||||
13>Emitted(102, 39) Source(159, 61) + SourceIndex(0)
|
||||
14>Emitted(102, 40) Source(159, 62) + SourceIndex(0)
|
||||
15>Emitted(102, 41) Source(159, 63) + SourceIndex(0)
|
||||
16>Emitted(102, 42) Source(159, 64) + SourceIndex(0)
|
||||
---
|
||||
>>>var c12t2 = ({
|
||||
1 >
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [tests/cases/compiler/declarationEmit_exportAssignment.ts] ////
|
||||
|
||||
//// [utils.ts]
|
||||
|
||||
export function foo() { }
|
||||
export function bar() { }
|
||||
export interface Buzz { }
|
||||
|
||||
//// [index.ts]
|
||||
import {foo} from "utils";
|
||||
export = foo;
|
||||
|
||||
//// [utils.js]
|
||||
function foo() { }
|
||||
exports.foo = foo;
|
||||
function bar() { }
|
||||
exports.bar = bar;
|
||||
//// [index.js]
|
||||
var utils_1 = require("utils");
|
||||
module.exports = utils_1.foo;
|
||||
|
||||
|
||||
//// [utils.d.ts]
|
||||
export declare function foo(): void;
|
||||
export declare function bar(): void;
|
||||
export interface Buzz {
|
||||
}
|
||||
//// [index.d.ts]
|
||||
import { foo } from "utils";
|
||||
export = foo;
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : Symbol(foo, Decl(utils.ts, 0, 0))
|
||||
|
||||
export function bar() { }
|
||||
>bar : Symbol(bar, Decl(utils.ts, 1, 25))
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo} from "utils";
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
|
||||
export = foo;
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : () => void
|
||||
|
||||
export function bar() { }
|
||||
>bar : () => void
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Buzz
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo} from "utils";
|
||||
>foo : () => void
|
||||
|
||||
export = foo;
|
||||
>foo : () => void
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [tests/cases/compiler/declarationEmit_exportDeclaration.ts] ////
|
||||
|
||||
//// [utils.ts]
|
||||
|
||||
export function foo() { }
|
||||
export function bar() { }
|
||||
export interface Buzz { }
|
||||
|
||||
//// [index.ts]
|
||||
import {foo, bar, Buzz} from "utils";
|
||||
|
||||
foo();
|
||||
let obj: Buzz;
|
||||
export {bar};
|
||||
|
||||
//// [utils.js]
|
||||
function foo() { }
|
||||
exports.foo = foo;
|
||||
function bar() { }
|
||||
exports.bar = bar;
|
||||
//// [index.js]
|
||||
var utils_1 = require("utils");
|
||||
exports.bar = utils_1.bar;
|
||||
utils_1.foo();
|
||||
var obj;
|
||||
|
||||
|
||||
//// [utils.d.ts]
|
||||
export declare function foo(): void;
|
||||
export declare function bar(): void;
|
||||
export interface Buzz {
|
||||
}
|
||||
//// [index.d.ts]
|
||||
import { bar } from "utils";
|
||||
export { bar };
|
||||
@@ -0,0 +1,27 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : Symbol(foo, Decl(utils.ts, 0, 0))
|
||||
|
||||
export function bar() { }
|
||||
>bar : Symbol(bar, Decl(utils.ts, 1, 25))
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo, bar, Buzz} from "utils";
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
>bar : Symbol(bar, Decl(index.ts, 0, 12))
|
||||
>Buzz : Symbol(Buzz, Decl(index.ts, 0, 17))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
|
||||
let obj: Buzz;
|
||||
>obj : Symbol(obj, Decl(index.ts, 3, 3))
|
||||
>Buzz : Symbol(Buzz, Decl(index.ts, 0, 17))
|
||||
|
||||
export {bar};
|
||||
>bar : Symbol(bar, Decl(index.ts, 4, 8))
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : () => void
|
||||
|
||||
export function bar() { }
|
||||
>bar : () => void
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Buzz
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo, bar, Buzz} from "utils";
|
||||
>foo : () => void
|
||||
>bar : () => void
|
||||
>Buzz : any
|
||||
|
||||
foo();
|
||||
>foo() : void
|
||||
>foo : () => void
|
||||
|
||||
let obj: Buzz;
|
||||
>obj : Buzz
|
||||
>Buzz : Buzz
|
||||
|
||||
export {bar};
|
||||
>bar : () => void
|
||||
|
||||
@@ -34,6 +34,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var service_1 = require("./service");
|
||||
var MyComponent = (function () {
|
||||
function MyComponent(Service) {
|
||||
this.Service = Service;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [decoratorMetadataWithConstructorType.ts]
|
||||
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
};
|
||||
|
||||
class A {
|
||||
constructor() { console.log('new A'); }
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
}
|
||||
|
||||
export class B {
|
||||
@decorator
|
||||
x: A = new A();
|
||||
}
|
||||
|
||||
|
||||
//// [decoratorMetadataWithConstructorType.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
console.log('new A');
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
function decorator(target, propertyKey) {
|
||||
}
|
||||
var B = (function () {
|
||||
function B() {
|
||||
this.x = new A();
|
||||
}
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', A)
|
||||
], B.prototype, "x");
|
||||
return B;
|
||||
})();
|
||||
exports.B = B;
|
||||
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/compiler/decoratorMetadataWithConstructorType.ts ===
|
||||
|
||||
declare var console: {
|
||||
>console : Symbol(console, Decl(decoratorMetadataWithConstructorType.ts, 1, 11))
|
||||
|
||||
log(msg: string): void;
|
||||
>log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22))
|
||||
>msg : Symbol(msg, Decl(decoratorMetadataWithConstructorType.ts, 2, 8))
|
||||
|
||||
};
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2))
|
||||
|
||||
constructor() { console.log('new A'); }
|
||||
>console.log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22))
|
||||
>console : Symbol(console, Decl(decoratorMetadataWithConstructorType.ts, 1, 11))
|
||||
>log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22))
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
>decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1))
|
||||
>target : Symbol(target, Decl(decoratorMetadataWithConstructorType.ts, 9, 19))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
||||
>propertyKey : Symbol(propertyKey, Decl(decoratorMetadataWithConstructorType.ts, 9, 34))
|
||||
}
|
||||
|
||||
export class B {
|
||||
>B : Symbol(B, Decl(decoratorMetadataWithConstructorType.ts, 10, 1))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1))
|
||||
|
||||
x: A = new A();
|
||||
>x : Symbol(x, Decl(decoratorMetadataWithConstructorType.ts, 12, 16))
|
||||
>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2))
|
||||
>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
=== tests/cases/compiler/decoratorMetadataWithConstructorType.ts ===
|
||||
|
||||
declare var console: {
|
||||
>console : { log(msg: string): void; }
|
||||
|
||||
log(msg: string): void;
|
||||
>log : (msg: string) => void
|
||||
>msg : string
|
||||
|
||||
};
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
constructor() { console.log('new A'); }
|
||||
>console.log('new A') : void
|
||||
>console.log : (msg: string) => void
|
||||
>console : { log(msg: string): void; }
|
||||
>log : (msg: string) => void
|
||||
>'new A' : string
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
>decorator : (target: Object, propertyKey: string) => void
|
||||
>target : Object
|
||||
>Object : Object
|
||||
>propertyKey : string
|
||||
}
|
||||
|
||||
export class B {
|
||||
>B : B
|
||||
|
||||
@decorator
|
||||
>decorator : (target: Object, propertyKey: string) => void
|
||||
|
||||
x: A = new A();
|
||||
>x : A
|
||||
>A : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import {db} from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db;
|
||||
|
||||
constructor(db: db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db} from './db';
|
||||
>db : Symbol(db, Decl(service.ts, 0, 8))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: db;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 8))
|
||||
|
||||
constructor(db: db) {
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 8))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db} from './db';
|
||||
>db : typeof db
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: db;
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
constructor(db: db) {
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : db
|
||||
>this.db : db
|
||||
>this : MyClass
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : db
|
||||
>this : MyClass
|
||||
>db : db
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import {db as Database} from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: Database;
|
||||
|
||||
constructor(db: Database) { // no collision
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db as Database} from './db';
|
||||
>db : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
>Database : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: Database;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>Database : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
|
||||
constructor(db: Database) { // no collision
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>Database : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db as Database} from './db';
|
||||
>db : typeof Database
|
||||
>Database : typeof Database
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: Database;
|
||||
>db : Database
|
||||
>Database : Database
|
||||
|
||||
constructor(db: Database) { // no collision
|
||||
>db : Database
|
||||
>Database : Database
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : Database
|
||||
>this.db : Database
|
||||
>this : MyClass
|
||||
>db : Database
|
||||
>db : Database
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : Database
|
||||
>this : MyClass
|
||||
>db : Database
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision3.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import db = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db;
|
||||
|
||||
constructor(db: db.db) { // collision with namespace of external module db
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import db = require('./db');
|
||||
>db : Symbol(db, Decl(service.ts, 0, 0))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: db.db;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 0))
|
||||
>db : Symbol(db.db, Decl(db.ts, 0, 0))
|
||||
|
||||
constructor(db: db.db) { // collision with namespace of external module db
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 0))
|
||||
>db : Symbol(db.db, Decl(db.ts, 0, 0))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import db = require('./db');
|
||||
>db : typeof db
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: db.db;
|
||||
>db : db.db
|
||||
>db : any
|
||||
>db : db.db
|
||||
|
||||
constructor(db: db.db) { // collision with namespace of external module db
|
||||
>db : db.db
|
||||
>db : any
|
||||
>db : db.db
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : db.db
|
||||
>this.db : db.db
|
||||
>this : MyClass
|
||||
>db : db.db
|
||||
>db : db.db
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : db.db
|
||||
>this : MyClass
|
||||
>db : db.db
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
tests/cases/compiler/service.ts(1,8): error TS1192: Module '"tests/cases/compiler/db"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/db.ts (0 errors) ====
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/service.ts (1 errors) ====
|
||||
import db from './db'; // error no default export
|
||||
~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/db"' has no default export.
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db;
|
||||
|
||||
constructor(db: db.db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision4.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import db from './db'; // error no default export
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db;
|
||||
|
||||
constructor(db: db.db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db'); // error no default export
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user