Merge branch 'master' into importDeclarationAndDecorator

This commit is contained in:
Sheetal Nandi 2015-08-24 11:04:08 -07:00
commit 8c7a634814
102 changed files with 38754 additions and 33113 deletions

2665
lib/lib.core.d.ts vendored

File diff suppressed because it is too large Load Diff

5348
lib/lib.core.es6.d.ts vendored

File diff suppressed because it is too large Load Diff

475
lib/lib.d.ts vendored
View File

@ -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
/////////////////////////////

2337
lib/lib.dom.d.ts vendored

File diff suppressed because it is too large Load Diff

5384
lib/lib.es6.d.ts vendored

File diff suppressed because it is too large Load Diff

2450
lib/lib.webworker.d.ts vendored

File diff suppressed because it is too large Load Diff

9082
lib/tsc.js

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

643
lib/typescript.d.ts vendored
View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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,9 +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: ts.LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
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;
@ -1490,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;
@ -1560,6 +1576,7 @@ declare namespace ts {
getConstructSignatures(): Signature[];
getStringIndexType(): Type;
getNumberIndexType(): Type;
getBaseTypes(): ObjectType[];
}
interface Signature {
getDeclaration(): SignatureDeclaration;
@ -1601,6 +1618,7 @@ declare namespace ts {
interface PreProcessedFileInfo {
referencedFiles: FileReference[];
importedFiles: FileReference[];
ambientExternalModules: string[];
isLibFile: boolean;
}
interface HostCancellationToken {
@ -1621,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;
@ -1661,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;
@ -1697,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;
@ -1717,6 +1742,7 @@ declare namespace ts {
const writtenReference: string;
}
interface HighlightSpan {
fileName?: string;
textSpan: TextSpan;
kind: string;
}
@ -1744,6 +1770,7 @@ declare namespace ts {
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
@ -1986,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;
@ -2072,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;

File diff suppressed because it is too large Load Diff

View File

@ -49,5 +49,5 @@
"fs": false,
"os": false,
"path": false
}
}
}

View File

@ -388,7 +388,7 @@ namespace ts {
return node1.pos <= node2.pos;
}
if (!compilerOptions.out) {
if (!compilerOptions.outFile && !compilerOptions.out) {
return true;
}

View File

@ -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,

View File

@ -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)),

View File

@ -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,7 +561,6 @@ 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." },

View File

@ -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,7 +2250,7 @@
"category": "Message",
"code": 6068
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
"code": 7005

View File

@ -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);
}
}
@ -1519,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) {
@ -6512,9 +6518,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;
@ -6537,19 +6543,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 &nbsp;
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 {
@ -6557,7 +6576,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
case JsxEmit.Preserve:
default:
return getTextOfNode(node, true);
return getTextOfNode(node, /*includeTrivia*/ true);
}
}
@ -6565,13 +6584,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;
}
}
@ -7138,4 +7157,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
}
}

View File

@ -5831,7 +5831,6 @@ namespace ts {
if (!name) {
parseErrorAtPosition(pos, 0, Diagnostics.Identifier_expected);
return undefined;
}
let preName: Identifier, postName: Identifier;

View File

@ -413,7 +413,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();
@ -794,27 +794,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"));
}
}
@ -825,18 +829,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) {
@ -866,7 +875,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
@ -886,18 +895,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 &&

View File

@ -1411,6 +1411,7 @@ namespace ts {
/* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
}
/* @internal */
export interface TypeCheckerHost {
getCompilerOptions(): CompilerOptions;
@ -2032,6 +2033,7 @@ namespace ts {
noLib?: boolean;
noResolve?: boolean;
out?: string;
outFile?: string;
outDir?: string;
preserveConstEnums?: boolean;
project?: string;

View File

@ -978,6 +978,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);
@ -1766,7 +1767,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");

View File

@ -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;
}
}
}
@ -358,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,
@ -536,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");
});
}
@ -1247,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;
@ -1298,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()));
});
}
}
@ -1872,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) + "'";
}
}
@ -2383,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);
@ -2405,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);

View File

@ -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; }) {
@ -895,7 +921,7 @@ module Harness {
let newLine =
newLineKind === ts.NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed :
newLineKind === ts.NewLineKind.LineFeed ? lineFeed :
ts.sys.newLine;
Harness.IO.newLine();
return {
getCurrentDirectory,
@ -988,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[] = [];
@ -1006,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) {
@ -1091,6 +1115,10 @@ module Harness {
options.out = setting.value;
break;
case "outfile":
options.outFile = setting.value;
break;
case "outdiroption":
case "outdir":
options.outDir = setting.value;
@ -1229,7 +1257,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(), "");
@ -1241,7 +1270,7 @@ module Harness {
}
else {
// Goes to single --out file
sourceFileName = options.out;
sourceFileName = outFile;
}
let dTsFileName = ts.removeFileExtension(sourceFileName) + ".d.ts";
@ -1273,7 +1302,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;
@ -1286,7 +1315,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")
@ -1383,7 +1412,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 {
@ -1719,7 +1748,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";

View File

@ -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,10 +158,10 @@ 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,
noResolve: testCase.noResolve,
rootDir: testCase.rootDir
@ -190,8 +190,8 @@ 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)
};
@ -216,7 +216,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));
}
@ -263,14 +263,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 });
}
@ -299,7 +299,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);
@ -391,7 +391,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;

