Merge branch 'master' into range_tests

This commit is contained in:
Andy Hanson
2016-06-24 09:17:57 -07:00
47 changed files with 12949 additions and 5464 deletions
+1 -20
View File
@@ -7,7 +7,7 @@
// ${cwd}: the current working directory of the spawned process
{
"version": "0.1.0",
"command": "jake",
"command": "gulp",
"isShellCommand": true,
"showOutput": "silent",
"tasks": [
@@ -18,25 +18,6 @@
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "lint-server",
"args": [],
"problemMatcher": {
"owner": "typescript",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(warning|error)\\s+([^(]+)\\s+\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(.*)$",
"severity": 1,
"file": 2,
"location": 3,
"message": 4
},
"watchedTaskBeginsRegExp": "^\\*\\*\\*Lint failure\\*\\*\\*$",
"watchedTaskEndsRegExp": "^\\*\\*\\* Total \\d+ failures\\.$"
},
"showOutput": "always",
"isWatching": true
}
]
}
+1044
View File
File diff suppressed because it is too large Load Diff
+5 -3
View File
@@ -284,7 +284,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) {
file(outFile, prereqs, function() {
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
var options = "--noImplicitAny --noEmitOnError --pretty";
var options = "--noImplicitAny --noEmitOnError --types --pretty";
opts = opts || {};
// Keep comments when specifically requested
// or when in debug mode.
@@ -992,7 +992,8 @@ var tslintRules = [
"booleanTriviaRule",
"typeOperatorSpacingRule",
"noInOperatorRule",
"noIncrementDecrementRule"
"noIncrementDecrementRule",
"objectLiteralSurroundingSpaceRule",
];
var tslintRulesFiles = tslintRules.map(function(p) {
return path.join(tslintRuleDir, p + ".ts");
@@ -1043,7 +1044,8 @@ var lintTargets = compilerSources
.concat(["instrumenter.ts"].map(function(f) { return path.join(harnessDirectory, f) }))
.concat(serverCoreSources)
.concat(tslintRulesFiles)
.concat(servicesSources);
.concat(servicesSources)
.concat(["Gulpfile.ts"]);
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");
+11 -11
View File
@@ -56,29 +56,29 @@ Change to the TypeScript directory:
cd TypeScript
```
Install Jake tools and dev dependencies:
Install Gulp tools and dev dependencies:
```
npm install -g jake
npm install -g gulp
npm install
```
Use one of the following to build and test:
```
jake local # Build the compiler into built/local
jake clean # Delete the built compiler
jake LKG # Replace the last known good with the built one.
gulp local # Build the compiler into built/local
gulp clean # Delete the built compiler
gulp LKG # Replace the last known good with the built one.
# Bootstrapping step to be executed when the built compiler reaches a stable state.
jake tests # Build the test infrastructure using the built compiler.
jake runtests # Run tests using the built compiler and test infrastructure.
gulp tests # Build the test infrastructure using the built compiler.
gulp runtests # Run tests using the built compiler and test infrastructure.
# You can override the host or specify a test for this command.
# Use host=<hostName> or tests=<testPath>.
jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional
gulp runtests-browser # Runs the tests using the built run.js file. Syntax is gulp runtests. Optional
parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
jake lint # Runs tslint on the TypeScript source.
jake -T # List the above commands.
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
gulp lint # Runs tslint on the TypeScript source.
gulp help # List the above commands.
```
+706 -146
View File
File diff suppressed because it is too large Load Diff
+671 -131
View File
File diff suppressed because it is too large Load Diff
+105 -15
View File
@@ -19,59 +19,149 @@ and limitations under the License.
*/
interface Promise<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>): Promise<TResult>;
/**
* Creates a new Promise with the same internal state of this Promise.
* @returns A Promise.
*/
then(): Promise<T>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
catch(onrejected?: (reason: any) => void): Promise<T>;
catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected: (reason: any) => T | PromiseLike<T>): Promise<T>;
}
interface PromiseConstructor {
/**
* A reference to the prototype.
/**
* A reference to the prototype.
*/
readonly prototype: Promise<any>;
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
reject(reason: any): Promise<never>;
/**
* Creates a new rejected promise for the provided reason.
+36 -16
View File
@@ -1271,13 +1271,33 @@ declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | P
interface PromiseLike<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<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>;
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
/**
* Creates a new Promise with the same internal state of this Promise.
* @returns A Promise.
*/
then(): PromiseLike<T>;
}
interface ArrayLike<T> {
@@ -1540,7 +1560,7 @@ interface Int8Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -1813,7 +1833,7 @@ interface Uint8Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -2087,7 +2107,7 @@ interface Uint8ClampedArray {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -2360,7 +2380,7 @@ interface Int16Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -2634,7 +2654,7 @@ interface Uint16Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -2907,7 +2927,7 @@ interface Int32Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -3180,7 +3200,7 @@ interface Uint32Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -3453,7 +3473,7 @@ interface Float32Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
@@ -3727,7 +3747,7 @@ interface Float64Array {
* 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,
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @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.
+811 -161
View File
File diff suppressed because it is too large Load Diff
+211 -12
View File
@@ -19,6 +19,10 @@ and limitations under the License.
/// IE Worker APIs
/////////////////////////////
interface Algorithm {
name: string;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
@@ -34,6 +38,10 @@ interface IDBObjectStoreParameters {
keyPath?: IDBKeyPath;
}
interface KeyAlgorithm {
name?: string;
}
interface EventListener {
(evt: Event): void;
}
@@ -123,6 +131,18 @@ declare var Coordinates: {
new(): Coordinates;
}
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
readonly type: string;
readonly usages: string[];
}
declare var CryptoKey: {
prototype: CryptoKey;
new(): CryptoKey;
}
interface DOMError {
readonly name: string;
toString(): string;
@@ -339,7 +359,7 @@ interface IDBDatabase extends EventTarget {
readonly name: string;
readonly objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
version: number;
onversionchange: (ev: IDBVersionChangeEvent) => any;
close(): void;
@@ -442,7 +462,7 @@ declare var IDBOpenDBRequest: {
interface IDBRequest extends EventTarget {
readonly error: DOMError;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
onsuccess: (ev: Event) => any;
readonly readyState: string;
readonly result: any;
@@ -464,7 +484,7 @@ interface IDBTransaction extends EventTarget {
readonly mode: string;
onabort: (ev: Event) => any;
oncomplete: (ev: Event) => any;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
abort(): void;
objectStore(name: string): IDBObjectStore;
readonly READ_ONLY: string;
@@ -532,7 +552,7 @@ declare var MSApp: MSApp;
interface MSAppAsyncOperation extends EventTarget {
readonly error: DOMError;
oncomplete: (ev: Event) => any;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
start(): void;
@@ -681,7 +701,7 @@ interface WebSocket extends EventTarget {
readonly bufferedAmount: number;
readonly extensions: string;
onclose: (ev: CloseEvent) => any;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
onmessage: (ev: MessageEvent) => any;
onopen: (ev: Event) => any;
readonly protocol: string;
@@ -724,7 +744,6 @@ declare var Worker: {
}
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
msCaching: string;
onreadystatechange: (ev: ProgressEvent) => any;
readonly readyState: number;
readonly response: any;
@@ -736,6 +755,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
timeout: number;
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
msCaching?: string;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
@@ -782,14 +802,14 @@ declare var XMLHttpRequestUpload: {
}
interface AbstractWorker {
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface MSBaseReader {
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
onload: (ev: Event) => any;
onloadend: (ev: ProgressEvent) => any;
onloadstart: (ev: Event) => any;
@@ -835,7 +855,7 @@ interface WindowConsole {
interface XMLHttpRequestEventTarget {
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
onload: (ev: Event) => any;
onloadend: (ev: ProgressEvent) => any;
onloadstart: (ev: Event) => any;
@@ -865,7 +885,7 @@ declare var FileReaderSync: {
interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole {
readonly location: WorkerLocation;
onerror: (ev: Event) => any;
onerror: (ev: ErrorEvent) => any;
readonly self: WorkerGlobalScope;
close(): void;
msWriteProfilerMark(profilerMarkName: string): void;
@@ -921,8 +941,11 @@ interface WorkerUtils extends Object, WindowBase64 {
clearInterval(handle: number): void;
clearTimeout(handle: number): void;
importScripts(...urls: string[]): void;
setImmediate(handler: (...args: any[]) => void): number;
setImmediate(handler: any, ...args: any[]): number;
setInterval(handler: (...args: any[]) => void, timeout: number): number;
setInterval(handler: any, timeout?: any, ...args: any[]): number;
setTimeout(handler: (...args: any[]) => void, timeout: number): number;
setTimeout(handler: any, timeout?: any, ...args: any[]): number;
}
@@ -958,6 +981,177 @@ interface ProgressEventInit extends EventInit {
interface IDBArrayKey extends Array<IDBValidKey> {
}
interface RsaKeyGenParams extends Algorithm {
modulusLength: number;
publicExponent: Uint8Array;
}
interface RsaHashedKeyGenParams extends RsaKeyGenParams {
hash: AlgorithmIdentifier;
}
interface RsaKeyAlgorithm extends KeyAlgorithm {
modulusLength: number;
publicExponent: Uint8Array;
}
interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
hash: AlgorithmIdentifier;
}
interface RsaHashedImportParams {
hash: AlgorithmIdentifier;
}
interface RsaPssParams {
saltLength: number;
}
interface RsaOaepParams extends Algorithm {
label?: BufferSource;
}
interface EcdsaParams extends Algorithm {
hash: AlgorithmIdentifier;
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
typedCurve: string;
}
interface EcKeyImportParams {
namedCurve: string;
}
interface EcdhKeyDeriveParams extends Algorithm {
public: CryptoKey;
}
interface AesCtrParams extends Algorithm {
counter: BufferSource;
length: number;
}
interface AesKeyAlgorithm extends KeyAlgorithm {
length: number;
}
interface AesKeyGenParams extends Algorithm {
length: number;
}
interface AesDerivedKeyParams extends Algorithm {
length: number;
}
interface AesCbcParams extends Algorithm {
iv: BufferSource;
}
interface AesCmacParams extends Algorithm {
length: number;
}
interface AesGcmParams extends Algorithm {
iv: BufferSource;
additionalData?: BufferSource;
tagLength?: number;
}
interface AesCfbParams extends Algorithm {
iv: BufferSource;
}
interface HmacImportParams extends Algorithm {
hash?: AlgorithmIdentifier;
length?: number;
}
interface HmacKeyAlgorithm extends KeyAlgorithm {
hash: AlgorithmIdentifier;
length: number;
}
interface HmacKeyGenParams extends Algorithm {
hash: AlgorithmIdentifier;
length?: number;
}
interface DhKeyGenParams extends Algorithm {
prime: Uint8Array;
generator: Uint8Array;
}
interface DhKeyAlgorithm extends KeyAlgorithm {
prime: Uint8Array;
generator: Uint8Array;
}
interface DhKeyDeriveParams extends Algorithm {
public: CryptoKey;
}
interface DhImportKeyParams extends Algorithm {
prime: Uint8Array;
generator: Uint8Array;
}
interface ConcatParams extends Algorithm {
hash?: AlgorithmIdentifier;
algorithmId: Uint8Array;
partyUInfo: Uint8Array;
partyVInfo: Uint8Array;
publicInfo?: Uint8Array;
privateInfo?: Uint8Array;
}
interface HkdfCtrParams extends Algorithm {
hash: AlgorithmIdentifier;
label: BufferSource;
context: BufferSource;
}
interface Pbkdf2Params extends Algorithm {
salt: BufferSource;
iterations: number;
hash: AlgorithmIdentifier;
}
interface RsaOtherPrimesInfo {
r: string;
d: string;
t: string;
}
interface JsonWebKey {
kty: string;
use?: string;
key_ops?: string[];
alg?: string;
kid?: string;
x5u?: string;
x5c?: string;
x5t?: string;
ext?: boolean;
crv?: string;
x?: string;
y?: string;
d?: string;
n?: string;
e?: string;
p?: string;
q?: string;
dp?: string;
dq?: string;
qi?: string;
oth?: RsaOtherPrimesInfo[];
k?: string;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -991,7 +1185,7 @@ interface FunctionStringCallback {
(data: string): void;
}
declare var location: WorkerLocation;
declare var onerror: (ev: Event) => any;
declare var onerror: (ev: ErrorEvent) => any;
declare var self: WorkerGlobalScope;
declare function close(): void;
declare function msWriteProfilerMark(profilerMarkName: string): void;
@@ -1006,8 +1200,11 @@ declare function clearImmediate(handle: number): void;
declare function clearInterval(handle: number): void;
declare function clearTimeout(handle: number): void;
declare function importScripts(...urls: string[]): void;
declare function setImmediate(handler: (...args: any[]) => void): number;
declare function setImmediate(handler: any, ...args: any[]): number;
declare function setInterval(handler: (...args: any[]) => void, timeout: number): number;
declare function setInterval(handler: any, timeout?: any, ...args: any[]): number;
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;
declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;
declare function atob(encodedString: string): string;
declare function btoa(rawString: string): string;
@@ -1017,5 +1214,7 @@ declare var console: Console;
declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
type AlgorithmIdentifier = string | Algorithm;
type IDBKeyPath = string;
type IDBValidKey = number | string | Date | IDBArrayKey;
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
+1046 -346
View File
File diff suppressed because it is too large Load Diff
+1912 -1121
View File
File diff suppressed because it is too large Load Diff
+122 -32
View File
@@ -704,7 +704,6 @@ declare namespace ts {
}
interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
dotToken: Node;
name: Identifier;
}
type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression;
@@ -835,6 +834,7 @@ declare namespace ts {
interface SwitchStatement extends Statement {
expression: Expression;
caseBlock: CaseBlock;
possiblyExhaustive?: boolean;
}
interface CaseBlock extends Node {
clauses: NodeArray<CaseOrDefaultClause>;
@@ -910,7 +910,7 @@ declare namespace ts {
type ModuleBody = ModuleBlock | ModuleDeclaration;
interface ModuleDeclaration extends DeclarationStatement {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
body?: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, Statement {
statements: NodeArray<Statement>;
@@ -1066,8 +1066,9 @@ declare namespace ts {
Assignment = 16,
TrueCondition = 32,
FalseCondition = 64,
Referenced = 128,
Shared = 256,
SwitchClause = 128,
Referenced = 256,
Shared = 512,
Label = 12,
Condition = 96,
}
@@ -1089,6 +1090,12 @@ declare namespace ts {
expression: Expression;
antecedent: FlowNode;
}
interface FlowSwitchClause extends FlowNode {
switchStatement: SwitchStatement;
clauseStart: number;
clauseEnd: number;
antecedent: FlowNode;
}
interface AmdDependency {
path: string;
name: string;
@@ -1132,7 +1139,9 @@ declare namespace ts {
getCurrentDirectory(): string;
}
interface ParseConfigHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
useCaseSensitiveFileNames: boolean;
readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[];
fileExists(path: string): boolean;
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void;
@@ -1504,6 +1513,7 @@ declare namespace ts {
resolvedJsxType?: Type;
hasSuperCall?: boolean;
superCall?: ExpressionStatement;
switchTypes?: Type[];
}
const enum TypeFlags {
Any = 1,
@@ -1535,7 +1545,7 @@ declare namespace ts {
ObjectLiteralPatternWithComputedProperties = 67108864,
Never = 134217728,
Nullable = 96,
Falsy = 126,
Falsy = 112,
Intrinsic = 150995071,
Primitive = 16777726,
StringLike = 258,
@@ -1772,8 +1782,9 @@ declare namespace ts {
suppressOutputPathCheck?: boolean;
target?: ScriptTarget;
traceResolution?: boolean;
disableSizeLimit?: boolean;
types?: string[];
typesRoot?: string;
typeRoots?: string[];
typesSearchPaths?: string[];
version?: boolean;
watch?: boolean;
@@ -1843,6 +1854,15 @@ declare namespace ts {
fileNames: string[];
raw?: any;
errors: Diagnostic[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
}
const enum WatchDirectoryFlags {
None = 0,
Recursive = 1,
}
interface ExpandResult {
fileNames: string[];
wildcardDirectories: Map<WatchDirectoryFlags>;
}
interface CommandLineOptionBase {
name: string;
@@ -2027,6 +2047,7 @@ declare namespace ts {
getDefaultTypeDirectiveNames?(rootPath: string): string[];
writeFile: WriteFileCallback;
getCurrentDirectory(): string;
getDirectories(path: string): string[];
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
@@ -2068,8 +2089,10 @@ declare namespace ts {
function forEach<T, U>(array: T[], callback: (element: T, index: number) => U): U;
function contains<T>(array: T[], value: T, areEqual?: (a: T, b: T) => boolean): boolean;
function indexOf<T>(array: T[], value: T): number;
function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number;
function countWhere<T>(array: T[], predicate: (x: T) => boolean): number;
function filter<T>(array: T[], f: (x: T) => boolean): T[];
function filterMutate<T>(array: T[], f: (x: T) => boolean): void;
function map<T, U>(array: T[], f: (x: T) => U): U[];
function concatenate<T>(array1: T[], array2: T[]): T[];
function deduplicate<T>(array: T[], areEqual?: (a: T, b: T) => boolean): T[];
@@ -2104,6 +2127,8 @@ declare namespace ts {
function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain;
function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain;
function compareValues<T>(a: T, b: T): Comparison;
function compareStrings(a: string, b: string, ignoreCase?: boolean): Comparison;
function compareStringsCaseInsensitive(a: string, b: string): Comparison;
function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison;
function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
@@ -2121,16 +2146,45 @@ declare namespace ts {
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string;
function getBaseFileName(path: string): string;
function combinePaths(path1: string, path2: string): string;
function removeTrailingDirectorySeparator(path: string): string;
function ensureTrailingDirectorySeparator(path: string): string;
function comparePaths(a: string, b: string, currentDirectory: string, ignoreCase?: boolean): Comparison;
function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean;
function fileExtensionIs(path: string, extension: string): boolean;
function fileExtensionIsAny(path: string, extensions: string[]): boolean;
function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude"): string;
interface FileSystemEntries {
files: string[];
directories: string[];
}
interface FileMatcherPatterns {
includeFilePattern: string;
includeDirectoryPattern: string;
excludePattern: string;
basePaths: string[];
}
function getFileMatcherPatterns(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns;
function matchFiles(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string, getFileSystemEntries: (path: string) => FileSystemEntries): string[];
function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind;
function getScriptKindFromFileName(fileName: string): ScriptKind;
const supportedTypeScriptExtensions: string[];
const supportedJavascriptExtensions: string[];
function getSupportedExtensions(options?: CompilerOptions): string[];
function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions): boolean;
const enum ExtensionPriority {
TypeScriptFiles = 0,
DeclarationAndJavaScriptFiles = 2,
Limit = 5,
Highest = 0,
Lowest = 2,
}
function getExtensionPriority(path: string, supportedExtensions: string[]): ExtensionPriority;
function adjustExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority;
function getNextLowestExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority;
function removeFileExtension(path: string): string;
function tryRemoveExtension(path: string, extension: string): string;
function isJsxOrTsxExtension(ext: string): boolean;
function changeExtension<T extends string | Path>(path: T, newExtension: string): T;
interface ObjectAllocator {
getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node;
getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile;
@@ -2167,6 +2221,7 @@ declare namespace ts {
useCaseSensitiveFileNames: boolean;
write(s: string): void;
readFile(path: string, encoding?: string): string;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
@@ -2177,7 +2232,7 @@ declare namespace ts {
getExecutingFilePath(): string;
getCurrentDirectory(): string;
getDirectories(path: string): string[];
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
getModifiedTime?(path: string): Date;
createHash?(data: string): string;
getMemoryUsage?(): number;
@@ -3053,7 +3108,7 @@ declare namespace ts {
key: string;
message: string;
};
A_parameter_property_may_not_be_a_binding_pattern: {
A_parameter_property_may_not_be_declared_using_a_binding_pattern: {
code: number;
category: DiagnosticCategory;
key: string;
@@ -3149,12 +3204,6 @@ declare namespace ts {
key: string;
message: string;
};
Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Decorators_are_not_valid_here: {
code: number;
category: DiagnosticCategory;
@@ -3479,6 +3528,12 @@ declare namespace ts {
key: string;
message: string;
};
A_parameter_property_cannot_be_declared_using_a_rest_parameter: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Duplicate_identifier_0: {
code: number;
category: DiagnosticCategory;
@@ -5099,6 +5154,18 @@ declare namespace ts {
key: string;
message: string;
};
Cannot_find_type_definition_file_for_0: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Cannot_extend_an_interface_0_Did_you_mean_implements: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Import_declaration_0_is_using_private_name_1: {
code: number;
category: DiagnosticCategory;
@@ -5537,6 +5604,18 @@ declare namespace ts {
key: string;
message: string;
};
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Cannot_read_file_0_Colon_1: {
code: number;
category: DiagnosticCategory;
@@ -6575,12 +6654,6 @@ declare namespace ts {
key: string;
message: string;
};
property_declarations_can_only_be_used_in_a_ts_file: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
enum_declarations_can_only_be_used_in_a_ts_file: {
code: number;
category: DiagnosticCategory;
@@ -6742,7 +6815,7 @@ declare namespace ts {
function getOptionNameMap(): OptionNameMap;
function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic;
function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): number | string;
function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[];
function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[] | undefined;
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
function readConfigFile(fileName: string, readFile: (path: string) => string): {
config?: any;
@@ -6818,6 +6891,7 @@ declare namespace ts {
function makeIdentifierFromModuleName(moduleName: string): string;
function isBlockOrCatchScoped(declaration: Declaration): boolean;
function isAmbientModule(node: Node): boolean;
function isShorthandAmbientModule(node: Node): boolean;
function isBlockScopedContainerTopLevel(node: Node): boolean;
function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean;
function isExternalModuleAugmentation(node: Node): boolean;
@@ -6880,6 +6954,7 @@ declare namespace ts {
function isInJavaScriptFile(node: Node): boolean;
function isRequireCall(expression: Node, checkArgumentIsStringLiteral: boolean): expression is CallExpression;
function isSingleOrDoubleQuote(charCode: number): boolean;
function isDeclarationOfFunctionExpression(s: Symbol): boolean;
function getSpecialPropertyAssignmentKind(expression: Node): SpecialPropertyAssignmentKind;
function getExternalModuleName(node: Node): Expression;
function hasQuestionToken(node: Node): boolean;
@@ -6994,6 +7069,7 @@ declare namespace ts {
function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean;
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
function hasJavaScriptFileExtension(fileName: string): boolean;
function hasTypeScriptFileExtension(fileName: string): boolean;
const stringify: (value: any) => string;
function convertToBase64(input: string): string;
function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string;
@@ -7105,7 +7181,7 @@ declare namespace ts {
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 getDefaultTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts.BreakpointResolver {
@@ -7118,8 +7194,7 @@ declare namespace ts.NavigateTo {
function getNavigateToItems(program: Program, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number): NavigateToItem[];
}
declare namespace ts.NavigationBar {
function getNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): ts.NavigationBarItem[];
function getJsNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): NavigationBarItem[];
function getNavigationBarItems(sourceFile: SourceFile): NavigationBarItem[];
}
declare namespace ts {
enum PatternMatchKind {
@@ -7229,7 +7304,7 @@ declare namespace ts.JsTyping {
directoryExists: (path: string) => boolean;
fileExists: (fileName: string) => boolean;
readFile: (path: string, encoding?: string) => string;
readDirectory: (path: string, extension?: string, exclude?: string[], depth?: number) => string[];
readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[];
}
function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map<string>, typingOptions: TypingOptions, compilerOptions: CompilerOptions): {
cachedTypingPaths: string[];
@@ -7716,6 +7791,7 @@ declare namespace ts {
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
directoryExists?(directoryName: string): boolean;
getDirectories?(directoryName: string): string[];
}
interface LanguageService {
cleanupSemanticCache(): void;
@@ -7799,6 +7875,7 @@ declare namespace ts {
textSpan: TextSpan;
fileName: string;
isWriteAccess: boolean;
isDefinition: boolean;
}
interface DocumentHighlights {
fileName: string;
@@ -8216,7 +8293,7 @@ declare namespace ts.server {
private reload(fileName, tempFileName, reqSeq?);
private saveToTmp(fileName, tempFileName);
private closeClientFile(fileName);
private decorateNavigationBarItem(project, fileName, items);
private decorateNavigationBarItem(project, fileName, items, lineIndex);
private getNavigationBarItems(fileName);
private getNavigateToItems(searchValue, fileName, maxResultCount?);
private getBraceMatching(line, offset, fileName);
@@ -8246,6 +8323,7 @@ declare namespace ts.server {
endGroup(): void;
msg(s: string, type?: string): void;
}
const maxProgramSizeForNonTsFiles: number;
class ScriptInfo {
private host;
fileName: string;
@@ -8304,27 +8382,34 @@ declare namespace ts.server {
resolvePath(path: string): string;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
getDirectories(path: string): string[];
lineToTextSpan(filename: string, line: number): ts.TextSpan;
lineOffsetToPosition(filename: string, line: number, offset: number): number;
positionToLineOffset(filename: string, position: number): ILineInfo;
positionToLineOffset(filename: string, position: number, lineIndex?: LineIndex): ILineInfo;
getLineIndex(filename: string): LineIndex;
}
interface ProjectOptions {
files?: string[];
wildcardDirectories?: ts.Map<ts.WatchDirectoryFlags>;
compilerOptions?: ts.CompilerOptions;
}
class Project {
projectService: ProjectService;
projectOptions?: ProjectOptions;
languageServiceDiabled: boolean;
compilerService: CompilerService;
projectFilename: string;
projectFileWatcher: FileWatcher;
directoryWatcher: FileWatcher;
directoriesWatchedForWildcards: Map<FileWatcher>;
directoriesWatchedForTsconfig: string[];
program: ts.Program;
filenameToSourceFile: ts.Map<ts.SourceFile>;
updateGraphSeq: number;
openRefCount: number;
constructor(projectService: ProjectService, projectOptions?: ProjectOptions);
constructor(projectService: ProjectService, projectOptions?: ProjectOptions, languageServiceDiabled?: boolean);
enableLanguageService(): void;
disableLanguageService(): void;
addOpenRef(): void;
deleteOpenRef(): number;
openReferencedFile(filename: string): ScriptInfo;
@@ -8415,13 +8500,14 @@ declare namespace ts.server {
projectOptions?: ProjectOptions;
errors?: Diagnostic[];
};
private exceedTotalNonTsFileSizeLimit(fileNames);
openConfigFile(configFilename: string, clientFileName?: string): {
success: boolean;
project?: Project;
errors?: Diagnostic[];
};
updateConfiguredProject(project: Project): Diagnostic[];
createProject(projectFilename: string, projectOptions?: ProjectOptions): Project;
createProject(projectFilename: string, projectOptions?: ProjectOptions, languageServiceDisabled?: boolean): Project;
}
class CompilerService {
project: Project;
@@ -8592,7 +8678,9 @@ declare namespace ts {
directoryExists(directoryName: string): boolean;
}
interface CoreServicesShimHost extends Logger, ModuleResolutionHost {
readDirectory(rootDir: string, extension: string, exclude?: string, depth?: number): string;
readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string;
useCaseSensitiveFileNames?(): boolean;
getCurrentDirectory(): string;
trace(s: string): void;
}
interface IFileReference {
@@ -8685,10 +8773,12 @@ declare namespace ts {
private shimHost;
directoryExists: (directoryName: string) => boolean;
realpath: (path: string) => string;
useCaseSensitiveFileNames: boolean;
constructor(shimHost: CoreServicesShimHost);
readDirectory(rootDir: string, extension: string, exclude: string[], depth?: number): string[];
readDirectory(rootDir: string, extensions: string[], exclude: string[], include: string[], depth?: number): string[];
fileExists(fileName: string): boolean;
readFile(fileName: string): string;
private readDirectoryFallback(rootDir, extension, exclude);
}
function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): {
message: string;
+1912 -1121
View File
File diff suppressed because it is too large Load Diff
+45 -8
View File
@@ -713,7 +713,6 @@ declare namespace ts {
}
interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
dotToken: Node;
name: Identifier;
}
type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression;
@@ -844,6 +843,7 @@ declare namespace ts {
interface SwitchStatement extends Statement {
expression: Expression;
caseBlock: CaseBlock;
possiblyExhaustive?: boolean;
}
interface CaseBlock extends Node {
clauses: NodeArray<CaseOrDefaultClause>;
@@ -919,7 +919,7 @@ declare namespace ts {
type ModuleBody = ModuleBlock | ModuleDeclaration;
interface ModuleDeclaration extends DeclarationStatement {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
body?: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, Statement {
statements: NodeArray<Statement>;
@@ -1075,8 +1075,9 @@ declare namespace ts {
Assignment = 16,
TrueCondition = 32,
FalseCondition = 64,
Referenced = 128,
Shared = 256,
SwitchClause = 128,
Referenced = 256,
Shared = 512,
Label = 12,
Condition = 96,
}
@@ -1098,6 +1099,12 @@ declare namespace ts {
expression: Expression;
antecedent: FlowNode;
}
interface FlowSwitchClause extends FlowNode {
switchStatement: SwitchStatement;
clauseStart: number;
clauseEnd: number;
antecedent: FlowNode;
}
interface AmdDependency {
path: string;
name: string;
@@ -1132,7 +1139,13 @@ declare namespace ts {
getCurrentDirectory(): string;
}
interface ParseConfigHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
useCaseSensitiveFileNames: boolean;
readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[];
/**
* Gets a value indicating whether the specified path exists and is a file.
* @param path The path to test.
*/
fileExists(path: string): boolean;
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void;
@@ -1412,7 +1425,6 @@ declare namespace ts {
ThisType = 33554432,
ObjectLiteralPatternWithComputedProperties = 67108864,
Never = 134217728,
Falsy = 126,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
@@ -1574,7 +1586,10 @@ declare namespace ts {
suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget;
traceResolution?: boolean;
disableSizeLimit?: boolean;
types?: string[];
/** Paths used to used to compute primary types search locations */
typeRoots?: string[];
typesSearchPaths?: string[];
[option: string]: CompilerOptionsValue | undefined;
}
@@ -1638,6 +1653,15 @@ declare namespace ts {
fileNames: string[];
raw?: any;
errors: Diagnostic[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
}
enum WatchDirectoryFlags {
None = 0,
Recursive = 1,
}
interface ExpandResult {
fileNames: string[];
wildcardDirectories: Map<WatchDirectoryFlags>;
}
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
@@ -1672,6 +1696,7 @@ declare namespace ts {
getDefaultTypeDirectiveNames?(rootPath: string): string[];
writeFile: WriteFileCallback;
getCurrentDirectory(): string;
getDirectories(path: string): string[];
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
@@ -1707,6 +1732,7 @@ declare namespace ts {
useCaseSensitiveFileNames: boolean;
write(s: string): void;
readFile(path: string, encoding?: string): string;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
@@ -1717,7 +1743,7 @@ declare namespace ts {
getExecutingFilePath(): string;
getCurrentDirectory(): string;
getDirectories(path: string): string[];
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
getModifiedTime?(path: string): Date;
createHash?(data: string): string;
getMemoryUsage?(): number;
@@ -1821,6 +1847,7 @@ 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, fileExists: (fileName: string) => boolean): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
@@ -1836,7 +1863,15 @@ declare namespace ts {
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 getDefaultTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
/**
* Given a set of options and a set of root files, returns the set of type directive names
* that should be included for this program automatically.
* This list could either come from the config file,
* or from enumerating the types root + initial secondary types lookup location.
* More type directives might appear in the program later as a result of loading actual source files;
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts {
@@ -1978,6 +2013,7 @@ declare namespace ts {
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
directoryExists?(directoryName: string): boolean;
getDirectories?(directoryName: string): string[];
}
interface LanguageService {
cleanupSemanticCache(): void;
@@ -2068,6 +2104,7 @@ declare namespace ts {
textSpan: TextSpan;
fileName: string;
isWriteAccess: boolean;
isDefinition: boolean;
}
interface DocumentHighlights {
fileName: string;
+1882 -1054
View File
File diff suppressed because it is too large Load Diff
+45 -8
View File
@@ -713,7 +713,6 @@ declare namespace ts {
}
interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
dotToken: Node;
name: Identifier;
}
type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression;
@@ -844,6 +843,7 @@ declare namespace ts {
interface SwitchStatement extends Statement {
expression: Expression;
caseBlock: CaseBlock;
possiblyExhaustive?: boolean;
}
interface CaseBlock extends Node {
clauses: NodeArray<CaseOrDefaultClause>;
@@ -919,7 +919,7 @@ declare namespace ts {
type ModuleBody = ModuleBlock | ModuleDeclaration;
interface ModuleDeclaration extends DeclarationStatement {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
body?: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, Statement {
statements: NodeArray<Statement>;
@@ -1075,8 +1075,9 @@ declare namespace ts {
Assignment = 16,
TrueCondition = 32,
FalseCondition = 64,
Referenced = 128,
Shared = 256,
SwitchClause = 128,
Referenced = 256,
Shared = 512,
Label = 12,
Condition = 96,
}
@@ -1098,6 +1099,12 @@ declare namespace ts {
expression: Expression;
antecedent: FlowNode;
}
interface FlowSwitchClause extends FlowNode {
switchStatement: SwitchStatement;
clauseStart: number;
clauseEnd: number;
antecedent: FlowNode;
}
interface AmdDependency {
path: string;
name: string;
@@ -1132,7 +1139,13 @@ declare namespace ts {
getCurrentDirectory(): string;
}
interface ParseConfigHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
useCaseSensitiveFileNames: boolean;
readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[];
/**
* Gets a value indicating whether the specified path exists and is a file.
* @param path The path to test.
*/
fileExists(path: string): boolean;
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void;
@@ -1412,7 +1425,6 @@ declare namespace ts {
ThisType = 33554432,
ObjectLiteralPatternWithComputedProperties = 67108864,
Never = 134217728,
Falsy = 126,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
@@ -1574,7 +1586,10 @@ declare namespace ts {
suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget;
traceResolution?: boolean;
disableSizeLimit?: boolean;
types?: string[];
/** Paths used to used to compute primary types search locations */
typeRoots?: string[];
typesSearchPaths?: string[];
[option: string]: CompilerOptionsValue | undefined;
}
@@ -1638,6 +1653,15 @@ declare namespace ts {
fileNames: string[];
raw?: any;
errors: Diagnostic[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
}
enum WatchDirectoryFlags {
None = 0,
Recursive = 1,
}
interface ExpandResult {
fileNames: string[];
wildcardDirectories: Map<WatchDirectoryFlags>;
}
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
@@ -1672,6 +1696,7 @@ declare namespace ts {
getDefaultTypeDirectiveNames?(rootPath: string): string[];
writeFile: WriteFileCallback;
getCurrentDirectory(): string;
getDirectories(path: string): string[];
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
@@ -1707,6 +1732,7 @@ declare namespace ts {
useCaseSensitiveFileNames: boolean;
write(s: string): void;
readFile(path: string, encoding?: string): string;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
@@ -1717,7 +1743,7 @@ declare namespace ts {
getExecutingFilePath(): string;
getCurrentDirectory(): string;
getDirectories(path: string): string[];
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
getModifiedTime?(path: string): Date;
createHash?(data: string): string;
getMemoryUsage?(): number;
@@ -1821,6 +1847,7 @@ 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, fileExists: (fileName: string) => boolean): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
@@ -1836,7 +1863,15 @@ declare namespace ts {
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 getDefaultTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
/**
* Given a set of options and a set of root files, returns the set of type directive names
* that should be included for this program automatically.
* This list could either come from the config file,
* or from enumerating the types root + initial secondary types lookup location.
* More type directives might appear in the program later as a result of loading actual source files;
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts {
@@ -1978,6 +2013,7 @@ declare namespace ts {
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
directoryExists?(directoryName: string): boolean;
getDirectories?(directoryName: string): string[];
}
interface LanguageService {
cleanupSemanticCache(): void;
@@ -2068,6 +2104,7 @@ declare namespace ts {
textSpan: TextSpan;
fileName: string;
isWriteAccess: boolean;
isDefinition: boolean;
}
interface DocumentHighlights {
fileName: string;
+1882 -1054
View File
File diff suppressed because it is too large Load Diff
+39 -5
View File
@@ -29,15 +29,48 @@
"node": ">=0.8.0"
},
"devDependencies": {
"jake": "latest",
"mocha": "latest",
"chai": "latest",
"@types/browserify": "latest",
"@types/del": "latest",
"@types/glob": "latest",
"@types/gulp": "latest",
"@types/gulp-concat": "latest",
"@types/gulp-help": "latest",
"@types/gulp-newer": "latest",
"@types/gulp-sourcemaps": "latest",
"@types/gulp-typescript": "latest",
"@types/merge2": "latest",
"@types/minimatch": "latest",
"@types/minimist": "latest",
"@types/mkdirp": "latest",
"@types/node": "latest",
"@types/q": "latest",
"@types/run-sequence": "latest",
"@types/through2": "latest",
"browserify": "latest",
"chai": "latest",
"del": "latest",
"gulp": "latest",
"gulp-clone": "latest",
"gulp-concat": "latest",
"gulp-help": "latest",
"gulp-insert": "latest",
"gulp-newer": "latest",
"gulp-sourcemaps": "latest",
"gulp-typescript": "latest",
"into-stream": "latest",
"istanbul": "latest",
"jake": "latest",
"merge2": "latest",
"minimist": "latest",
"mkdirp": "latest",
"mocha": "latest",
"mocha-fivemat-progress-reporter": "latest",
"run-sequence": "latest",
"through2": "latest",
"ts-node": "latest",
"tsd": "latest",
"tslint": "next",
"typescript": "next",
"tsd": "latest"
"typescript": "next"
},
"scripts": {
"pretest": "jake tests",
@@ -47,6 +80,7 @@
"build:tests": "jake tests",
"start": "node lib/tsc",
"clean": "jake clean",
"gulp": "gulp",
"jake": "jake",
"lint": "jake lint",
"setup-hooks": "node scripts/link-hooks.js"
+7
View File
@@ -245,6 +245,13 @@ function runTests(taskConfigsFolder, run, options, cb) {
}
}
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
if (process.env.path !== undefined) {
process.env.path = nodeModulesPathPrefix + process.env.path;
} else if (process.env.PATH !== undefined) {
process.env.PATH = nodeModulesPathPrefix + process.env.PATH;
}
function spawnProcess(cmd, options) {
var shell = process.platform === "win32" ? "cmd" : "/bin/sh";
var prefix = process.platform === "win32" ? "/c" : "-c";
@@ -0,0 +1,42 @@
import * as Lint from "tslint/lib/lint";
import * as ts from "typescript";
export class Rule extends Lint.Rules.AbstractRule {
public static LEADING_FAILURE_STRING = "No leading whitespace found on single-line object literal.";
public static TRAILING_FAILURE_STRING = "No trailing whitespace found on single-line object literal.";
public static LEADING_EXCESS_FAILURE_STRING = "Excess leading whitespace found on single-line object literal.";
public static TRAILING_EXCESS_FAILURE_STRING = "Excess trailing whitespace found on single-line object literal.";
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(new ObjectLiteralSpaceWalker(sourceFile, this.getOptions()));
}
}
class ObjectLiteralSpaceWalker extends Lint.RuleWalker {
public visitNode(node: ts.Node) {
if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) {
const literal = node as ts.ObjectLiteralExpression;
const text = literal.getText();
if (text.match(/^{[^\n]+}$/g)) {
if (text.charAt(1) !== " ") {
const failure = this.createFailure(node.pos, node.getWidth(), Rule.LEADING_FAILURE_STRING);
this.addFailure(failure);
}
if (text.charAt(2) === " ") {
const failure = this.createFailure(node.pos + 2, 1, Rule.LEADING_EXCESS_FAILURE_STRING);
this.addFailure(failure);
}
if (text.charAt(text.length - 2) !== " ") {
const failure = this.createFailure(node.pos, node.getWidth(), Rule.TRAILING_FAILURE_STRING);
this.addFailure(failure);
}
if (text.charAt(text.length - 3) === " ") {
const failure = this.createFailure(node.pos + node.getWidth() - 3, 1, Rule.TRAILING_EXCESS_FAILURE_STRING);
this.addFailure(failure);
}
}
}
super.visitNode(node);
}
}
+22
View File
@@ -0,0 +1,22 @@
declare module "gulp-clone" {
function Clone(): NodeJS.ReadWriteStream;
namespace Clone {
export function sink() : NodeJS.ReadWriteStream & {tap: () => NodeJS.ReadWriteStream};
}
export = Clone;
}
declare module "gulp-insert" {
export function append(text: string | Buffer): NodeJS.ReadWriteStream;
export function prepend(text: string | Buffer): NodeJS.ReadWriteStream;
export function wrap(text: string | Buffer, tail: string | Buffer): NodeJS.ReadWriteStream;
export function transform(cb: (contents: string, file: {path: string}) => string): NodeJS.ReadWriteStream; // file is a vinyl file
}
declare module "into-stream" {
function IntoStream(content: string | Buffer | (string | Buffer)[]): NodeJS.ReadableStream;
namespace IntoStream {
export function obj(content: any): NodeJS.ReadableStream
}
export = IntoStream;
}
+88 -57
View File
@@ -2473,16 +2473,13 @@ namespace ts {
}
}
function buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) {
function buildDisplayForParametersAndDelimiters(thisParameter: Symbol | undefined, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) {
writePunctuation(writer, SyntaxKind.OpenParenToken);
if (thisType) {
writeKeyword(writer, SyntaxKind.ThisKeyword);
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack);
if (thisParameter) {
buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack);
}
for (let i = 0; i < parameters.length; i++) {
if (i > 0 || thisType) {
if (i > 0 || thisParameter) {
writePunctuation(writer, SyntaxKind.CommaToken);
writeSpace(writer);
}
@@ -2538,7 +2535,7 @@ namespace ts {
buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack);
}
buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack);
buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack);
buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack);
}
@@ -2981,12 +2978,14 @@ namespace ts {
if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) {
const getter = <AccessorDeclaration>getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor);
if (getter) {
const signature = getSignatureFromDeclaration(getter);
const getterSignature = getSignatureFromDeclaration(getter);
const thisParameter = getAccessorThisParameter(func as AccessorDeclaration);
if (thisParameter && declaration === thisParameter) {
return signature.thisType;
// Use the type from the *getter*
Debug.assert(!thisParameter.type);
return getTypeOfSymbol(getterSignature.thisParameter);
}
return getReturnTypeOfSignature(signature);
return getReturnTypeOfSignature(getterSignature);
}
}
// Use contextual parameter type if one is available
@@ -3208,14 +3207,13 @@ namespace ts {
return undefined;
}
function getAnnotatedAccessorThisType(accessor: AccessorDeclaration): Type {
if (accessor) {
const parameter = getAccessorThisParameter(accessor);
if (parameter && parameter.type) {
return getTypeFromTypeNode(accessor.parameters[0].type);
}
}
return undefined;
function getAnnotatedAccessorThisParameter(accessor: AccessorDeclaration): Symbol | undefined {
const parameter = getAccessorThisParameter(accessor);
return parameter && parameter.symbol;
}
function getThisTypeOfDeclaration(declaration: SignatureDeclaration): Type | undefined {
return getThisTypeOfSignature(getSignatureFromDeclaration(declaration));
}
function getTypeOfAccessors(symbol: Symbol): Type {
@@ -3898,13 +3896,13 @@ namespace ts {
resolveObjectTypeMembers(type, source, typeParameters, typeArguments);
}
function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], thisType: Type, parameters: Symbol[],
function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], thisParameter: Symbol | undefined, parameters: Symbol[],
resolvedReturnType: Type, typePredicate: TypePredicate, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature {
const sig = new Signature(checker);
sig.declaration = declaration;
sig.typeParameters = typeParameters;
sig.parameters = parameters;
sig.thisType = thisType;
sig.thisParameter = thisParameter;
sig.resolvedReturnType = resolvedReturnType;
sig.typePredicate = typePredicate;
sig.minArgumentCount = minArgumentCount;
@@ -3914,7 +3912,7 @@ namespace ts {
}
function cloneSignature(sig: Signature): Signature {
return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType,
return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, sig.resolvedReturnType,
sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals);
}
@@ -4012,8 +4010,9 @@ namespace ts {
// Union the result types when more than one signature matches
if (unionSignatures.length > 1) {
s = cloneSignature(signature);
if (forEach(unionSignatures, sig => sig.thisType)) {
s.thisType = getUnionType(map(unionSignatures, sig => sig.thisType || anyType));
if (forEach(unionSignatures, sig => sig.thisParameter)) {
const thisType = getUnionType(map(unionSignatures, sig => getTypeOfSymbol(sig.thisParameter) || anyType));
s.thisParameter = createTransientSymbol(signature.thisParameter, thisType);
}
// Clear resolved return type we possibly got from cloneSignature
s.resolvedReturnType = undefined;
@@ -4466,7 +4465,7 @@ namespace ts {
const parameters: Symbol[] = [];
let hasStringLiterals = false;
let minArgumentCount = -1;
let thisType: Type = undefined;
let thisParameter: Symbol = undefined;
let hasThisParameter: boolean;
const isJSConstructSignature = isJSDocConstructSignature(declaration);
@@ -4484,7 +4483,7 @@ namespace ts {
}
if (i === 0 && paramSymbol.name === "this") {
hasThisParameter = true;
thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType;
thisParameter = param.symbol;
}
else {
parameters.push(paramSymbol);
@@ -4508,10 +4507,12 @@ namespace ts {
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
if ((declaration.kind === SyntaxKind.GetAccessor || declaration.kind === SyntaxKind.SetAccessor) &&
!hasDynamicName(declaration) &&
(!hasThisParameter || thisType === unknownType)) {
(!hasThisParameter || !thisParameter)) {
const otherKind = declaration.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
const setter = <AccessorDeclaration>getDeclarationOfKind(declaration.symbol, otherKind);
thisType = getAnnotatedAccessorThisType(setter);
const other = <AccessorDeclaration>getDeclarationOfKind(declaration.symbol, otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
if (minArgumentCount < 0) {
@@ -4532,7 +4533,7 @@ namespace ts {
createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) :
undefined;
links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasStringLiterals);
links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasStringLiterals);
}
return links.resolvedSignature;
}
@@ -4614,6 +4615,12 @@ namespace ts {
return anyType;
}
function getThisTypeOfSignature(signature: Signature): Type | undefined {
if (signature.thisParameter) {
return getTypeOfSymbol(signature.thisParameter);
}
}
function getReturnTypeOfSignature(signature: Signature): Type {
if (!signature.resolvedReturnType) {
if (!pushTypeResolution(signature, TypeSystemPropertyName.ResolvedReturnType)) {
@@ -5465,7 +5472,7 @@ namespace ts {
freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper);
}
const result = createSignature(signature.declaration, freshTypeParameters,
signature.thisType && instantiateType(signature.thisType, mapper),
signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper),
instantiateList(signature.parameters, mapper, instantiateSymbol),
instantiateType(signature.resolvedReturnType, mapper),
freshTypePredicate,
@@ -5737,17 +5744,22 @@ namespace ts {
target = getErasedSignature(target);
let result = Ternary.True;
if (source.thisType && target.thisType && source.thisType !== voidType) {
// void sources are assignable to anything.
const related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false)
|| compareTypes(target.thisType, source.thisType, reportErrors);
if (!related) {
if (reportErrors) {
errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible);
const sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
const targetThisType = getThisTypeOfSignature(target);
if (targetThisType) {
// void sources are assignable to anything.
const related = compareTypes(sourceThisType, targetThisType, /*reportErrors*/ false)
|| compareTypes(targetThisType, sourceThisType, reportErrors);
if (!related) {
if (reportErrors) {
errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible);
}
return Ternary.False;
}
return Ternary.False;
result &= related;
}
result &= related;
}
const sourceMax = getNumNonRestParameters(source);
@@ -6762,13 +6774,21 @@ namespace ts {
source = getErasedSignature(source);
target = getErasedSignature(target);
let result = Ternary.True;
if (!ignoreThisTypes && source.thisType && target.thisType) {
const related = compareTypes(source.thisType, target.thisType);
if (!related) {
return Ternary.False;
if (!ignoreThisTypes) {
const sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType) {
const targetThisType = getThisTypeOfSignature(target);
if (targetThisType) {
const related = compareTypes(sourceThisType, targetThisType);
if (!related) {
return Ternary.False;
}
result &= related;
}
}
result &= related;
}
const targetLen = target.parameters.length;
for (let i = 0; i < targetLen; i++) {
const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]);
@@ -8594,9 +8614,10 @@ namespace ts {
if (type) {
return type;
}
const signature = getSignatureFromDeclaration(container);
if (signature.thisType) {
return signature.thisType;
const thisType = getThisTypeOfDeclaration(container);
if (thisType) {
return thisType;
}
}
if (isClassLike(container.parent)) {
@@ -8837,7 +8858,7 @@ namespace ts {
if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== SyntaxKind.ArrowFunction) {
const contextualSignature = getContextualSignature(func);
if (contextualSignature) {
return contextualSignature.thisType;
return getThisTypeOfSignature(contextualSignature);
}
}
@@ -10637,10 +10658,11 @@ namespace ts {
context.failedTypeParameterIndex = undefined;
}
if (signature.thisType) {
const thisType = getThisTypeOfSignature(signature);
if (thisType) {
const thisArgumentNode = getThisArgumentOfCall(node);
const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
inferTypes(context, thisArgumentType, signature.thisType);
inferTypes(context, thisArgumentType, thisType);
}
// We perform two passes over the arguments. In the first pass we infer from all arguments, but use
@@ -10716,8 +10738,8 @@ namespace ts {
}
function checkApplicableSignature(node: CallLikeExpression, args: Expression[], signature: Signature, relation: Map<RelationComparisonResult>, excludeArgument: boolean[], reportErrors: boolean) {
if (signature.thisType && signature.thisType !== voidType && node.kind !== SyntaxKind.NewExpression) {
const thisType = getThisTypeOfSignature(signature);
if (thisType && thisType !== voidType && node.kind !== SyntaxKind.NewExpression) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -10725,7 +10747,7 @@ namespace ts {
const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
const errorNode = reportErrors ? (thisArgumentNode || node) : undefined;
const headMessage = Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage)) {
if (!checkTypeRelatedTo(thisArgumentType, getThisTypeOfSignature(signature), relation, errorNode, headMessage)) {
return false;
}
}
@@ -11444,7 +11466,7 @@ namespace ts {
if (getReturnTypeOfSignature(signature) !== voidType) {
error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
}
if (signature.thisType === voidType) {
if (getThisTypeOfSignature(signature) === voidType) {
error(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
}
return signature;
@@ -13482,7 +13504,7 @@ namespace ts {
// TypeScript 1.0 spec (April 2014): 4.5
// If both accessors include type annotations, the specified types must be identical.
checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, Diagnostics.get_and_set_accessor_must_have_the_same_type);
checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, Diagnostics.get_and_set_accessor_must_have_the_same_this_type);
checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, Diagnostics.get_and_set_accessor_must_have_the_same_this_type);
}
}
getTypeOfAccessors(getSymbolOfNode(node));
@@ -17162,6 +17184,15 @@ namespace ts {
return getSymbolOfEntityNameOrPropertyAccessExpression(<EntityName | PropertyAccessExpression>node);
case SyntaxKind.ThisKeyword:
const container = getThisContainer(node, /*includeArrowFunctions*/ false);
if (isFunctionLike(container)) {
const sig = getSignatureFromDeclaration(container);
if (sig.thisParameter) {
return sig.thisParameter;
}
}
// fallthrough
case SyntaxKind.SuperKeyword:
const type = isExpression(node) ? checkExpression(<Expression>node) : getTypeFromTypeNode(<TypeNode>node);
return type.symbol;
@@ -18694,7 +18725,7 @@ namespace ts {
return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === SyntaxKind.GetAccessor ? 0 : 1);
}
function getAccessorThisParameter(accessor: AccessorDeclaration) {
function getAccessorThisParameter(accessor: AccessorDeclaration): ParameterDeclaration {
if (accessor.parameters.length === (accessor.kind === SyntaxKind.GetAccessor ? 1 : 2) &&
accessor.parameters[0].name.kind === SyntaxKind.Identifier &&
(<Identifier>accessor.parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword) {
+9 -5
View File
@@ -3,22 +3,26 @@
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"out": "../../built/local/tsc.js",
"sourceMap": true
"outFile": "../../built/local/tsc.js",
"sourceMap": true,
"declaration": true,
"stripInternal": true
},
"files": [
"types.ts",
"core.ts",
"sys.ts",
"diagnosticInformationMap.generated.ts",
"types.ts",
"scanner.ts",
"parser.ts",
"utilities.ts",
"binder.ts",
"checker.ts",
"sourcemap.ts",
"declarationEmitter.ts",
"emitter.ts",
"program.ts",
"commandLineParser.ts",
"tsc.ts"
"tsc.ts",
"diagnosticInformationMap.generated.ts"
]
}
+3 -2
View File
@@ -1874,7 +1874,7 @@ namespace ts {
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
}
@@ -2394,7 +2394,8 @@ namespace ts {
declaration: SignatureDeclaration; // Originating declaration
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
parameters: Symbol[]; // Parameters
thisType?: Type; // type of this-type
/* @internal */
thisParameter?: Symbol; // symbol of this-type parameter
/* @internal */
resolvedReturnType: Type; // Resolved return type
/* @internal */
+4 -4
View File
@@ -879,13 +879,13 @@ namespace FourSlash {
assert.equal(getDisplayPartsJson(actualQuickInfo.documentation), getDisplayPartsJson(documentation), this.messageAtLastKnownMarker("QuickInfo documentation"));
}
public verifyRenameLocations(findInStrings: boolean, findInComments: boolean) {
public verifyRenameLocations(findInStrings: boolean, findInComments: boolean, ranges?: Range[]) {
const renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
if (renameInfo.canRename) {
let references = this.languageService.findRenameLocations(
this.activeFile.fileName, this.currentCaretPosition, findInStrings, findInComments);
let ranges = this.getRanges();
ranges = ranges || this.getRanges();
if (!references) {
if (ranges.length !== 0) {
@@ -3129,8 +3129,8 @@ namespace FourSlashInterface {
this.state.verifyRenameInfoFailed(message);
}
public renameLocations(findInStrings: boolean, findInComments: boolean) {
this.state.verifyRenameLocations(findInStrings, findInComments);
public renameLocations(findInStrings: boolean, findInComments: boolean, ranges?: FourSlash.Range[]) {
this.state.verifyRenameLocations(findInStrings, findInComments, ranges);
}
public verifyQuickInfoDisplayParts(kind: string, kindModifiers: string, textSpan: { start: number; length: number; },
+26 -1
View File
@@ -904,7 +904,6 @@ declare namespace ts.server.protocol {
* Arguments of a signature help request.
*/
export interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
}
/**
@@ -923,6 +922,32 @@ declare namespace ts.server.protocol {
body?: SignatureHelpItems;
}
/**
* Synchronous request for semantic diagnostics of one file.
*/
export interface SemanticDiagnosticsSyncRequest extends FileRequest {
}
/**
* Response object for synchronous sematic diagnostics request.
*/
export interface SemanticDiagnosticsSyncResponse extends Response {
body?: Diagnostic[];
}
/**
* Synchronous request for syntactic diagnostics of one file.
*/
export interface SyntacticDiagnosticsSyncRequest extends FileRequest {
}
/**
* Response object for synchronous syntactic diagnostics request.
*/
export interface SyntacticDiagnosticsSyncResponse extends Response {
body?: Diagnostic[];
}
/**
* Arguments for GeterrForProject request.
*/
+35 -1
View File
@@ -111,6 +111,8 @@ namespace ts.server {
export const Formatonkey = "formatonkey";
export const Geterr = "geterr";
export const GeterrForProject = "geterrForProject";
export const SemanticDiagnosticsSync = "semanticDiagnosticsSync";
export const SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
export const NavBar = "navbar";
export const Navto = "navto";
export const Occurrences = "occurrences";
@@ -130,6 +132,7 @@ namespace ts.server {
namespace Errors {
export const NoProject = new Error("No Project.");
export const ProjectLanguageServiceDisabled = new Error("The project's language service is disabled.");
}
export interface ServerHost extends ts.System {
@@ -384,6 +387,27 @@ namespace ts.server {
});
}
private getDiagnosticsWorker(args: protocol.FileRequestArgs, selector: (project: Project, file: string) => Diagnostic[]) {
const file = normalizePath(args.file);
const project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
if (project.languageServiceDiabled) {
throw Errors.ProjectLanguageServiceDisabled;
}
const diagnostics = selector(project, file);
return ts.map(diagnostics, originalDiagnostic => formatDiag(file, project, originalDiagnostic));
}
private getSyntacticDiagnosticsSync(args: protocol.FileRequestArgs): protocol.Diagnostic[] {
return this.getDiagnosticsWorker(args, (project, file) => project.compilerService.languageService.getSyntacticDiagnostics(file));
}
private getSemanticDiagnosticsSync(args: protocol.FileRequestArgs): protocol.Diagnostic[] {
return this.getDiagnosticsWorker(args, (project, file) => project.compilerService.languageService.getSemanticDiagnostics(file));
}
private getDocumentHighlights(line: number, offset: number, fileName: string, filesToSearch: string[]): protocol.DocumentHighlightsItem[] {
fileName = ts.normalizePath(fileName);
const project = this.projectService.getProjectForFile(fileName);
@@ -1032,6 +1056,10 @@ namespace ts.server {
exit() {
}
private requiredResponse(response: any) {
return { response, responseRequired: true };
}
private handlers: Map<(request: protocol.Request) => { response?: any, responseRequired?: boolean }> = {
[CommandNames.Exit]: () => {
this.exit();
@@ -1100,6 +1128,12 @@ namespace ts.server {
const signatureHelpArgs = <protocol.SignatureHelpRequestArgs>request.arguments;
return { response: this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file), responseRequired: true };
},
[CommandNames.SemanticDiagnosticsSync]: (request: protocol.FileRequest) => {
return this.requiredResponse(this.getSemanticDiagnosticsSync(request.arguments));
},
[CommandNames.SyntacticDiagnosticsSync]: (request: protocol.FileRequest) => {
return this.requiredResponse(this.getSyntacticDiagnosticsSync(request.arguments));
},
[CommandNames.Geterr]: (request: protocol.Request) => {
const geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
return { response: this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false };
@@ -1123,7 +1157,7 @@ namespace ts.server {
[CommandNames.Reload]: (request: protocol.Request) => {
const reloadArgs = <protocol.ReloadRequestArgs>request.arguments;
this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
return {response: { reloadFinished: true }, responseRequired: true};
return { response: { reloadFinished: true }, responseRequired: true };
},
[CommandNames.Saveto]: (request: protocol.Request) => {
const savetoArgs = <protocol.SavetoRequestArgs>request.arguments;
+6 -3
View File
@@ -4,13 +4,16 @@
"removeComments": true,
"preserveConstEnums": true,
"out": "../../built/local/tsserver.js",
"sourceMap": true
"sourceMap": true,
"stripInternal": true
},
"files": [
"../services/shims.ts",
"../services/utilities.ts",
"node.d.ts",
"editorServices.ts",
"protocol.d.ts",
"server.ts",
"session.ts"
"session.ts",
"server.ts"
]
}
+29 -14
View File
@@ -779,7 +779,7 @@ namespace ts {
declaration: SignatureDeclaration;
typeParameters: TypeParameter[];
parameters: Symbol[];
thisType: Type;
thisParameter: Symbol;
resolvedReturnType: Type;
minArgumentCount: number;
hasRestParameter: boolean;
@@ -5819,17 +5819,32 @@ namespace ts {
return undefined;
}
if (node.kind !== SyntaxKind.Identifier &&
// TODO (drosen): This should be enabled in a later release - currently breaks rename.
// node.kind !== SyntaxKind.ThisKeyword &&
// node.kind !== SyntaxKind.SuperKeyword &&
node.kind !== SyntaxKind.StringLiteral &&
!isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
return undefined;
switch (node.kind) {
case SyntaxKind.NumericLiteral:
if (!isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
break;
}
// Fallthrough
case SyntaxKind.Identifier:
case SyntaxKind.ThisKeyword:
// case SyntaxKind.SuperKeyword: TODO:GH#9268
case SyntaxKind.StringLiteral:
return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments);
}
return undefined;
}
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.NumericLiteral || node.kind === SyntaxKind.StringLiteral);
return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments);
function isThis(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ThisKeyword:
// case SyntaxKind.ThisType: TODO: GH#9267
return true;
case SyntaxKind.Identifier:
// 'this' as a parameter
return (node as Identifier).originalKeywordKind === SyntaxKind.ThisKeyword && node.parent.kind === SyntaxKind.Parameter;
default:
return false;
}
}
function getReferencedSymbolsForNode(node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean): ReferencedSymbol[] {
@@ -5849,7 +5864,7 @@ namespace ts {
}
}
if (node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.ThisType) {
if (isThis(node)) {
return getReferencesForThisKeyword(node, sourceFiles);
}
@@ -6384,7 +6399,7 @@ namespace ts {
cancellationToken.throwIfCancellationRequested();
const node = getTouchingWord(sourceFile, position);
if (!node || (node.kind !== SyntaxKind.ThisKeyword && node.kind !== SyntaxKind.ThisType)) {
if (!node || !isThis(node)) {
return;
}
@@ -8012,11 +8027,11 @@ namespace ts {
const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
// Can only rename an identifier.
if (node) {
if (node.kind === SyntaxKind.Identifier ||
node.kind === SyntaxKind.StringLiteral ||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
isThis(node)) {
const symbol = typeChecker.getSymbolAtLocation(node);
// Only allow a symbol to be renamed if it actually has at least one declaration.
+5 -5
View File
@@ -357,8 +357,8 @@ namespace ts.SignatureHelp {
}
function getArgumentIndex(argumentsList: Node, node: Node) {
// The list we got back can include commas. In the presence of errors it may
// also just have nodes without commas. For example "Foo(a b c)" will have 3
// The list we got back can include commas. In the presence of errors it may
// also just have nodes without commas. For example "Foo(a b c)" will have 3
// args without commas. We want to find what index we're at. So we count
// forward until we hit ourselves, only incrementing the index if it isn't a
// comma.
@@ -390,8 +390,8 @@ namespace ts.SignatureHelp {
// 'a' '<comma>'. So, in the case where the last child is a comma, we increase the
// arg count by one to compensate.
//
// Note: this subtlety only applies to the last comma. If you had "Foo(a,," then
// we'll have: 'a' '<comma>' '<missing>'
// Note: this subtlety only applies to the last comma. If you had "Foo(a,," then
// we'll have: 'a' '<comma>' '<missing>'
// That will give us 2 non-commas. We then add one for the last comma, givin us an
// arg count of 3.
const listChildren = argumentsList.getChildren();
@@ -563,7 +563,7 @@ namespace ts.SignatureHelp {
signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken));
const parameterParts = mapToDisplayParts(writer =>
typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation));
typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation));
addRange(suffixDisplayParts, parameterParts);
}
else {
+9 -5
View File
@@ -1,10 +1,13 @@
{
"compilerOptions": {
"noImplicitAny": true,
"removeComments": true,
"removeComments": false,
"preserveConstEnums": true,
"out": "../../built/local/typescriptServices.js",
"sourceMap": true
"outFile": "../../built/local/typescriptServices.js",
"sourceMap": true,
"stripInternal": true,
"noResolve": false,
"declaration": true
},
"files": [
"../compiler/core.ts",
@@ -15,11 +18,12 @@
"../compiler/utilities.ts",
"../compiler/binder.ts",
"../compiler/checker.ts",
"../compiler/sourcemap.ts",
"../compiler/declarationEmitter.ts",
"../compiler/emitter.ts",
"../compiler/program.ts",
"../compiler/declarationEmitter.ts",
"../compiler/diagnosticInformationMap.generated.ts",
"../compiler/commandLineParser.ts",
"../compiler/diagnosticInformationMap.generated.ts",
"breakpoints.ts",
"navigateTo.ts",
"navigationBar.ts",
@@ -30,7 +30,7 @@ function weird(this: Example, a = this.getNumber()) {
>Example : Symbol(Example, Decl(inferParameterWithMethodCallInitializer.ts, 2, 1))
>a : Symbol(a, Decl(inferParameterWithMethodCallInitializer.ts, 11, 29))
>this.getNumber : Symbol(Example.getNumber, Decl(inferParameterWithMethodCallInitializer.ts, 3, 15))
>this : Symbol(Example, Decl(inferParameterWithMethodCallInitializer.ts, 2, 1))
>this : Symbol(this, Decl(inferParameterWithMethodCallInitializer.ts, 11, 15))
>getNumber : Symbol(Example.getNumber, Decl(inferParameterWithMethodCallInitializer.ts, 3, 15))
return a;
@@ -45,7 +45,7 @@ class Weird {
>Example : Symbol(Example, Decl(inferParameterWithMethodCallInitializer.ts, 2, 1))
>a : Symbol(a, Decl(inferParameterWithMethodCallInitializer.ts, 15, 30))
>this.getNumber : Symbol(Example.getNumber, Decl(inferParameterWithMethodCallInitializer.ts, 3, 15))
>this : Symbol(Example, Decl(inferParameterWithMethodCallInitializer.ts, 2, 1))
>this : Symbol(this, Decl(inferParameterWithMethodCallInitializer.ts, 15, 16))
>getNumber : Symbol(Example.getNumber, Decl(inferParameterWithMethodCallInitializer.ts, 3, 15))
return a;
@@ -20,7 +20,7 @@ const explicit = {
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 7, 10))
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 7, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
set x(this: Foo, n: number) { this.n = n; }
@@ -29,7 +29,7 @@ const explicit = {
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 8, 20))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 8, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 8, 20))
}
@@ -44,14 +44,14 @@ const copiedFromGetter = {
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 12, 10))
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 12, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
set x(n) { this.n = n; }
>x : Symbol(x, Decl(thisTypeInAccessors.ts, 11, 10), Decl(thisTypeInAccessors.ts, 12, 48))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 13, 10))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 12, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 13, 10))
}
@@ -64,7 +64,7 @@ const copiedFromSetter = {
get x() { return this.n },
>x : Symbol(x, Decl(thisTypeInAccessors.ts, 16, 10), Decl(thisTypeInAccessors.ts, 17, 30))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 18, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
set x(this: Foo, n: number) { this.n = n; }
@@ -73,7 +73,7 @@ const copiedFromSetter = {
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 18, 20))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 18, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 18, 20))
}
@@ -88,7 +88,7 @@ const copiedFromGetterUnannotated = {
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 22, 10))
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 22, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
set x(this, n) { this.n = n; }
@@ -96,7 +96,7 @@ const copiedFromGetterUnannotated = {
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 23, 10))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 23, 15))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 23, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 23, 15))
}
@@ -112,7 +112,7 @@ class Explicit {
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 28, 10))
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 28, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
set x(this: Foo, n: number) { this.n = n; }
@@ -121,7 +121,7 @@ class Explicit {
>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 29, 20))
>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInAccessors.ts, 29, 10))
>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15))
>n : Symbol(n, Decl(thisTypeInAccessors.ts, 29, 20))
}
@@ -19,7 +19,7 @@ class C {
return this.n + m;
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 6, 17))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 6, 28))
}
@@ -31,7 +31,7 @@ class C {
return this.n + m;
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 9, 14))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 9, 22))
}
@@ -43,7 +43,7 @@ class C {
return this.n + m;
>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 12, 26))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 12, 21))
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 12, 39))
}
@@ -97,7 +97,7 @@ function explicitStructural(this: { y: number }, x: number): number {
return x + this.y;
>x : Symbol(x, Decl(thisTypeInFunctions.ts, 28, 48))
>this.y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 28, 33))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 28, 28))
>y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35))
}
function justThis(this: { y: number }): number {
@@ -107,7 +107,7 @@ function justThis(this: { y: number }): number {
return this.y;
>this.y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 31, 23))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 31, 18))
>y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25))
}
function implicitThis(n: number): number {
@@ -435,7 +435,7 @@ c.explicitC = function(this: C, m: number) { return this.n + m };
>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 105, 31))
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 105, 23))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 105, 31))
@@ -453,7 +453,7 @@ c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 107, 48))
>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 107, 35))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 107, 30))
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 107, 48))
@@ -525,7 +525,7 @@ c.explicitThis = function(this: C, m: number) { return this.n + m };
>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 123, 34))
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 123, 26))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 123, 34))
@@ -568,7 +568,7 @@ c.explicitThis = function(this, m) { return this.n + m };
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 131, 26))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 131, 31))
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 131, 26))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 131, 31))
@@ -581,7 +581,7 @@ c.explicitC = function(this: B, m: number) { return this.n + m };
>B : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 134, 31))
>this.n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9))
>this : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 134, 23))
>n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 134, 31))
@@ -604,7 +604,7 @@ class Base1 {
>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 142, 23))
>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13))
>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 142, 23))
>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13))
explicit(this: Base1): number { return this.x; }
@@ -612,7 +612,7 @@ class Base1 {
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 143, 13))
>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13))
>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 143, 13))
>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13))
static explicitStatic(this: typeof Base1): number { return this.y; }
@@ -620,7 +620,7 @@ class Base1 {
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 144, 26))
>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this.y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72))
>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 144, 26))
>y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72))
static y: number;
@@ -643,7 +643,7 @@ class Base2 {
>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 152, 16))
>this.y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13))
>this : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 152, 16))
>y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13))
explicit(this: Base1): number { return this.x; }
@@ -651,7 +651,7 @@ class Base2 {
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 153, 13))
>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13))
>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 153, 13))
>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13))
}
class Derived2 extends Base2 {
@@ -734,7 +734,7 @@ function InterfaceThis(this: I) {
this.a = 12;
>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 172, 23))
>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
}
function LiteralTypeThis(this: {x: string}) {
@@ -744,7 +744,7 @@ function LiteralTypeThis(this: {x: string}) {
this.x = "ok";
>this.x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 175, 30))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 175, 25))
>x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32))
}
function AnyThis(this: any) {
@@ -752,6 +752,7 @@ function AnyThis(this: any) {
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 178, 17))
this.x = "ok";
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 178, 17))
}
let interfaceThis = new InterfaceThis();
>interfaceThis : Symbol(interfaceThis, Decl(thisTypeInFunctions.ts, 181, 3))
@@ -793,5 +794,6 @@ function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; }
>missingTypeIsImplicitAny : Symbol(missingTypeIsImplicitAny, Decl(thisTypeInFunctions.ts, 190, 27))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 192, 34))
>a : Symbol(a, Decl(thisTypeInFunctions.ts, 192, 39))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 192, 34))
>a : Symbol(a, Decl(thisTypeInFunctions.ts, 192, 39))
@@ -692,11 +692,11 @@ c.explicitThis = function(m) { return this.n + m };
// this: contextual typing
c.explicitThis = function(this, m) { return this.n + m };
>c.explicitThis = function(this, m) { return this.n + m } : (this: any, m: number) => number
>c.explicitThis = function(this, m) { return this.n + m } : (this: C, m: number) => number
>c.explicitThis : (this: C, m: number) => number
>c : C
>explicitThis : (this: C, m: number) => number
>function(this, m) { return this.n + m } : (this: any, m: number) => number
>function(this, m) { return this.n + m } : (this: C, m: number) => number
>this : C
>m : number
>this.n + m : number
@@ -0,0 +1,33 @@
/// <reference path='fourslash.ts' />
// @noLib: true
////[|this|];
////function f([|this|]) {
//// return [|this|];
//// function g([|this|]) { return [|this|]; }
////}
////class C {
//// static x() {
//// [|this|];
//// }
//// static y() {
//// () => [|this|];
//// }
//// constructor() {
//// [|this|];
//// }
//// method() {
//// () => [|this|];
//// }
////}
////// These are *not* real uses of the 'this' keyword, they are identifiers.
////const x = { [|this|]: 0 }
////x.[|this|];
const [global, f0, f1, g0, g1, x, y, constructor, method, propDef, propUse] = test.ranges();
verify.referencesOf(global, [global]);
verify.rangesReferenceEachOther([f0, f1]);
verify.rangesReferenceEachOther([g0, g1]);
verify.rangesReferenceEachOther([x, y]);
verify.rangesReferenceEachOther([constructor, method]);
verify.rangesReferenceEachOther([propDef, propUse]);
@@ -1,18 +1,15 @@
/// <reference path='fourslash.ts' />
// @Filename: file1.ts
////this; this;
////[|this|]; [|this|];
// @Filename: file2.ts
////this;
////this;
////[|this|];
////[|this|];
// @Filename: file3.ts
//// ((x = this, y) => t/**/his)(this, this);
//// ((x = [|this|], y) => [|this|])([|this|], [|this|]);
//// // different 'this'
//// function f(this) { return this; }
goTo.file("file1.ts");
goTo.marker();
// TODO (drosen): The CURRENT behavior is that findAllRefs doesn't work on 'this' or 'super' keywords.
// This should change down the line.
verify.referencesAre([]);
verify.rangesReferenceEachOther();
+1 -1
View File
@@ -217,7 +217,7 @@ declare namespace FourSlashInterface {
}[]): void;
renameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string): void;
renameInfoFailed(message?: string): void;
renameLocations(findInStrings: boolean, findInComments: boolean): void;
renameLocations(findInStrings: boolean, findInComments: boolean, ranges?: Range[]): void;
verifyQuickInfoDisplayParts(kind: string, kindModifiers: string, textSpan: {
start: number;
length: number;
@@ -0,0 +1,20 @@
/// <reference path='fourslash.ts'/>
// @noLib: true
////function f(/*fnDecl*/this: number) {
//// return /*fnUse*/this;
////}
/////*cls*/class C {
//// constructor() { return /*clsUse*/this; }
//// get self(/*getterDecl*/this: number) { return /*getterUse*/this; }
////}
function verifyDefinition(a, b) {
goTo.marker(a);
goTo.definition();
verify.caretAtMarker(b);
}
verifyDefinition("fnUse", "fnDecl");
verifyDefinition("clsUse", "cls");
verifyDefinition("getterUse", "getterDecl");
+1 -1
View File
@@ -25,7 +25,7 @@
goTo.marker('0');
verify.quickInfoIs('this: this');
goTo.marker('1');
verify.quickInfoIs('void');
verify.quickInfoIs('this: void');
goTo.marker('2');
verify.quickInfoIs('this: this');
goTo.marker('3');
+1 -1
View File
@@ -20,7 +20,7 @@ verify.quickInfoIs('any');
goTo.marker('2');
verify.quickInfoIs('(parameter) this: void');
goTo.marker('3');
verify.quickInfoIs('void');
verify.quickInfoIs('this: void');
goTo.marker('4');
verify.quickInfoIs('(parameter) this: Restricted');
goTo.marker('5');
+22
View File
@@ -0,0 +1,22 @@
/// <reference path='fourslash.ts'/>
////function f([|this|]) {
//// return [|this|];
////}
////this/**/;
////const _ = { [|this|]: 0 }.[|this|];
let [r0, r1, r2, r3] = test.ranges()
for (let range of [r0, r1]) {
goTo.position(range.start);
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false, [r0, r1]);
}
// Trying to rename a non-parameter 'this' should fail
goTo.marker();
verify.renameInfoFailed("You cannot rename this element.");
for (let range of [r2, r3]) {
goTo.position(range.start);
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false, [r2, r3]);
}
+7 -7
View File
@@ -589,7 +589,7 @@ import b = require("./moduleB.ts");
const file1: File = { name: "/root/folder1/file1.ts" };
const file2: File = { name: "/root/generated/folder1/file2.ts" }; // load remapped file as module
const file3: File = { name: "/root/generated/folder2/file3/index.d.ts" }; // load folder a module
const file4Typings: File = { name: "/root/generated/folder2/file4/package.json", content: JSON.stringify({ typings: "dist/types.d.ts" })};
const file4Typings: File = { name: "/root/generated/folder2/file4/package.json", content: JSON.stringify({ typings: "dist/types.d.ts" }) };
const file4: File = { name: "/root/generated/folder2/file4/dist/types.d.ts" }; // load file pointed by typings
const file5: File = { name: "/root/someanotherfolder/file5/index.d.ts" }; // load remapped module from folder
const file6: File = { name: "/root/node_modules/file6.ts" }; // fallback to node
@@ -957,7 +957,7 @@ import b = require("./moduleB.ts");
describe("Type reference directive resolution: ", () => {
function test(typesRoot: string, typeDirective: string, primary: boolean, initialFile: File, targetFile: File, ...otherFiles: File[]) {
const host = createModuleResolutionHost(/*hasDirectoryExists*/ false, ...[initialFile, targetFile].concat(...otherFiles));
const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, {typeRoots: [typesRoot]}, host);
const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, { typeRoots: [typesRoot] }, host);
assert(result.resolvedTypeReferenceDirective.resolvedFileName !== undefined, "expected type directive to be resolved");
assert.equal(result.resolvedTypeReferenceDirective.resolvedFileName, targetFile.name, "unexpected result of type reference resolution");
assert.equal(result.resolvedTypeReferenceDirective.primary, primary, "unexpected 'primary' value");
@@ -972,7 +972,7 @@ import b = require("./moduleB.ts");
{
const f1 = { name: "/root/src/app.ts" };
const f2 = { name: "/root/src/types/lib/typings/lib.d.ts" };
const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) };
const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) };
test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ true, f1, f2, package);
}
{
@@ -983,7 +983,7 @@ import b = require("./moduleB.ts");
{
const f1 = { name: "/root/src/app.ts" };
const f2 = { name: "/root/src/node_modules/lib/typings/lib.d.ts" };
const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) };
const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) };
test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package);
}
{
@@ -994,7 +994,7 @@ import b = require("./moduleB.ts");
{
const f1 = { name: "/root/src/app.ts" };
const f2 = { name: "/root/src/node_modules/@types/lib/typings/lib.d.ts" };
const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) };
const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) };
test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package);
}
});
@@ -1012,7 +1012,7 @@ import b = require("./moduleB.ts");
{
const f1 = { name: "/root/src/app.ts" };
const f2 = { name: "/root/node_modules/lib/typings/lib.d.ts" };
const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) };
const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) };
test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package);
}
{
@@ -1023,7 +1023,7 @@ import b = require("./moduleB.ts");
{
const f1 = { name: "/root/src/app.ts" };
const f2 = { name: "/root/node_modules/@types/lib/typings/lib.d.ts" };
const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) };
const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) };
test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package);
}
});
+3 -3
View File
@@ -170,7 +170,7 @@ namespace ts.server {
describe("send", () => {
it("is an overrideable handle which sends protocol messages over the wire", () => {
const msg = {seq: 0, type: "none"};
const msg = { seq: 0, type: "none" };
const strmsg = JSON.stringify(msg);
const len = 1 + Utils.byteLength(strmsg, "utf8");
const resultMsg = `Content-Length: ${len}\r\n\r\n${strmsg}\n`;
@@ -266,7 +266,7 @@ namespace ts.server {
constructor() {
super(mockHost, Utils.byteLength, process.hrtime, mockLogger);
this.addProtocolHandler(this.customHandler, () => {
return {response: undefined, responseRequired: true};
return { response: undefined, responseRequired: true };
});
}
send(msg: protocol.Message) {
@@ -340,7 +340,7 @@ namespace ts.server {
handleRequest(msg: protocol.Request) {
let response: protocol.Response;
try {
({response} = this.executeCommand(msg));
({ response } = this.executeCommand(msg));
}
catch (e) {
this.output(undefined, msg.command, msg.seq, e.toString());
+48 -48
View File
@@ -239,195 +239,195 @@ var x = 0;`, {
});
transpilesCorrectly("Supports setting 'allowJs'", "x;", {
options: { compilerOptions: { allowJs: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { allowJs: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'allowSyntheticDefaultImports'", "x;", {
options: { compilerOptions: { allowSyntheticDefaultImports: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { allowSyntheticDefaultImports: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'allowUnreachableCode'", "x;", {
options: { compilerOptions: { allowUnreachableCode: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { allowUnreachableCode: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'allowUnusedLabels'", "x;", {
options: { compilerOptions: { allowUnusedLabels: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { allowUnusedLabels: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'baseUrl'", "x;", {
options: { compilerOptions: { baseUrl: "./folder/baseUrl" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { baseUrl: "./folder/baseUrl" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'charset'", "x;", {
options: { compilerOptions: { charset: "en-us" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { charset: "en-us" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'declaration'", "x;", {
options: { compilerOptions: { declaration: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { declaration: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'declarationDir'", "x;", {
options: { compilerOptions: { declarationDir: "out/declarations" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { declarationDir: "out/declarations" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'emitBOM'", "x;", {
options: { compilerOptions: { emitBOM: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { emitBOM: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'emitDecoratorMetadata'", "x;", {
options: { compilerOptions: { emitDecoratorMetadata: true, experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { emitDecoratorMetadata: true, experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'experimentalDecorators'", "x;", {
options: { compilerOptions: { experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'forceConsistentCasingInFileNames'", "x;", {
options: { compilerOptions: { forceConsistentCasingInFileNames: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { forceConsistentCasingInFileNames: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'isolatedModules'", "x;", {
options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'jsx'", "x;", {
options: { compilerOptions: { jsx: 1 }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { jsx: 1 }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'lib'", "x;", {
options: { compilerOptions: { lib: ["es2015", "dom"] }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { lib: ["es2015", "dom"] }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'locale'", "x;", {
options: { compilerOptions: { locale: "en-us" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { locale: "en-us" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'module'", "x;", {
options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'moduleResolution'", "x;", {
options: { compilerOptions: { moduleResolution: ModuleResolutionKind.NodeJs }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { moduleResolution: ModuleResolutionKind.NodeJs }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'newLine'", "x;", {
options: { compilerOptions: { newLine: NewLineKind.CarriageReturnLineFeed }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { newLine: NewLineKind.CarriageReturnLineFeed }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noEmit'", "x;", {
options: { compilerOptions: { noEmit: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noEmit: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noEmitHelpers'", "x;", {
options: { compilerOptions: { noEmitHelpers: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noEmitHelpers: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noEmitOnError'", "x;", {
options: { compilerOptions: { noEmitOnError: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noEmitOnError: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noErrorTruncation'", "x;", {
options: { compilerOptions: { noErrorTruncation: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noErrorTruncation: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noFallthroughCasesInSwitch'", "x;", {
options: { compilerOptions: { noFallthroughCasesInSwitch: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noFallthroughCasesInSwitch: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noImplicitAny'", "x;", {
options: { compilerOptions: { noImplicitAny: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noImplicitAny: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noImplicitReturns'", "x;", {
options: { compilerOptions: { noImplicitReturns: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noImplicitReturns: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noImplicitThis'", "x;", {
options: { compilerOptions: { noImplicitThis: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noImplicitThis: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noImplicitUseStrict'", "x;", {
options: { compilerOptions: { noImplicitUseStrict: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noImplicitUseStrict: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noLib'", "x;", {
options: { compilerOptions: { noLib: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noLib: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'noResolve'", "x;", {
options: { compilerOptions: { noResolve: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { noResolve: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'out'", "x;", {
options: { compilerOptions: { out: "./out" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { out: "./out" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'outDir'", "x;", {
options: { compilerOptions: { outDir: "./outDir" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { outDir: "./outDir" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'outFile'", "x;", {
options: { compilerOptions: { outFile: "./outFile" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { outFile: "./outFile" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'paths'", "x;", {
options: { compilerOptions: { paths: { "*": ["./generated*"] } }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { paths: { "*": ["./generated*"] } }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'preserveConstEnums'", "x;", {
options: { compilerOptions: { preserveConstEnums: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { preserveConstEnums: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'reactNamespace'", "x;", {
options: { compilerOptions: { reactNamespace: "react" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { reactNamespace: "react" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'removeComments'", "x;", {
options: { compilerOptions: { removeComments: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { removeComments: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'rootDir'", "x;", {
options: { compilerOptions: { rootDir: "./rootDir" }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { rootDir: "./rootDir" }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'rootDirs'", "x;", {
options: { compilerOptions: { rootDirs: ["./a", "./b"] }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { rootDirs: ["./a", "./b"] }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'skipLibCheck'", "x;", {
options: { compilerOptions: { skipLibCheck: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { skipLibCheck: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'skipDefaultLibCheck'", "x;", {
options: { compilerOptions: { skipDefaultLibCheck: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { skipDefaultLibCheck: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'strictNullChecks'", "x;", {
options: { compilerOptions: { strictNullChecks: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { strictNullChecks: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'stripInternal'", "x;", {
options: { compilerOptions: { stripInternal: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { stripInternal: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'suppressExcessPropertyErrors'", "x;", {
options: { compilerOptions: { suppressExcessPropertyErrors: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { suppressExcessPropertyErrors: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'suppressImplicitAnyIndexErrors'", "x;", {
options: { compilerOptions: { suppressImplicitAnyIndexErrors: true }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { suppressImplicitAnyIndexErrors: true }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'target'", "x;", {
options: { compilerOptions: { target: 2 }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { target: 2 }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'types'", "x;", {
options: { compilerOptions: { types: ["jquery", "jasmine"] }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { types: ["jquery", "jasmine"] }, fileName: "input.js", reportDiagnostics: true }
});
transpilesCorrectly("Supports setting 'typeRoots'", "x;", {
options: { compilerOptions: { typeRoots: ["./folder"] }, fileName: "input.js", reportDiagnostics: true }
options: { compilerOptions: { typeRoots: ["./folder"] }, fileName: "input.js", reportDiagnostics: true }
});
});
}
+2 -1
View File
@@ -44,6 +44,7 @@
"type-operator-spacing": true,
"prefer-const": true,
"no-in-operator": true,
"no-increment-decrement": true
"no-increment-decrement": true,
"object-literal-surrounding-space": true
}
}