View File

@ -106,6 +106,4 @@ if (runners.length === 0) {
// runners.push(new GeneratedFourslashRunner());
}
ts.sys.newLine = "\r\n";
runTests(runners);

View File

@ -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;
@ -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;

View File

@ -224,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);
@ -345,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;
@ -352,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() {
@ -423,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 = "";
@ -517,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);
}
@ -593,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++) {
@ -647,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[] = [];
@ -736,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();
@ -857,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
@ -959,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();
}
}
}

View File

@ -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

View File

@ -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]) {

View File

@ -132,6 +132,46 @@ namespace ts {
let scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
let emptyArray: any[] = [];
const jsDocTagNames = [
"augments",
"author",
"argument",
"borrows",
"class",
"constant",
"constructor",
"constructs",
"default",
"deprecated",
"description",
"event",
"example",
"extends",
"field",
"fileOverview",
"function",
"ignore",
"inner",
"lends",
"link",
"memberOf",
"name",
"namespace",
"param",
"private",
"property",
"public",
"requires",
"returns",
"see",
"since",
"static",
"throws",
"type",
"version"
];
let jsDocCompletionEntries: CompletionEntry[];
function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject {
let node = <NodeObject> new (getNodeConstructor(kind))();
@ -2971,6 +3011,8 @@ namespace ts {
let sourceFile = getValidSourceFile(fileName);
let isJavaScriptFile = isJavaScript(fileName);
let isJsDocTagName = false;
let start = new Date().getTime();
let currentToken = getTokenAtPosition(sourceFile, position);
log("getCompletionData: Get current token: " + (new Date().getTime() - start));
@ -2981,8 +3023,44 @@ namespace ts {
log("getCompletionData: Is inside comment: " + (new Date().getTime() - start));
if (insideComment) {
log("Returning an empty list because completion was inside a comment.");
return undefined;
// The current position is next to the '@' sign, when no tag name being provided yet.
// Provide a full list of tag names
if (hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === CharacterCodes.at) {
isJsDocTagName = true;
}
// Completion should work inside certain JsDoc tags. For example:
// /** @type {number | string} */
// Completion should work in the brackets
let insideJsDocTagExpression = false;
let tag = getJsDocTagAtPosition(sourceFile, position);
if (tag) {
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
isJsDocTagName = true;
}
switch (tag.kind) {
case SyntaxKind.JSDocTypeTag:
case SyntaxKind.JSDocParameterTag:
case SyntaxKind.JSDocReturnTag:
let tagWithExpression = <JSDocTypeTag | JSDocParameterTag | JSDocReturnTag>tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
}
break;
}
}
if (isJsDocTagName) {
return { symbols: undefined, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName };
}
if (!insideJsDocTagExpression) {
// Proceed if the current position is in jsDoc tag expression; otherwise it is a normal
// comment or the plain text part of a jsDoc comment, so no completion should be available
log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
return undefined;
}
}
start = new Date().getTime();
@ -3068,7 +3146,7 @@ namespace ts {
log("getCompletionData: Semantic work: " + (new Date().getTime() - semanticStart));
return { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot: (isRightOfDot || isRightOfOpenTag) };
return { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName };
function getTypeScriptMemberSymbols(): void {
// Right of dot member completion list
@ -3708,9 +3786,14 @@ namespace ts {
return undefined;
}
let { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot } = completionData;
let { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData;
let entries: CompletionEntry[];
if (isJsDocTagName) {
// If the current position is a jsDoc tag name, only tag names should be provided for completion
return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() };
}
if (isRightOfDot && isJavaScript(fileName)) {
entries = getCompletionEntriesFromSymbols(symbols);
addRange(entries, getJavaScriptCompletionEntries());
@ -3724,7 +3807,7 @@ namespace ts {
}
// Add keywords if this is not a member completion list
if (!isMemberCompletion) {
if (!isMemberCompletion && !isJsDocTagName) {
addRange(entries, keywordCompletions);
}
@ -3757,6 +3840,17 @@ namespace ts {
return entries;
}
function getAllJsDocCompletionEntries(): CompletionEntry[] {
return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, tagName => {
return {
name: tagName,
kind: ScriptElementKind.keyword,
kindModifiers: "",
sortText: "0",
}
}));
}
function createCompletionEntry(symbol: Symbol, location: Node): CompletionEntry {
// Try to get a valid display name for this symbol, if we could not find one, then ignore it.
// We would like to only show things that can be added after a dot, so for instance numeric properties can

View File

@ -1097,4 +1097,4 @@ module TypeScript.Services {
}
/* @internal */
let toolsVersion = "1.5";
const toolsVersion = "1.6";

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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))
}

View File

@ -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
}

View File

@ -0,0 +1,26 @@
EmitSkipped: false
FileName : outFile.js
var x = 5;
var Bar = (function () {
function Bar() {
}
return Bar;
})();
var x1 = "hello world";
var Foo = (function () {
function Foo() {
}
return Foo;
})();
FileName : outFile.d.ts
declare var x: number;
declare class Bar {
x: string;
y: number;
}
declare var x1: string;
declare class Foo {
x: string;
y: number;
}

View File

@ -0,0 +1,26 @@
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile1.js.map
{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["inputFile1.ts"],"names":["Bar","Bar.constructor"],"mappings":"AAAA,kBAAkB;AACjB,IAAI,CAAC,GAAW,CAAC,CAAC;AAClB;IAAAA;IAGAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile1.js
// regular ts file
var t = 5;
var Bar = (function () {
function Bar() {
}
return Bar;
})();
//# sourceMappingURL=inputFile1.js.mapFileName : tests/cases/fourslash/inputFile1.d.ts
declare var t: number;
declare class Bar {
x: string;
y: number;
}
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile2.jsx.map
{"version":3,"file":"inputFile2.jsx","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.jsx
var y = "my div";
var x = <div name={y}/>;
//# sourceMappingURL=inputFile2.jsx.mapFileName : tests/cases/fourslash/inputFile2.d.ts
declare var y: string;
declare var x: any;

View File

@ -0,0 +1,26 @@
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile1.js.map
{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["inputFile1.ts"],"names":["Bar","Bar.constructor"],"mappings":"AAAA,kBAAkB;AACjB,IAAI,CAAC,GAAW,CAAC,CAAC;AAClB;IAAAA;IAGAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile1.js
// regular ts file
var t = 5;
var Bar = (function () {
function Bar() {
}
return Bar;
})();
//# sourceMappingURL=inputFile1.js.mapFileName : tests/cases/fourslash/inputFile1.d.ts
declare var t: number;
declare class Bar {
x: string;
y: number;
}
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile2.js.map
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,qBAAC,GAAG,KAAC,IAAI,GAAG,CAAE,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.js
var y = "my div";
var x = React.createElement("div", {"name": y});
//# sourceMappingURL=inputFile2.js.mapFileName : tests/cases/fourslash/inputFile2.d.ts
declare var y: string;
declare var x: any;

View File

@ -1,12 +1,12 @@
error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
tests/cases/compiler/inlineSourceMap2.ts(5,1): error TS2304: Cannot find name 'console'.
!!! error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
!!! error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
!!! error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.
==== tests/cases/compiler/inlineSourceMap2.ts (1 errors) ====
// configuration errors

View File

@ -1,7 +1,7 @@
error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'.
error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'.
!!! error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'.
!!! error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/isolatedModulesDeclaration.ts (0 errors) ====
export var x;

View File

@ -1,7 +1,7 @@
error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
!!! error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
!!! error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/isolatedModulesNoEmitOnError.ts (0 errors) ====
export var x;

View File

@ -1,8 +1,8 @@
error TS5046: Option 'out' cannot be specified with option 'isolatedModules'.
error TS5053: Option 'out' cannot be specified with option 'isolatedModules'.
tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
!!! error TS5046: Option 'out' cannot be specified with option 'isolatedModules'.
!!! error TS5053: Option 'out' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/file1.ts (0 errors) ====
export var x;

View File

@ -3,18 +3,21 @@ var t02 = <a>{0}#</a>;
>t02 : any
><a>{0}#</a> : any
>a : any
>0 : number
>a : any
var t03 = <a>#{0}</a>;
>t03 : any
><a>#{0}</a> : any
>a : any
>0 : number
>a : any
var t04 = <a>#{0}#</a>;
>t04 : any
><a>#{0}#</a> : any
>a : any
>0 : number
>a : any
var t05 = <a>#<i></i></a>;

View File

@ -9,6 +9,7 @@ let x = Test; // emit test_1.default
<anything attr={Test} />; // ?
>attr : Symbol(unknown)
>Test : Symbol(Test, Decl(consumer.tsx, 1, 6))
=== tests/cases/compiler/component.d.ts ===

View File

@ -11,7 +11,7 @@ let x = Test; // emit test_1.default
><anything attr={Test} /> : any
>anything : any
>attr : any
>Test : any
>Test : typeof Test
=== tests/cases/compiler/component.d.ts ===

View File

@ -46,6 +46,8 @@ declare var hasOwnProperty:any;
<div><br /></div>
<Component>{foo}<br />{bar}</Component>
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>foo : Symbol(foo, Decl(jsxReactTestSuite.tsx, 7, 11))
>bar : Symbol(bar, Decl(jsxReactTestSuite.tsx, 8, 11))
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
<br />
@ -159,6 +161,7 @@ var x =
<Component x={y} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11))
<x-component />;

View File

@ -251,6 +251,7 @@ var x =
>y : any
={2 } z />;
>2 : number
>z : any
<Component
@ -287,18 +288,21 @@ var x =
>Component : any
>x : any
>y : any
>2 : number
<Component { ... x } y={2} z />;
><Component { ... x } y={2} z /> : any
>Component : any
>x : any
>y : any
>2 : number
>z : any
<Component x={1} {...y} />;
><Component x={1} {...y} /> : any
>Component : any
>x : any
>1 : number
>y : any
@ -306,6 +310,7 @@ var x =
><Component x={1} y="2" {...z} {...z}><Child /></Component> : any
>Component : any
>x : any
>1 : number
>y : any
>z : any
>z : any
@ -326,6 +331,7 @@ var x =
>2 : number
>z : any
>z : any
>3 : number
>Component : any

View File

@ -0,0 +1,27 @@
//// [tests/cases/compiler/out-flag2.ts] ////
//// [a.ts]
class A { }
//// [b.ts]
class B { }
//// [c.js]
var A = (function () {
function A() {
}
return A;
})();
var B = (function () {
function B() {
}
return B;
})();
//# sourceMappingURL=c.js.map
//// [c.d.ts]
declare class A {
}
declare class B {
}

View File

@ -0,0 +1,2 @@
//// [c.js.map]
{"version":3,"file":"c.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":"AACA;IAAAA;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW;ACDX;IAAAE;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW"}

View File

@ -0,0 +1,104 @@
===================================================================
JsFile: c.js
mapUrl: c.js.map
sourceRoot:
sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts
===================================================================
-------------------------------------------------------------------
emittedFile:c.js
sourceFile:tests/cases/compiler/a.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->
1->Emitted(2, 5) Source(2, 1) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^->
1->class A {
2 > }
1->Emitted(3, 5) Source(2, 11) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(2, 12) + SourceIndex(0) name (A.constructor)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
2 > }
1->Emitted(4, 5) Source(2, 11) + SourceIndex(0) name (A)
2 >Emitted(4, 13) Source(2, 12) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A { }
1 >Emitted(5, 1) Source(2, 11) + SourceIndex(0) name (A)
2 >Emitted(5, 2) Source(2, 12) + SourceIndex(0) name (A)
3 >Emitted(5, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(5, 6) Source(2, 12) + SourceIndex(0)
---
-------------------------------------------------------------------
emittedFile:c.js
sourceFile:tests/cases/compiler/b.ts
-------------------------------------------------------------------
>>>var B = (function () {
1->
2 >^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(6, 1) Source(1, 1) + SourceIndex(1)
---
>>> function B() {
1->^^^^
2 > ^^->
1->
1->Emitted(7, 5) Source(1, 1) + SourceIndex(1) name (B)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^->
1->class B {
2 > }
1->Emitted(8, 5) Source(1, 11) + SourceIndex(1) name (B.constructor)
2 >Emitted(8, 6) Source(1, 12) + SourceIndex(1) name (B.constructor)
---
>>> return B;
1->^^^^
2 > ^^^^^^^^
1->
2 > }
1->Emitted(9, 5) Source(1, 11) + SourceIndex(1) name (B)
2 >Emitted(9, 13) Source(1, 12) + SourceIndex(1) name (B)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class B { }
1 >Emitted(10, 1) Source(1, 11) + SourceIndex(1) name (B)
2 >Emitted(10, 2) Source(1, 12) + SourceIndex(1) name (B)
3 >Emitted(10, 2) Source(1, 1) + SourceIndex(1)
4 >Emitted(10, 6) Source(1, 12) + SourceIndex(1)
---
>>>//# sourceMappingURL=c.js.map

View File

@ -0,0 +1,9 @@
=== tests/cases/compiler/a.ts ===
class A { }
>A : Symbol(A, Decl(a.ts, 0, 0))
=== tests/cases/compiler/b.ts ===
class B { }
>B : Symbol(B, Decl(b.ts, 0, 0))

View File

@ -0,0 +1,9 @@
=== tests/cases/compiler/a.ts ===
class A { }
>A : A
=== tests/cases/compiler/b.ts ===
class B { }
>B : B

View File

@ -0,0 +1,12 @@
error TS5053: Option 'out' cannot be specified with option 'outFile'.
!!! error TS5053: Option 'out' cannot be specified with option 'outFile'.
==== tests/cases/compiler/a.ts (0 errors) ====
// --out and --outFile error
class A { }
==== tests/cases/compiler/b.ts (0 errors) ====
class B { }

View File

@ -0,0 +1,30 @@
//// [tests/cases/compiler/out-flag3.ts] ////
//// [a.ts]
// --out and --outFile error
class A { }
//// [b.ts]
class B { }
//// [c.js]
// --out and --outFile error
var A = (function () {
function A() {
}
return A;
})();
var B = (function () {
function B() {
}
return B;
})();
//# sourceMappingURL=c.js.map
//// [c.d.ts]
declare class A {
}
declare class B {
}

View File

@ -0,0 +1,2 @@
//// [c.js.map]
{"version":3,"file":"c.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":"AACA,4BAA4B;AAE5B;IAAAA;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW;ACHX;IAAAE;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW"}

View File

@ -0,0 +1,114 @@
===================================================================
JsFile: c.js
mapUrl: c.js.map
sourceRoot:
sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts
===================================================================
-------------------------------------------------------------------
emittedFile:c.js
sourceFile:tests/cases/compiler/a.ts
-------------------------------------------------------------------
>>>// --out and --outFile error
1 >
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 >
>
2 >// --out and --outFile error
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(1, 29) Source(2, 29) + SourceIndex(0)
---
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
>
1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->
1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^->
1->class A {
2 > }
1->Emitted(4, 5) Source(4, 11) + SourceIndex(0) name (A.constructor)
2 >Emitted(4, 6) Source(4, 12) + SourceIndex(0) name (A.constructor)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
2 > }
1->Emitted(5, 5) Source(4, 11) + SourceIndex(0) name (A)
2 >Emitted(5, 13) Source(4, 12) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A { }
1 >Emitted(6, 1) Source(4, 11) + SourceIndex(0) name (A)
2 >Emitted(6, 2) Source(4, 12) + SourceIndex(0) name (A)
3 >Emitted(6, 2) Source(4, 1) + SourceIndex(0)
4 >Emitted(6, 6) Source(4, 12) + SourceIndex(0)
---
-------------------------------------------------------------------
emittedFile:c.js
sourceFile:tests/cases/compiler/b.ts
-------------------------------------------------------------------
>>>var B = (function () {
1->
2 >^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(7, 1) Source(1, 1) + SourceIndex(1)
---
>>> function B() {
1->^^^^
2 > ^^->
1->
1->Emitted(8, 5) Source(1, 1) + SourceIndex(1) name (B)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^->
1->class B {
2 > }
1->Emitted(9, 5) Source(1, 11) + SourceIndex(1) name (B.constructor)
2 >Emitted(9, 6) Source(1, 12) + SourceIndex(1) name (B.constructor)
---
>>> return B;
1->^^^^
2 > ^^^^^^^^
1->
2 > }
1->Emitted(10, 5) Source(1, 11) + SourceIndex(1) name (B)
2 >Emitted(10, 13) Source(1, 12) + SourceIndex(1) name (B)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class B { }
1 >Emitted(11, 1) Source(1, 11) + SourceIndex(1) name (B)
2 >Emitted(11, 2) Source(1, 12) + SourceIndex(1) name (B)
3 >Emitted(11, 2) Source(1, 1) + SourceIndex(1)
4 >Emitted(11, 6) Source(1, 12) + SourceIndex(1)
---
>>>//# sourceMappingURL=c.js.map

View File

@ -1,9 +1,9 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View File

@ -1,9 +1,9 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View File

@ -1,7 +1,7 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View File

@ -1,7 +1,7 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View File

@ -1,7 +1,7 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View File

@ -1,7 +1,7 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {

View File

@ -25,4 +25,5 @@ var obj1: Obj1;
><obj1 x={10} /> : JSX.Element
>obj1 : Obj1
>x : any
>10 : number

View File

@ -20,4 +20,5 @@ var obj1: Obj1;
><obj1 x={10} /> : JSX.Element
>obj1 : Obj1
>x : any
>10 : number

View File

@ -67,4 +67,5 @@ var Obj3: Obj3;
><Obj3 x={42} /> : JSX.Element
>Obj3 : Obj3
>x : any
>42 : number

View File

@ -52,6 +52,7 @@ var selfClosed7 = <div x={p} y='p' />;
>selfClosed7 : Symbol(selfClosed7, Decl(tsxEmit1.tsx, 14, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>y : Symbol(unknown)
var openClosed1 = <div></div>;
@ -69,6 +70,7 @@ var openClosed3 = <div n='m'>{p}</div>;
>openClosed3 : Symbol(openClosed3, Decl(tsxEmit1.tsx, 18, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>n : Symbol(unknown)
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
var openClosed4 = <div n='m'>{p < p}</div>;
@ -146,6 +148,7 @@ var whitespace1 = <div> </div>;
var whitespace2 = <div> {p} </div>;
>whitespace2 : Symbol(whitespace2, Decl(tsxEmit1.tsx, 35, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
var whitespace3 = <div>
@ -153,6 +156,8 @@ var whitespace3 = <div>
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
{p}
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))

View File

@ -45,6 +45,7 @@ var selfClosed5 = <div x={0} y='0' />;
><div x={0} y='0' /> : JSX.Element
>div : any
>x : any
>0 : number
>y : any
var selfClosed6 = <div x={"1"} y='0' />;
@ -52,6 +53,7 @@ var selfClosed6 = <div x={"1"} y='0' />;
><div x={"1"} y='0' /> : JSX.Element
>div : any
>x : any
>"1" : string
>y : any
var selfClosed7 = <div x={p} y='p' />;

View File

@ -21,29 +21,38 @@ var p1, p2, p3;
var spreads1 = <div {...p1}>{p2}</div>;
>spreads1 : Symbol(spreads1, Decl(tsxEmit2.tsx, 8, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
var spreads2 = <div {...p1}>{p2}</div>;
>spreads2 : Symbol(spreads2, Decl(tsxEmit2.tsx, 9, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
var spreads3 = <div x={p3} {...p1}>{p2}</div>;
>spreads3 : Symbol(spreads3, Decl(tsxEmit2.tsx, 10, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11))
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
var spreads4 = <div {...p1} x={p3} >{p2}</div>;
>spreads4 : Symbol(spreads4, Decl(tsxEmit2.tsx, 11, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11))
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
>spreads5 : Symbol(spreads5, Decl(tsxEmit2.tsx, 12, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>y : Symbol(unknown)
>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11))
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))

View File

@ -20,6 +20,7 @@ declare var Foo, React;
<Foo handler={Main}></Foo>;
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
>handler : Symbol(unknown)
>Main : Symbol(Main, Decl(app.tsx, 0, 6))
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
// Should see mod_1['default'] in emit here

View File

@ -69,6 +69,6 @@ var SomeClass = (function () {
};
return SomeClass;
})();
var whitespace1 = React.createElement("div", null);
var whitespace2 = React.createElement("div", null, p);
var whitespace1 = React.createElement("div", null, " ");
var whitespace2 = React.createElement("div", null, " ", p, " ");
var whitespace3 = React.createElement("div", null, p);

View File

@ -54,6 +54,7 @@ var selfClosed7 = <div x={p} y='p' b />;
>selfClosed7 : Symbol(selfClosed7, Decl(tsxReactEmit1.tsx, 15, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))
>x : Symbol(unknown)
>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3))
>y : Symbol(unknown)
>b : Symbol(unknown)
@ -72,6 +73,7 @@ var openClosed3 = <div n='m'>{p}</div>;
>openClosed3 : Symbol(openClosed3, Decl(tsxReactEmit1.tsx, 19, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))
>n : Symbol(unknown)
>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))
var openClosed4 = <div n='m'>{p < p}</div>;
@ -150,6 +152,7 @@ var whitespace1 = <div> </div>;
var whitespace2 = <div> {p} </div>;
>whitespace2 : Symbol(whitespace2, Decl(tsxReactEmit1.tsx, 36, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))
>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))
var whitespace3 = <div>
@ -157,6 +160,8 @@ var whitespace3 = <div>
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))
{p}
>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3))
</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22))

View File

@ -47,6 +47,7 @@ var selfClosed5 = <div x={0} y='0' />;
><div x={0} y='0' /> : JSX.Element
>div : any
>x : any
>0 : number
>y : any
var selfClosed6 = <div x={"1"} y='0' />;
@ -54,6 +55,7 @@ var selfClosed6 = <div x={"1"} y='0' />;
><div x={"1"} y='0' /> : JSX.Element
>div : any
>x : any
>"1" : string
>y : any
var selfClosed7 = <div x={p} y='p' b />;

View File

@ -23,29 +23,38 @@ var p1, p2, p3;
var spreads1 = <div {...p1}>{p2}</div>;
>spreads1 : Symbol(spreads1, Decl(tsxReactEmit2.tsx, 9, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
var spreads2 = <div {...p1}>{p2}</div>;
>spreads2 : Symbol(spreads2, Decl(tsxReactEmit2.tsx, 10, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
var spreads3 = <div x={p3} {...p1}>{p2}</div>;
>spreads3 : Symbol(spreads3, Decl(tsxReactEmit2.tsx, 11, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>p3 : Symbol(p3, Decl(tsxReactEmit2.tsx, 8, 11))
>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
var spreads4 = <div {...p1} x={p3} >{p2}</div>;
>spreads4 : Symbol(spreads4, Decl(tsxReactEmit2.tsx, 12, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>p3 : Symbol(p3, Decl(tsxReactEmit2.tsx, 8, 11))
>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
>spreads5 : Symbol(spreads5, Decl(tsxReactEmit2.tsx, 13, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7))
>y : Symbol(unknown)
>p3 : Symbol(p3, Decl(tsxReactEmit2.tsx, 8, 11))
>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22))

View File

@ -8,4 +8,4 @@ declare var Foo, Bar, baz;
<Foo> <Bar> q </Bar> <Bar/> s <Bar/><Bar/></Foo>;
//// [tsxReactEmit3.js]
React.createElement(Foo, null, React.createElement(Bar, null, "q "), React.createElement(Bar, null), "s ", React.createElement(Bar, null), React.createElement(Bar, null));
React.createElement(Foo, null, " ", React.createElement(Bar, null, " q "), " ", React.createElement(Bar, null), " s ", React.createElement(Bar, null), React.createElement(Bar, null));

View File

@ -0,0 +1,14 @@
//// [tsxReactEmitEntities.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
declare var React: any;
<div>Dot goes here: &middot; &notAnEntity; </div>;
//// [tsxReactEmitEntities.js]
React.createElement("div", null, "Dot goes here: · &notAnEntity; ");

View File

@ -0,0 +1,21 @@
=== tests/cases/conformance/jsx/tsxReactEmitEntities.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxReactEmitEntities.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxReactEmitEntities.tsx, 0, 20))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxReactEmitEntities.tsx, 1, 22))
[s: string]: any;
>s : Symbol(s, Decl(tsxReactEmitEntities.tsx, 3, 3))
}
}
declare var React: any;
>React : Symbol(React, Decl(tsxReactEmitEntities.tsx, 6, 11))
<div>Dot goes here: &middot; &notAnEntity; </div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitEntities.tsx, 1, 22))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitEntities.tsx, 1, 22))

View File

@ -0,0 +1,22 @@
=== tests/cases/conformance/jsx/tsxReactEmitEntities.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
[s: string]: any;
>s : string
}
}
declare var React: any;
>React : any
<div>Dot goes here: &middot; &notAnEntity; </div>;
><div>Dot goes here: &middot; &notAnEntity; </div> : JSX.Element
>div : any
>div : any

View File

@ -57,17 +57,17 @@ var p = 0;
// WHITESPACE, DO NOT RUN 'FORMAT DOCUMENT' ON IT
var p = 0;
// Emit " "
React.createElement("div", null);
React.createElement("div", null, " ");
// Emit " ", p, " "
React.createElement("div", null, p);
React.createElement("div", null, " ", p, " ");
// Emit only p
React.createElement("div", null, p);
// Emit only p
React.createElement("div", null, p);
// Emit " 3"
React.createElement("div", null, "3");
React.createElement("div", null, " 3");
// Emit " 3 "
React.createElement("div", null, "3 ");
React.createElement("div", null, " 3 ");
// Emit "3"
React.createElement("div", null, "3");
// Emit no args

View File

@ -29,6 +29,7 @@ var p = 0;
// Emit " ", p, " "
<div> {p} </div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22))
>p : Symbol(p, Decl(tsxReactEmitWhitespace.tsx, 11, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22))
// Emit only p
@ -36,6 +37,8 @@ var p = 0;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22))
{p}
>p : Symbol(p, Decl(tsxReactEmitWhitespace.tsx, 11, 3))
</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22))
@ -44,6 +47,8 @@ var p = 0;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22))
{p}
>p : Symbol(p, Decl(tsxReactEmitWhitespace.tsx, 11, 3))
</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22))

View File

@ -32,7 +32,7 @@ var p = 0;
<div> {p} </div>;
><div> {p} </div> : JSX.Element
>div : any
>p : any
>p : number
>div : any
// Emit only p
@ -41,7 +41,7 @@ var p = 0;
>div : any
{p}
>p : any
>p : number
</div>;
>div : any
@ -52,7 +52,7 @@ var p = 0;
>div : any
{p}
>p : any
>p : number
</div>;
>div : any

View File

@ -0,0 +1,25 @@
//// [tsxReactEmitWhitespace2.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
declare var React: any;
// Emit ' word' in the last string
<div>word <code>code</code> word</div>;
// Same here
<div><code>code</code> word</div>;
// And here
<div><code /> word</div>;
//// [tsxReactEmitWhitespace2.js]
// Emit ' word' in the last string
React.createElement("div", null, "word ", React.createElement("code", null, "code"), " word");
// Same here
React.createElement("div", null, React.createElement("code", null, "code"), " word");
// And here
React.createElement("div", null, React.createElement("code", null), " word");

View File

@ -0,0 +1,38 @@
=== tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxReactEmitWhitespace2.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxReactEmitWhitespace2.tsx, 0, 20))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
[s: string]: any;
>s : Symbol(s, Decl(tsxReactEmitWhitespace2.tsx, 3, 3))
}
}
declare var React: any;
>React : Symbol(React, Decl(tsxReactEmitWhitespace2.tsx, 6, 11))
// Emit ' word' in the last string
<div>word <code>code</code> word</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
// Same here
<div><code>code</code> word</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
// And here
<div><code /> word</div>;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22))

View File

@ -0,0 +1,44 @@
=== tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
[s: string]: any;
>s : string
}
}
declare var React: any;
>React : any
// Emit ' word' in the last string
<div>word <code>code</code> word</div>;
><div>word <code>code</code> word</div> : JSX.Element
>div : any
><code>code</code> : JSX.Element
>code : any
>code : any
>div : any
// Same here
<div><code>code</code> word</div>;
><div><code>code</code> word</div> : JSX.Element
>div : any
><code>code</code> : JSX.Element
>code : any
>code : any
>div : any
// And here
<div><code /> word</div>;
><div><code /> word</div> : JSX.Element
>div : any
><code /> : JSX.Element
>code : any
>div : any

View File

@ -18,6 +18,7 @@ var thing = { oops: 100 };
var a3 = <div id={thing} />
>a3 : Symbol(a3, Decl(tsxTypeErrors.tsx, 9, 3))
>id : Symbol(unknown)
>thing : Symbol(thing, Decl(tsxTypeErrors.tsx, 8, 3))
// Mistyped html name (error)
var e1 = <imag src="bar.jpg" />

View File

@ -26,7 +26,7 @@ var a3 = <div id={thing} />
><div id={thing} /> : any
>div : any
>id : any
>thing : any
>thing : { oops: number; }
// Mistyped html name (error)
var e1 = <imag src="bar.jpg" />

View File

@ -1,9 +1,9 @@
//// [typeGuardsInIfStatement.ts]
// In the true branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when true,
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when false,
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x: number | string) {
if (typeof x === "string") {
@ -149,11 +149,11 @@ function foo12(x: number | string | boolean) {
}
//// [typeGuardsInIfStatement.js]
// In the true branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when true,
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when false,
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x) {
if (typeof x === "string") {

View File

@ -1,9 +1,9 @@
=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts ===
// In the true branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when true,
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when false,
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x: number | string) {
>foo : Symbol(foo, Decl(typeGuardsInIfStatement.ts, 0, 0))

View File

@ -1,9 +1,9 @@
=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts ===
// In the true branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when true,
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an <EFBFBD>if<EFBFBD> statement,
// the type of a variable or parameter is narrowed by any type guard in the <EFBFBD>if<EFBFBD> condition when false,
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x: number | string) {
>foo : (x: number | string) => number

View File

@ -0,0 +1,21 @@
// @noemithelpers: true
// @experimentaldecorators: true
// @emitdecoratormetadata: true
// @target: es5
// @module: commonjs
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();
}

View File

@ -0,0 +1,11 @@
// @target: ES5
// @sourcemap: true
// @declaration: true
// @module: commonjs
// @outFile: c.js
// @Filename: a.ts
class A { }
// @Filename: b.ts
class B { }

View File

@ -0,0 +1,14 @@
// @target: ES5
// @sourcemap: true
// @declaration: true
// @module: commonjs
// @outFile: c.js
// @out: d.js
// --out and --outFile error
// @Filename: a.ts
class A { }
// @Filename: b.ts
class B { }

View File

@ -1,8 +1,8 @@
// In the true branch statement of an if statement,
// the type of a variable or parameter is narrowed by any type guard in the if condition when true,
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an if statement,
// the type of a variable or parameter is narrowed by any type guard in the if condition when false,
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x: number | string) {
if (typeof x === "string") {

View File

@ -0,0 +1,11 @@
//@filename: file.tsx
//@jsx: react
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
declare var React: any;
<div>Dot goes here: &middot; &notAnEntity; </div>;

View File

@ -0,0 +1,17 @@
//@filename: file.tsx
//@jsx: react
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
declare var React: any;
// Emit ' word' in the last string
<div>word <code>code</code> word</div>;
// Same here
<div><code>code</code> word</div>;
// And here
<div><code /> word</div>;

View File

@ -0,0 +1,62 @@
///<reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: Foo.js
/////** @/*1*/ */
////var v1;
////
/////** @p/*2*/ */
////var v2;
////
/////** @param /*3*/ */
////var v3;
////
/////** @param { n/*4*/ } bar */
////var v4;
////
/////** @type { n/*5*/ } */
////var v5;
////
////// @/*6*/
////var v6;
////
////// @pa/*7*/
////var v7;
////
/////** @param { n/*8*/ } */
////var v8;
////
/////** @return { n/*9*/ } */
////var v9;
goTo.marker('1');
verify.completionListContains("constructor");
verify.completionListContains("param");
verify.completionListContains("type");
goTo.marker('2');
verify.completionListContains("constructor");
verify.completionListContains("param");
verify.completionListContains("type");
goTo.marker('3');
verify.completionListIsEmpty();
goTo.marker('4');
verify.completionListContains('number');
goTo.marker('5');
verify.completionListContains('number');
goTo.marker('6');
verify.completionListIsEmpty();
goTo.marker('7');
verify.completionListIsEmpty();
goTo.marker('8');
verify.completionListContains('number');
goTo.marker('9');
verify.completionListContains('number');

View File

@ -0,0 +1,22 @@
/// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputOutFile.baseline
// @declaration: true
// @outFile: outFile.js
// @Filename: inputFile1.ts
// @emitThisFile: true
//// var x: number = 5;
//// class Bar {
//// x : string;
//// y : number
//// }
// @Filename: inputFile2.ts
//// var x1: string = "hello world";
//// class Foo{
//// x : string;
//// y : number;
//// }
verify.baselineGetEmitOutput();

View File

@ -0,0 +1,22 @@
/// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputTsxFile_Preserve.baseline
// @declaration: true
// @sourceMap: true
// @jsx: preserve
// @Filename: inputFile1.ts
// @emitThisFile: true
////// regular ts file
//// var t: number = 5;
//// class Bar {
//// x : string;
//// y : number
//// }
// @Filename: inputFile2.tsx
// @emitThisFile: true
//// var y = "my div";
//// var x = <div name= {y} />
verify.baselineGetEmitOutput();

View File

@ -0,0 +1,22 @@
/// <reference path="fourslash.ts" />
// @BaselineFile: getEmitOutputTsxFile_React.baseline
// @declaration: true
// @sourceMap: true
// @jsx: react
// @Filename: inputFile1.ts
// @emitThisFile: true
////// regular ts file
//// var t: number = 5;
//// class Bar {
//// x : string;
//// y : number
//// }
// @Filename: inputFile2.tsx
// @emitThisFile: true
//// var y = "my div";
//// var x = <div name= {y} />
verify.baselineGetEmitOutput();

Some files were not shown because too many files have changed in this diff Show More