mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into ownJsonParsing
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
built
|
||||
doc
|
||||
Gulpfile.ts
|
||||
internal
|
||||
issue_template.md
|
||||
jenkins.sh
|
||||
lib/README.md
|
||||
netci.groovy
|
||||
pull_request_template.md
|
||||
scripts
|
||||
src
|
||||
|
||||
Vendored
+1728
-2600
File diff suppressed because it is too large
Load Diff
Vendored
+1687
-2599
File diff suppressed because it is too large
Load Diff
Vendored
+4
-4
@@ -225,13 +225,13 @@ interface NumberConstructor {
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isFinite(value: any): value is number;
|
||||
isFinite(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is an integer, false otherwise.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isInteger(value: any): value is number;
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
@@ -239,13 +239,13 @@ interface NumberConstructor {
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isNaN(value: any): value is number;
|
||||
isNaN(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is a safe integer.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isSafeInteger(value: any): value is number;
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
|
||||
Vendored
+9
@@ -27,6 +27,15 @@ interface Array<T> {
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
|
||||
Vendored
+12
-1
@@ -24,11 +24,22 @@ interface ObjectConstructor {
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
values<T>(o: { [s: string]: T }): T[];
|
||||
|
||||
/**
|
||||
* Returns an array of values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
values(o: any): any[];
|
||||
|
||||
/**
|
||||
* Returns an array of key/values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
entries<T>(o: { [s: string]: T }): [string, T][];
|
||||
|
||||
/**
|
||||
* Returns an array of key/values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
entries<T extends { [key: string]: any }, K extends keyof T>(o: T): [keyof T, T[K]][];
|
||||
entries(o: any): [string, any][];
|
||||
}
|
||||
|
||||
Vendored
+41
-1
@@ -200,7 +200,19 @@ interface ObjectConstructor {
|
||||
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
||||
* @param o Object on which to lock the attributes.
|
||||
*/
|
||||
freeze<T>(o: T): T;
|
||||
freeze<T>(a: T[]): ReadonlyArray<T>;
|
||||
|
||||
/**
|
||||
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
||||
* @param o Object on which to lock the attributes.
|
||||
*/
|
||||
freeze<T extends Function>(f: T): T;
|
||||
|
||||
/**
|
||||
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
||||
* @param o Object on which to lock the attributes.
|
||||
*/
|
||||
freeze<T>(o: T): Readonly<T>;
|
||||
|
||||
/**
|
||||
* Prevents the addition of new properties to an object.
|
||||
@@ -1363,6 +1375,34 @@ interface ArrayLike<T> {
|
||||
readonly [n: number]: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make all properties in T optional
|
||||
*/
|
||||
type Partial<T> = {
|
||||
[P in keyof T]?: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* Make all properties in T readonly
|
||||
*/
|
||||
type Readonly<T> = {
|
||||
readonly [P in keyof T]: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* From T pick a set of properties K
|
||||
*/
|
||||
type Pick<T, K extends keyof T> = {
|
||||
[P in K]: T[P];
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a type with a set of properties K of type T
|
||||
*/
|
||||
type Record<K extends string, T> = {
|
||||
[P in K]: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a raw buffer of binary data, which is used to store data for the
|
||||
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
||||
|
||||
Vendored
+1732
-2604
File diff suppressed because it is too large
Load Diff
Vendored
+131
-83
@@ -28,6 +28,7 @@ interface Algorithm {
|
||||
}
|
||||
|
||||
interface EventInit {
|
||||
scoped?: boolean;
|
||||
bubbles?: boolean;
|
||||
cancelable?: boolean;
|
||||
}
|
||||
@@ -262,10 +263,12 @@ interface Event {
|
||||
readonly target: EventTarget;
|
||||
readonly timeStamp: number;
|
||||
readonly type: string;
|
||||
readonly scoped: boolean;
|
||||
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
|
||||
preventDefault(): void;
|
||||
stopImmediatePropagation(): void;
|
||||
stopPropagation(): void;
|
||||
deepPath(): EventTarget[];
|
||||
readonly AT_TARGET: number;
|
||||
readonly BUBBLING_PHASE: number;
|
||||
readonly CAPTURING_PHASE: number;
|
||||
@@ -318,6 +321,7 @@ interface FileReader extends EventTarget, MSBaseReader {
|
||||
readAsBinaryString(blob: Blob): void;
|
||||
readAsDataURL(blob: Blob): void;
|
||||
readAsText(blob: Blob, encoding?: string): void;
|
||||
addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -359,11 +363,16 @@ declare var IDBCursorWithValue: {
|
||||
new(): IDBCursorWithValue;
|
||||
}
|
||||
|
||||
interface IDBDatabaseEventMap {
|
||||
"abort": Event;
|
||||
"error": ErrorEvent;
|
||||
}
|
||||
|
||||
interface IDBDatabase extends EventTarget {
|
||||
readonly name: string;
|
||||
readonly objectStoreNames: DOMStringList;
|
||||
onabort: (this: this, ev: Event) => any;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onabort: (this: IDBDatabase, ev: Event) => any;
|
||||
onerror: (this: IDBDatabase, ev: ErrorEvent) => any;
|
||||
version: number;
|
||||
onversionchange: (ev: IDBVersionChangeEvent) => any;
|
||||
close(): void;
|
||||
@@ -371,8 +380,7 @@ interface IDBDatabase extends EventTarget {
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
|
||||
addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -449,13 +457,15 @@ declare var IDBObjectStore: {
|
||||
new(): IDBObjectStore;
|
||||
}
|
||||
|
||||
interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
|
||||
"blocked": Event;
|
||||
"upgradeneeded": IDBVersionChangeEvent;
|
||||
}
|
||||
|
||||
interface IDBOpenDBRequest extends IDBRequest {
|
||||
onblocked: (this: this, ev: Event) => any;
|
||||
onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;
|
||||
addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
|
||||
onblocked: (this: IDBOpenDBRequest, ev: Event) => any;
|
||||
onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;
|
||||
addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -464,16 +474,20 @@ declare var IDBOpenDBRequest: {
|
||||
new(): IDBOpenDBRequest;
|
||||
}
|
||||
|
||||
interface IDBRequestEventMap {
|
||||
"error": ErrorEvent;
|
||||
"success": Event;
|
||||
}
|
||||
|
||||
interface IDBRequest extends EventTarget {
|
||||
readonly error: DOMError;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onsuccess: (this: this, ev: Event) => any;
|
||||
onerror: (this: IDBRequest, ev: ErrorEvent) => any;
|
||||
onsuccess: (this: IDBRequest, ev: Event) => any;
|
||||
readonly readyState: string;
|
||||
readonly result: any;
|
||||
source: IDBObjectStore | IDBIndex | IDBCursor;
|
||||
readonly transaction: IDBTransaction;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -482,21 +496,25 @@ declare var IDBRequest: {
|
||||
new(): IDBRequest;
|
||||
}
|
||||
|
||||
interface IDBTransactionEventMap {
|
||||
"abort": Event;
|
||||
"complete": Event;
|
||||
"error": ErrorEvent;
|
||||
}
|
||||
|
||||
interface IDBTransaction extends EventTarget {
|
||||
readonly db: IDBDatabase;
|
||||
readonly error: DOMError;
|
||||
readonly mode: string;
|
||||
onabort: (this: this, ev: Event) => any;
|
||||
oncomplete: (this: this, ev: Event) => any;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onabort: (this: IDBTransaction, ev: Event) => any;
|
||||
oncomplete: (this: IDBTransaction, ev: Event) => any;
|
||||
onerror: (this: IDBTransaction, ev: ErrorEvent) => any;
|
||||
abort(): void;
|
||||
objectStore(name: string): IDBObjectStore;
|
||||
readonly READ_ONLY: string;
|
||||
readonly READ_WRITE: string;
|
||||
readonly VERSION_CHANGE: string;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -553,18 +571,22 @@ interface MSApp {
|
||||
}
|
||||
declare var MSApp: MSApp;
|
||||
|
||||
interface MSAppAsyncOperationEventMap {
|
||||
"complete": Event;
|
||||
"error": ErrorEvent;
|
||||
}
|
||||
|
||||
interface MSAppAsyncOperation extends EventTarget {
|
||||
readonly error: DOMError;
|
||||
oncomplete: (this: this, ev: Event) => any;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;
|
||||
onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;
|
||||
readonly readyState: number;
|
||||
readonly result: any;
|
||||
start(): void;
|
||||
readonly COMPLETED: number;
|
||||
readonly ERROR: number;
|
||||
readonly STARTED: number;
|
||||
addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -604,6 +626,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader {
|
||||
readAsBlob(stream: MSStream, size?: number): void;
|
||||
readAsDataURL(stream: MSStream, size?: number): void;
|
||||
readAsText(stream: MSStream, encoding?: string, size?: number): void;
|
||||
addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -647,12 +670,16 @@ declare var MessageEvent: {
|
||||
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
|
||||
}
|
||||
|
||||
interface MessagePortEventMap {
|
||||
"message": MessageEvent;
|
||||
}
|
||||
|
||||
interface MessagePort extends EventTarget {
|
||||
onmessage: (this: this, ev: MessageEvent) => any;
|
||||
onmessage: (this: MessagePort, ev: MessageEvent) => any;
|
||||
close(): void;
|
||||
postMessage(message?: any, ports?: any): void;
|
||||
start(): void;
|
||||
addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -700,14 +727,21 @@ declare var ProgressEvent: {
|
||||
new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
|
||||
}
|
||||
|
||||
interface WebSocketEventMap {
|
||||
"close": CloseEvent;
|
||||
"error": ErrorEvent;
|
||||
"message": MessageEvent;
|
||||
"open": Event;
|
||||
}
|
||||
|
||||
interface WebSocket extends EventTarget {
|
||||
binaryType: string;
|
||||
readonly bufferedAmount: number;
|
||||
readonly extensions: string;
|
||||
onclose: (this: this, ev: CloseEvent) => any;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onmessage: (this: this, ev: MessageEvent) => any;
|
||||
onopen: (this: this, ev: Event) => any;
|
||||
onclose: (this: WebSocket, ev: CloseEvent) => any;
|
||||
onerror: (this: WebSocket, ev: ErrorEvent) => any;
|
||||
onmessage: (this: WebSocket, ev: MessageEvent) => any;
|
||||
onopen: (this: WebSocket, ev: Event) => any;
|
||||
readonly protocol: string;
|
||||
readonly readyState: number;
|
||||
readonly url: string;
|
||||
@@ -717,10 +751,7 @@ interface WebSocket extends EventTarget {
|
||||
readonly CLOSING: number;
|
||||
readonly CONNECTING: number;
|
||||
readonly OPEN: number;
|
||||
addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -733,12 +764,15 @@ declare var WebSocket: {
|
||||
readonly OPEN: number;
|
||||
}
|
||||
|
||||
interface WorkerEventMap extends AbstractWorkerEventMap {
|
||||
"message": MessageEvent;
|
||||
}
|
||||
|
||||
interface Worker extends EventTarget, AbstractWorker {
|
||||
onmessage: (this: this, ev: MessageEvent) => any;
|
||||
onmessage: (this: Worker, ev: MessageEvent) => any;
|
||||
postMessage(message: any, ports?: any): void;
|
||||
terminate(): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -747,8 +781,12 @@ declare var Worker: {
|
||||
new(stringUrl: string): Worker;
|
||||
}
|
||||
|
||||
interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
|
||||
"readystatechange": Event;
|
||||
}
|
||||
|
||||
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
onreadystatechange: (this: this, ev: Event) => any;
|
||||
onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;
|
||||
readonly readyState: number;
|
||||
readonly response: any;
|
||||
readonly responseText: string;
|
||||
@@ -775,14 +813,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
readonly LOADING: number;
|
||||
readonly OPENED: number;
|
||||
readonly UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -798,6 +829,7 @@ declare var XMLHttpRequest: {
|
||||
}
|
||||
|
||||
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
|
||||
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -806,31 +838,39 @@ declare var XMLHttpRequestUpload: {
|
||||
new(): XMLHttpRequestUpload;
|
||||
}
|
||||
|
||||
interface AbstractWorkerEventMap {
|
||||
"error": ErrorEvent;
|
||||
}
|
||||
|
||||
interface AbstractWorker {
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
onerror: (this: AbstractWorker, ev: ErrorEvent) => any;
|
||||
addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface MSBaseReaderEventMap {
|
||||
"abort": Event;
|
||||
"error": ErrorEvent;
|
||||
"load": Event;
|
||||
"loadend": ProgressEvent;
|
||||
"loadstart": Event;
|
||||
"progress": ProgressEvent;
|
||||
}
|
||||
|
||||
interface MSBaseReader {
|
||||
onabort: (this: this, ev: Event) => any;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onload: (this: this, ev: Event) => any;
|
||||
onloadend: (this: this, ev: ProgressEvent) => any;
|
||||
onloadstart: (this: this, ev: Event) => any;
|
||||
onprogress: (this: this, ev: ProgressEvent) => any;
|
||||
onabort: (this: MSBaseReader, ev: Event) => any;
|
||||
onerror: (this: MSBaseReader, ev: ErrorEvent) => any;
|
||||
onload: (this: MSBaseReader, ev: Event) => any;
|
||||
onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;
|
||||
onloadstart: (this: MSBaseReader, ev: Event) => any;
|
||||
onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;
|
||||
readonly readyState: number;
|
||||
readonly result: any;
|
||||
abort(): void;
|
||||
readonly DONE: number;
|
||||
readonly EMPTY: number;
|
||||
readonly LOADING: number;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -858,21 +898,25 @@ interface WindowConsole {
|
||||
readonly console: Console;
|
||||
}
|
||||
|
||||
interface XMLHttpRequestEventTargetEventMap {
|
||||
"abort": Event;
|
||||
"error": ErrorEvent;
|
||||
"load": Event;
|
||||
"loadend": ProgressEvent;
|
||||
"loadstart": Event;
|
||||
"progress": ProgressEvent;
|
||||
"timeout": ProgressEvent;
|
||||
}
|
||||
|
||||
interface XMLHttpRequestEventTarget {
|
||||
onabort: (this: this, ev: Event) => any;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onload: (this: this, ev: Event) => any;
|
||||
onloadend: (this: this, ev: ProgressEvent) => any;
|
||||
onloadstart: (this: this, ev: Event) => any;
|
||||
onprogress: (this: this, ev: ProgressEvent) => any;
|
||||
ontimeout: (this: this, ev: ProgressEvent) => any;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;
|
||||
onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;
|
||||
onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;
|
||||
onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
|
||||
onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;
|
||||
onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
|
||||
ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
|
||||
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -888,15 +932,18 @@ declare var FileReaderSync: {
|
||||
new(): FileReaderSync;
|
||||
}
|
||||
|
||||
interface WorkerGlobalScopeEventMap extends DedicatedWorkerGlobalScopeEventMap {
|
||||
"error": ErrorEvent;
|
||||
}
|
||||
|
||||
interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole {
|
||||
readonly location: WorkerLocation;
|
||||
onerror: (this: this, ev: ErrorEvent) => any;
|
||||
onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any;
|
||||
readonly self: WorkerGlobalScope;
|
||||
close(): void;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
toString(): string;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -924,7 +971,6 @@ declare var WorkerLocation: {
|
||||
|
||||
interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine {
|
||||
readonly hardwareConcurrency: number;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var WorkerNavigator: {
|
||||
@@ -932,10 +978,14 @@ declare var WorkerNavigator: {
|
||||
new(): WorkerNavigator;
|
||||
}
|
||||
|
||||
interface DedicatedWorkerGlobalScopeEventMap {
|
||||
"message": MessageEvent;
|
||||
}
|
||||
|
||||
interface DedicatedWorkerGlobalScope {
|
||||
onmessage: (this: this, ev: MessageEvent) => any;
|
||||
onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any;
|
||||
postMessage(data: any): void;
|
||||
addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -1196,7 +1246,6 @@ declare var self: WorkerGlobalScope;
|
||||
declare function close(): void;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function toString(): string;
|
||||
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare var indexedDB: IDBFactory;
|
||||
@@ -1217,8 +1266,7 @@ declare function btoa(rawString: string): string;
|
||||
declare var onmessage: (this: WorkerGlobalScope, ev: MessageEvent) => any;
|
||||
declare function postMessage(data: any): void;
|
||||
declare var console: Console;
|
||||
declare function addEventListener(type: "error", listener: (this: WorkerGlobalScope, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "message", listener: (this: WorkerGlobalScope, ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
type AlgorithmIdentifier = string | Algorithm;
|
||||
type IDBKeyPath = string;
|
||||
|
||||
Vendored
+73
-3
@@ -680,9 +680,13 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
options: ExternalProjectCompilerOptions;
|
||||
/**
|
||||
* Explicitly specified typing options for the project
|
||||
* @deprecated typingOptions. Use typeAcquisition instead
|
||||
*/
|
||||
typingOptions?: TypingOptions;
|
||||
typingOptions?: TypeAcquisition;
|
||||
/**
|
||||
* Explicitly specified type acquisition for the project
|
||||
*/
|
||||
typeAcquisition?: TypeAcquisition;
|
||||
}
|
||||
interface CompileOnSaveMixin {
|
||||
/**
|
||||
@@ -707,6 +711,10 @@ declare namespace ts.server.protocol {
|
||||
* List of removed files
|
||||
*/
|
||||
removed: string[];
|
||||
/**
|
||||
* List of updated files
|
||||
*/
|
||||
updated: string[];
|
||||
}
|
||||
/**
|
||||
* Information found in a configure request.
|
||||
@@ -725,6 +733,10 @@ declare namespace ts.server.protocol {
|
||||
* The format options to use during formatting and other code editing features.
|
||||
*/
|
||||
formatOptions?: FormatCodeSettings;
|
||||
/**
|
||||
* The host's additional supported file extensions
|
||||
*/
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
}
|
||||
/**
|
||||
* Configure request; value of command field is "configure". Specifies
|
||||
@@ -1400,6 +1412,25 @@ declare namespace ts.server.protocol {
|
||||
body?: ConfigFileDiagnosticEventBody;
|
||||
event: "configFileDiag";
|
||||
}
|
||||
type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
|
||||
interface ProjectLanguageServiceStateEvent extends Event {
|
||||
event: ProjectLanguageServiceStateEventName;
|
||||
body?: ProjectLanguageServiceStateEventBody;
|
||||
}
|
||||
interface ProjectLanguageServiceStateEventBody {
|
||||
/**
|
||||
* Project name that has changes in the state of language service.
|
||||
* For configured projects this will be the config file path.
|
||||
* For external projects this will be the name of the projects specified when project was open.
|
||||
* For inferred projects this event is not raised.
|
||||
*/
|
||||
projectName: string;
|
||||
/**
|
||||
* True if language service state switched from disabled to enabled
|
||||
* and false otherwise.
|
||||
*/
|
||||
languageServiceEnabled: boolean;
|
||||
}
|
||||
/**
|
||||
* Arguments for reload request.
|
||||
*/
|
||||
@@ -1634,6 +1665,38 @@ declare namespace ts.server.protocol {
|
||||
* true if install request succeeded, otherwise - false
|
||||
*/
|
||||
installSuccess: boolean;
|
||||
/**
|
||||
* version of typings installer
|
||||
*/
|
||||
typingsInstallerVersion: string;
|
||||
}
|
||||
type BeginInstallTypesEventName = "beginInstallTypes";
|
||||
type EndInstallTypesEventName = "endInstallTypes";
|
||||
interface BeginInstallTypesEvent extends Event {
|
||||
event: BeginInstallTypesEventName;
|
||||
body: BeginInstallTypesEventBody;
|
||||
}
|
||||
interface EndInstallTypesEvent extends Event {
|
||||
event: EndInstallTypesEventName;
|
||||
body: EndInstallTypesEventBody;
|
||||
}
|
||||
interface InstallTypesEventBody {
|
||||
/**
|
||||
* correlation id to match begin and end events
|
||||
*/
|
||||
eventId: number;
|
||||
/**
|
||||
* list of packages to install
|
||||
*/
|
||||
packages: ReadonlyArray<string>;
|
||||
}
|
||||
interface BeginInstallTypesEventBody extends InstallTypesEventBody {
|
||||
}
|
||||
interface EndInstallTypesEventBody extends InstallTypesEventBody {
|
||||
/**
|
||||
* true if installation succeeded, otherwise false
|
||||
*/
|
||||
success: boolean;
|
||||
}
|
||||
interface NavBarResponse extends Response {
|
||||
body?: NavigationBarItem[];
|
||||
@@ -1783,13 +1846,20 @@ declare namespace ts.server.protocol {
|
||||
position: number;
|
||||
}
|
||||
|
||||
interface TypingOptions {
|
||||
interface TypeAcquisition {
|
||||
enableAutoDiscovery?: boolean;
|
||||
enable?: boolean;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
[option: string]: string[] | boolean | undefined;
|
||||
}
|
||||
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
|
||||
interface MapLike<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
+3933
-3203
File diff suppressed because it is too large
Load Diff
+5166
-3560
File diff suppressed because it is too large
Load Diff
Vendored
+545
-297
File diff suppressed because one or more lines are too long
+5104
-3533
File diff suppressed because it is too large
Load Diff
Vendored
+102
-69
@@ -317,23 +317,25 @@ declare namespace ts {
|
||||
JSDocThisType = 277,
|
||||
JSDocComment = 278,
|
||||
JSDocTag = 279,
|
||||
JSDocParameterTag = 280,
|
||||
JSDocReturnTag = 281,
|
||||
JSDocTypeTag = 282,
|
||||
JSDocTemplateTag = 283,
|
||||
JSDocTypedefTag = 284,
|
||||
JSDocPropertyTag = 285,
|
||||
JSDocTypeLiteral = 286,
|
||||
JSDocLiteralType = 287,
|
||||
JSDocNullKeyword = 288,
|
||||
JSDocUndefinedKeyword = 289,
|
||||
JSDocNeverKeyword = 290,
|
||||
SyntaxList = 291,
|
||||
NotEmittedStatement = 292,
|
||||
PartiallyEmittedExpression = 293,
|
||||
MergeDeclarationMarker = 294,
|
||||
EndOfDeclarationMarker = 295,
|
||||
Count = 296,
|
||||
JSDocAugmentsTag = 280,
|
||||
JSDocParameterTag = 281,
|
||||
JSDocReturnTag = 282,
|
||||
JSDocTypeTag = 283,
|
||||
JSDocTemplateTag = 284,
|
||||
JSDocTypedefTag = 285,
|
||||
JSDocPropertyTag = 286,
|
||||
JSDocTypeLiteral = 287,
|
||||
JSDocLiteralType = 288,
|
||||
JSDocNullKeyword = 289,
|
||||
JSDocUndefinedKeyword = 290,
|
||||
JSDocNeverKeyword = 291,
|
||||
SyntaxList = 292,
|
||||
NotEmittedStatement = 293,
|
||||
PartiallyEmittedExpression = 294,
|
||||
MergeDeclarationMarker = 295,
|
||||
EndOfDeclarationMarker = 296,
|
||||
RawExpression = 297,
|
||||
Count = 298,
|
||||
FirstAssignment = 57,
|
||||
LastAssignment = 69,
|
||||
FirstCompoundAssignment = 58,
|
||||
@@ -360,9 +362,9 @@ declare namespace ts {
|
||||
LastBinaryOperator = 69,
|
||||
FirstNode = 141,
|
||||
FirstJSDocNode = 262,
|
||||
LastJSDocNode = 287,
|
||||
LastJSDocNode = 288,
|
||||
FirstJSDocTagNode = 278,
|
||||
LastJSDocTagNode = 290,
|
||||
LastJSDocTagNode = 291,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -376,26 +378,20 @@ declare namespace ts {
|
||||
HasImplicitReturn = 128,
|
||||
HasExplicitReturn = 256,
|
||||
GlobalAugmentation = 512,
|
||||
HasClassExtends = 1024,
|
||||
HasDecorators = 2048,
|
||||
HasParamDecorators = 4096,
|
||||
HasAsyncFunctions = 8192,
|
||||
HasSpreadAttribute = 16384,
|
||||
HasRestAttribute = 32768,
|
||||
DisallowInContext = 65536,
|
||||
YieldContext = 131072,
|
||||
DecoratorContext = 262144,
|
||||
AwaitContext = 524288,
|
||||
ThisNodeHasError = 1048576,
|
||||
JavaScriptFile = 2097152,
|
||||
ThisNodeOrAnySubNodesHasError = 4194304,
|
||||
HasAggregatedChildData = 8388608,
|
||||
HasAsyncFunctions = 1024,
|
||||
DisallowInContext = 2048,
|
||||
YieldContext = 4096,
|
||||
DecoratorContext = 8192,
|
||||
AwaitContext = 16384,
|
||||
ThisNodeHasError = 32768,
|
||||
JavaScriptFile = 65536,
|
||||
ThisNodeOrAnySubNodesHasError = 131072,
|
||||
HasAggregatedChildData = 262144,
|
||||
BlockScoped = 3,
|
||||
ReachabilityCheckFlags = 384,
|
||||
EmitHelperFlags = 64512,
|
||||
ReachabilityAndEmitFlags = 64896,
|
||||
ContextFlags = 3080192,
|
||||
TypeExcludesFlags = 655360,
|
||||
ReachabilityAndEmitFlags = 1408,
|
||||
ContextFlags = 96256,
|
||||
TypeExcludesFlags = 20480,
|
||||
}
|
||||
enum ModifierFlags {
|
||||
None = 0,
|
||||
@@ -464,14 +460,14 @@ declare namespace ts {
|
||||
right: Identifier;
|
||||
}
|
||||
type EntityName = Identifier | QualifiedName;
|
||||
type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
|
||||
type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
|
||||
type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
|
||||
type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
|
||||
interface Declaration extends Node {
|
||||
_declarationBrand: any;
|
||||
name?: DeclarationName;
|
||||
}
|
||||
interface DeclarationStatement extends Declaration, Statement {
|
||||
name?: Identifier | LiteralExpression;
|
||||
name?: Identifier | StringLiteral | NumericLiteral;
|
||||
}
|
||||
interface ComputedPropertyName extends Node {
|
||||
kind: SyntaxKind.ComputedPropertyName;
|
||||
@@ -573,18 +569,16 @@ declare namespace ts {
|
||||
interface PropertyLikeDeclaration extends Declaration {
|
||||
name: PropertyName;
|
||||
}
|
||||
interface BindingPattern extends Node {
|
||||
elements: NodeArray<BindingElement | ArrayBindingElement>;
|
||||
}
|
||||
interface ObjectBindingPattern extends BindingPattern {
|
||||
interface ObjectBindingPattern extends Node {
|
||||
kind: SyntaxKind.ObjectBindingPattern;
|
||||
elements: NodeArray<BindingElement>;
|
||||
}
|
||||
type ArrayBindingElement = BindingElement | OmittedExpression;
|
||||
interface ArrayBindingPattern extends BindingPattern {
|
||||
interface ArrayBindingPattern extends Node {
|
||||
kind: SyntaxKind.ArrayBindingPattern;
|
||||
elements: NodeArray<ArrayBindingElement>;
|
||||
}
|
||||
type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
|
||||
type ArrayBindingElement = BindingElement | OmittedExpression;
|
||||
/**
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
@@ -809,17 +803,25 @@ declare namespace ts {
|
||||
operatorToken: BinaryOperatorToken;
|
||||
right: Expression;
|
||||
}
|
||||
interface AssignmentExpression extends BinaryExpression {
|
||||
type AssignmentOperatorToken = Token<AssignmentOperator>;
|
||||
interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
|
||||
left: LeftHandSideExpression;
|
||||
operatorToken: Token<SyntaxKind.EqualsToken>;
|
||||
operatorToken: TOperator;
|
||||
}
|
||||
interface ObjectDestructuringAssignment extends AssignmentExpression {
|
||||
interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
|
||||
left: ObjectLiteralExpression;
|
||||
}
|
||||
interface ArrayDestructuringAssignment extends AssignmentExpression {
|
||||
interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
|
||||
left: ArrayLiteralExpression;
|
||||
}
|
||||
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
|
||||
type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
|
||||
type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
|
||||
type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression;
|
||||
type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
|
||||
type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
|
||||
type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
|
||||
interface ConditionalExpression extends Expression {
|
||||
kind: SyntaxKind.ConditionalExpression;
|
||||
condition: Expression;
|
||||
@@ -1180,7 +1182,7 @@ declare namespace ts {
|
||||
type ModuleName = Identifier | StringLiteral;
|
||||
interface ModuleDeclaration extends DeclarationStatement {
|
||||
kind: SyntaxKind.ModuleDeclaration;
|
||||
name: Identifier | LiteralExpression;
|
||||
name: Identifier | StringLiteral;
|
||||
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
|
||||
}
|
||||
interface NamespaceDeclaration extends ModuleDeclaration {
|
||||
@@ -1332,7 +1334,7 @@ declare namespace ts {
|
||||
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
|
||||
interface JSDocRecordMember extends PropertySignature {
|
||||
kind: SyntaxKind.JSDocRecordMember;
|
||||
name: Identifier | LiteralExpression;
|
||||
name: Identifier | StringLiteral | NumericLiteral;
|
||||
type?: JSDocType;
|
||||
}
|
||||
interface JSDoc extends Node {
|
||||
@@ -1348,6 +1350,10 @@ declare namespace ts {
|
||||
interface JSDocUnknownTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocTag;
|
||||
}
|
||||
interface JSDocAugmentsTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocAugmentsTag;
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
interface JSDocTemplateTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocTemplateTag;
|
||||
typeParameters: NodeArray<TypeParameterDeclaration>;
|
||||
@@ -1596,6 +1602,7 @@ declare namespace ts {
|
||||
getJsxIntrinsicTagNames(): Symbol[];
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
getAmbientModules(): Symbol[];
|
||||
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1616,6 +1623,7 @@ declare namespace ts {
|
||||
writeSpace(text: string): void;
|
||||
writeStringLiteral(text: string): void;
|
||||
writeParameter(text: string): void;
|
||||
writeProperty(text: string): void;
|
||||
writeSymbol(text: string, symbol: Symbol): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
@@ -1761,13 +1769,14 @@ declare namespace ts {
|
||||
Literal = 480,
|
||||
StringOrNumberLiteral = 96,
|
||||
PossiblyFalsy = 7406,
|
||||
StringLike = 34,
|
||||
StringLike = 262178,
|
||||
NumberLike = 340,
|
||||
BooleanLike = 136,
|
||||
EnumLike = 272,
|
||||
UnionOrIntersection = 196608,
|
||||
StructuredType = 229376,
|
||||
StructuredOrTypeParameter = 507904,
|
||||
TypeVariable = 540672,
|
||||
Narrowable = 1033215,
|
||||
NotUnionOrUnit = 33281,
|
||||
}
|
||||
@@ -1837,15 +1846,18 @@ declare namespace ts {
|
||||
elementType: Type;
|
||||
finalArrayType?: Type;
|
||||
}
|
||||
interface TypeParameter extends Type {
|
||||
interface TypeVariable extends Type {
|
||||
}
|
||||
interface TypeParameter extends TypeVariable {
|
||||
constraint: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeParameter;
|
||||
}
|
||||
interface IndexedAccessType extends Type {
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
indexType: TypeParameter;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeVariable | UnionOrIntersectionType;
|
||||
}
|
||||
enum SignatureKind {
|
||||
Call = 0,
|
||||
@@ -1865,6 +1877,11 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1962,12 +1979,13 @@ declare namespace ts {
|
||||
target?: ScriptTarget;
|
||||
traceResolution?: boolean;
|
||||
types?: string[];
|
||||
/** Paths used to used to compute primary types search locations */
|
||||
/** Paths used to compute primary types search locations */
|
||||
typeRoots?: string[];
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
interface TypingOptions {
|
||||
interface TypeAcquisition {
|
||||
enableAutoDiscovery?: boolean;
|
||||
enable?: boolean;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
[option: string]: string[] | boolean | undefined;
|
||||
@@ -1977,7 +1995,7 @@ declare namespace ts {
|
||||
projectRootPath: string;
|
||||
safeListPath: string;
|
||||
packageNameToTypingLocation: Map<string>;
|
||||
typingOptions: TypingOptions;
|
||||
typeAcquisition: TypeAcquisition;
|
||||
compilerOptions: CompilerOptions;
|
||||
unresolvedImports: ReadonlyArray<string>;
|
||||
}
|
||||
@@ -2025,7 +2043,7 @@ declare namespace ts {
|
||||
/** Either a parsed command line or a parsed tsconfig.json */
|
||||
interface ParsedCommandLine {
|
||||
options: CompilerOptions;
|
||||
typingOptions?: TypingOptions;
|
||||
typeAcquisition?: TypeAcquisition;
|
||||
fileNames: string[];
|
||||
raw?: any;
|
||||
errors: Diagnostic[];
|
||||
@@ -2129,6 +2147,10 @@ declare namespace ts {
|
||||
_children: Node[];
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version = "2.2.0";
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
|
||||
type DirectoryWatcherCallback = (fileName: string) => void;
|
||||
@@ -2260,9 +2282,19 @@ declare namespace ts {
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function isParameterPropertyDeclaration(node: Node): boolean;
|
||||
function getCombinedModifierFlags(node: Node): ModifierFlags;
|
||||
function getCombinedNodeFlags(node: Node): NodeFlags;
|
||||
/**
|
||||
* Checks to see if the locale is in the appropriate format,
|
||||
* and if it is, attempts to set the appropriate language.
|
||||
*/
|
||||
function validateLocaleAndSetLanguage(locale: string, sys: {
|
||||
getExecutingFilePath(): string;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string;
|
||||
}, errors?: Diagnostic[]): void;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
@@ -2273,6 +2305,7 @@ declare namespace ts {
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare namespace ts {
|
||||
function moduleHasNonRelativeName(moduleName: string): boolean;
|
||||
function getEffectiveTypeRoots(options: CompilerOptions, host: {
|
||||
directoryExists?: (directoryName: string) => boolean;
|
||||
getCurrentDirectory?: () => string;
|
||||
@@ -2297,8 +2330,6 @@ declare namespace ts {
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version = "2.2.0";
|
||||
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
@@ -2313,6 +2344,7 @@ declare namespace ts {
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare namespace ts {
|
||||
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
@@ -2337,14 +2369,14 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
errors: Diagnostic[];
|
||||
};
|
||||
function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: TypingOptions;
|
||||
function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: TypeAcquisition;
|
||||
errors: Diagnostic[];
|
||||
};
|
||||
}
|
||||
@@ -2393,6 +2425,7 @@ declare namespace ts {
|
||||
}
|
||||
interface SourceFile {
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineEndOfPosition(pos: number): number;
|
||||
getLineStarts(): number[];
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
|
||||
+5674
-4062
File diff suppressed because it is too large
Load Diff
Vendored
+102
-69
@@ -317,23 +317,25 @@ declare namespace ts {
|
||||
JSDocThisType = 277,
|
||||
JSDocComment = 278,
|
||||
JSDocTag = 279,
|
||||
JSDocParameterTag = 280,
|
||||
JSDocReturnTag = 281,
|
||||
JSDocTypeTag = 282,
|
||||
JSDocTemplateTag = 283,
|
||||
JSDocTypedefTag = 284,
|
||||
JSDocPropertyTag = 285,
|
||||
JSDocTypeLiteral = 286,
|
||||
JSDocLiteralType = 287,
|
||||
JSDocNullKeyword = 288,
|
||||
JSDocUndefinedKeyword = 289,
|
||||
JSDocNeverKeyword = 290,
|
||||
SyntaxList = 291,
|
||||
NotEmittedStatement = 292,
|
||||
PartiallyEmittedExpression = 293,
|
||||
MergeDeclarationMarker = 294,
|
||||
EndOfDeclarationMarker = 295,
|
||||
Count = 296,
|
||||
JSDocAugmentsTag = 280,
|
||||
JSDocParameterTag = 281,
|
||||
JSDocReturnTag = 282,
|
||||
JSDocTypeTag = 283,
|
||||
JSDocTemplateTag = 284,
|
||||
JSDocTypedefTag = 285,
|
||||
JSDocPropertyTag = 286,
|
||||
JSDocTypeLiteral = 287,
|
||||
JSDocLiteralType = 288,
|
||||
JSDocNullKeyword = 289,
|
||||
JSDocUndefinedKeyword = 290,
|
||||
JSDocNeverKeyword = 291,
|
||||
SyntaxList = 292,
|
||||
NotEmittedStatement = 293,
|
||||
PartiallyEmittedExpression = 294,
|
||||
MergeDeclarationMarker = 295,
|
||||
EndOfDeclarationMarker = 296,
|
||||
RawExpression = 297,
|
||||
Count = 298,
|
||||
FirstAssignment = 57,
|
||||
LastAssignment = 69,
|
||||
FirstCompoundAssignment = 58,
|
||||
@@ -360,9 +362,9 @@ declare namespace ts {
|
||||
LastBinaryOperator = 69,
|
||||
FirstNode = 141,
|
||||
FirstJSDocNode = 262,
|
||||
LastJSDocNode = 287,
|
||||
LastJSDocNode = 288,
|
||||
FirstJSDocTagNode = 278,
|
||||
LastJSDocTagNode = 290,
|
||||
LastJSDocTagNode = 291,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -376,26 +378,20 @@ declare namespace ts {
|
||||
HasImplicitReturn = 128,
|
||||
HasExplicitReturn = 256,
|
||||
GlobalAugmentation = 512,
|
||||
HasClassExtends = 1024,
|
||||
HasDecorators = 2048,
|
||||
HasParamDecorators = 4096,
|
||||
HasAsyncFunctions = 8192,
|
||||
HasSpreadAttribute = 16384,
|
||||
HasRestAttribute = 32768,
|
||||
DisallowInContext = 65536,
|
||||
YieldContext = 131072,
|
||||
DecoratorContext = 262144,
|
||||
AwaitContext = 524288,
|
||||
ThisNodeHasError = 1048576,
|
||||
JavaScriptFile = 2097152,
|
||||
ThisNodeOrAnySubNodesHasError = 4194304,
|
||||
HasAggregatedChildData = 8388608,
|
||||
HasAsyncFunctions = 1024,
|
||||
DisallowInContext = 2048,
|
||||
YieldContext = 4096,
|
||||
DecoratorContext = 8192,
|
||||
AwaitContext = 16384,
|
||||
ThisNodeHasError = 32768,
|
||||
JavaScriptFile = 65536,
|
||||
ThisNodeOrAnySubNodesHasError = 131072,
|
||||
HasAggregatedChildData = 262144,
|
||||
BlockScoped = 3,
|
||||
ReachabilityCheckFlags = 384,
|
||||
EmitHelperFlags = 64512,
|
||||
ReachabilityAndEmitFlags = 64896,
|
||||
ContextFlags = 3080192,
|
||||
TypeExcludesFlags = 655360,
|
||||
ReachabilityAndEmitFlags = 1408,
|
||||
ContextFlags = 96256,
|
||||
TypeExcludesFlags = 20480,
|
||||
}
|
||||
enum ModifierFlags {
|
||||
None = 0,
|
||||
@@ -464,14 +460,14 @@ declare namespace ts {
|
||||
right: Identifier;
|
||||
}
|
||||
type EntityName = Identifier | QualifiedName;
|
||||
type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
|
||||
type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
|
||||
type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
|
||||
type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
|
||||
interface Declaration extends Node {
|
||||
_declarationBrand: any;
|
||||
name?: DeclarationName;
|
||||
}
|
||||
interface DeclarationStatement extends Declaration, Statement {
|
||||
name?: Identifier | LiteralExpression;
|
||||
name?: Identifier | StringLiteral | NumericLiteral;
|
||||
}
|
||||
interface ComputedPropertyName extends Node {
|
||||
kind: SyntaxKind.ComputedPropertyName;
|
||||
@@ -573,18 +569,16 @@ declare namespace ts {
|
||||
interface PropertyLikeDeclaration extends Declaration {
|
||||
name: PropertyName;
|
||||
}
|
||||
interface BindingPattern extends Node {
|
||||
elements: NodeArray<BindingElement | ArrayBindingElement>;
|
||||
}
|
||||
interface ObjectBindingPattern extends BindingPattern {
|
||||
interface ObjectBindingPattern extends Node {
|
||||
kind: SyntaxKind.ObjectBindingPattern;
|
||||
elements: NodeArray<BindingElement>;
|
||||
}
|
||||
type ArrayBindingElement = BindingElement | OmittedExpression;
|
||||
interface ArrayBindingPattern extends BindingPattern {
|
||||
interface ArrayBindingPattern extends Node {
|
||||
kind: SyntaxKind.ArrayBindingPattern;
|
||||
elements: NodeArray<ArrayBindingElement>;
|
||||
}
|
||||
type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
|
||||
type ArrayBindingElement = BindingElement | OmittedExpression;
|
||||
/**
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
@@ -809,17 +803,25 @@ declare namespace ts {
|
||||
operatorToken: BinaryOperatorToken;
|
||||
right: Expression;
|
||||
}
|
||||
interface AssignmentExpression extends BinaryExpression {
|
||||
type AssignmentOperatorToken = Token<AssignmentOperator>;
|
||||
interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
|
||||
left: LeftHandSideExpression;
|
||||
operatorToken: Token<SyntaxKind.EqualsToken>;
|
||||
operatorToken: TOperator;
|
||||
}
|
||||
interface ObjectDestructuringAssignment extends AssignmentExpression {
|
||||
interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
|
||||
left: ObjectLiteralExpression;
|
||||
}
|
||||
interface ArrayDestructuringAssignment extends AssignmentExpression {
|
||||
interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
|
||||
left: ArrayLiteralExpression;
|
||||
}
|
||||
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
|
||||
type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
|
||||
type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
|
||||
type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression;
|
||||
type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
|
||||
type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
|
||||
type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
|
||||
interface ConditionalExpression extends Expression {
|
||||
kind: SyntaxKind.ConditionalExpression;
|
||||
condition: Expression;
|
||||
@@ -1180,7 +1182,7 @@ declare namespace ts {
|
||||
type ModuleName = Identifier | StringLiteral;
|
||||
interface ModuleDeclaration extends DeclarationStatement {
|
||||
kind: SyntaxKind.ModuleDeclaration;
|
||||
name: Identifier | LiteralExpression;
|
||||
name: Identifier | StringLiteral;
|
||||
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
|
||||
}
|
||||
interface NamespaceDeclaration extends ModuleDeclaration {
|
||||
@@ -1332,7 +1334,7 @@ declare namespace ts {
|
||||
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
|
||||
interface JSDocRecordMember extends PropertySignature {
|
||||
kind: SyntaxKind.JSDocRecordMember;
|
||||
name: Identifier | LiteralExpression;
|
||||
name: Identifier | StringLiteral | NumericLiteral;
|
||||
type?: JSDocType;
|
||||
}
|
||||
interface JSDoc extends Node {
|
||||
@@ -1348,6 +1350,10 @@ declare namespace ts {
|
||||
interface JSDocUnknownTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocTag;
|
||||
}
|
||||
interface JSDocAugmentsTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocAugmentsTag;
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
interface JSDocTemplateTag extends JSDocTag {
|
||||
kind: SyntaxKind.JSDocTemplateTag;
|
||||
typeParameters: NodeArray<TypeParameterDeclaration>;
|
||||
@@ -1596,6 +1602,7 @@ declare namespace ts {
|
||||
getJsxIntrinsicTagNames(): Symbol[];
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
getAmbientModules(): Symbol[];
|
||||
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1616,6 +1623,7 @@ declare namespace ts {
|
||||
writeSpace(text: string): void;
|
||||
writeStringLiteral(text: string): void;
|
||||
writeParameter(text: string): void;
|
||||
writeProperty(text: string): void;
|
||||
writeSymbol(text: string, symbol: Symbol): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
@@ -1761,13 +1769,14 @@ declare namespace ts {
|
||||
Literal = 480,
|
||||
StringOrNumberLiteral = 96,
|
||||
PossiblyFalsy = 7406,
|
||||
StringLike = 34,
|
||||
StringLike = 262178,
|
||||
NumberLike = 340,
|
||||
BooleanLike = 136,
|
||||
EnumLike = 272,
|
||||
UnionOrIntersection = 196608,
|
||||
StructuredType = 229376,
|
||||
StructuredOrTypeParameter = 507904,
|
||||
TypeVariable = 540672,
|
||||
Narrowable = 1033215,
|
||||
NotUnionOrUnit = 33281,
|
||||
}
|
||||
@@ -1837,15 +1846,18 @@ declare namespace ts {
|
||||
elementType: Type;
|
||||
finalArrayType?: Type;
|
||||
}
|
||||
interface TypeParameter extends Type {
|
||||
interface TypeVariable extends Type {
|
||||
}
|
||||
interface TypeParameter extends TypeVariable {
|
||||
constraint: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeParameter;
|
||||
}
|
||||
interface IndexedAccessType extends Type {
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
indexType: TypeParameter;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeVariable | UnionOrIntersectionType;
|
||||
}
|
||||
enum SignatureKind {
|
||||
Call = 0,
|
||||
@@ -1865,6 +1877,11 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1962,12 +1979,13 @@ declare namespace ts {
|
||||
target?: ScriptTarget;
|
||||
traceResolution?: boolean;
|
||||
types?: string[];
|
||||
/** Paths used to used to compute primary types search locations */
|
||||
/** Paths used to compute primary types search locations */
|
||||
typeRoots?: string[];
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
interface TypingOptions {
|
||||
interface TypeAcquisition {
|
||||
enableAutoDiscovery?: boolean;
|
||||
enable?: boolean;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
[option: string]: string[] | boolean | undefined;
|
||||
@@ -1977,7 +1995,7 @@ declare namespace ts {
|
||||
projectRootPath: string;
|
||||
safeListPath: string;
|
||||
packageNameToTypingLocation: Map<string>;
|
||||
typingOptions: TypingOptions;
|
||||
typeAcquisition: TypeAcquisition;
|
||||
compilerOptions: CompilerOptions;
|
||||
unresolvedImports: ReadonlyArray<string>;
|
||||
}
|
||||
@@ -2025,7 +2043,7 @@ declare namespace ts {
|
||||
/** Either a parsed command line or a parsed tsconfig.json */
|
||||
interface ParsedCommandLine {
|
||||
options: CompilerOptions;
|
||||
typingOptions?: TypingOptions;
|
||||
typeAcquisition?: TypeAcquisition;
|
||||
fileNames: string[];
|
||||
raw?: any;
|
||||
errors: Diagnostic[];
|
||||
@@ -2129,6 +2147,10 @@ declare namespace ts {
|
||||
_children: Node[];
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version = "2.2.0";
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
|
||||
type DirectoryWatcherCallback = (fileName: string) => void;
|
||||
@@ -2260,9 +2282,19 @@ declare namespace ts {
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function isParameterPropertyDeclaration(node: Node): boolean;
|
||||
function getCombinedModifierFlags(node: Node): ModifierFlags;
|
||||
function getCombinedNodeFlags(node: Node): NodeFlags;
|
||||
/**
|
||||
* Checks to see if the locale is in the appropriate format,
|
||||
* and if it is, attempts to set the appropriate language.
|
||||
*/
|
||||
function validateLocaleAndSetLanguage(locale: string, sys: {
|
||||
getExecutingFilePath(): string;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string;
|
||||
}, errors?: Diagnostic[]): void;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
@@ -2273,6 +2305,7 @@ declare namespace ts {
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare namespace ts {
|
||||
function moduleHasNonRelativeName(moduleName: string): boolean;
|
||||
function getEffectiveTypeRoots(options: CompilerOptions, host: {
|
||||
directoryExists?: (directoryName: string) => boolean;
|
||||
getCurrentDirectory?: () => string;
|
||||
@@ -2297,8 +2330,6 @@ declare namespace ts {
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version = "2.2.0";
|
||||
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
@@ -2313,6 +2344,7 @@ declare namespace ts {
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare namespace ts {
|
||||
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
@@ -2337,14 +2369,14 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
errors: Diagnostic[];
|
||||
};
|
||||
function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: TypingOptions;
|
||||
function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: TypeAcquisition;
|
||||
errors: Diagnostic[];
|
||||
};
|
||||
}
|
||||
@@ -2393,6 +2425,7 @@ declare namespace ts {
|
||||
}
|
||||
interface SourceFile {
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineEndOfPosition(pos: number): number;
|
||||
getLineStarts(): number[];
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
|
||||
+5674
-4062
File diff suppressed because it is too large
Load Diff
+197
-110
@@ -136,6 +136,9 @@ var ts;
|
||||
})(performance = ts.performance || (ts.performance = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.version = "2.2.0";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
@@ -606,7 +609,7 @@ var ts;
|
||||
if (value === undefined)
|
||||
return to;
|
||||
if (to === undefined)
|
||||
to = [];
|
||||
return [value];
|
||||
to.push(value);
|
||||
return to;
|
||||
}
|
||||
@@ -621,6 +624,14 @@ var ts;
|
||||
return to;
|
||||
}
|
||||
ts.addRange = addRange;
|
||||
function stableSort(array, comparer) {
|
||||
if (comparer === void 0) { comparer = compareValues; }
|
||||
return array
|
||||
.map(function (_, i) { return i; })
|
||||
.sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })
|
||||
.map(function (i) { return array[i]; });
|
||||
}
|
||||
ts.stableSort = stableSort;
|
||||
function rangeEquals(array1, array2, pos, end) {
|
||||
while (pos < end) {
|
||||
if (array1[pos] !== array2[pos]) {
|
||||
@@ -775,6 +786,15 @@ var ts;
|
||||
}
|
||||
}
|
||||
ts.copyProperties = copyProperties;
|
||||
function appendProperty(map, key, value) {
|
||||
if (key === undefined || value === undefined)
|
||||
return map;
|
||||
if (map === undefined)
|
||||
map = createMap();
|
||||
map[key] = value;
|
||||
return map;
|
||||
}
|
||||
ts.appendProperty = appendProperty;
|
||||
function assign(t) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
@@ -798,15 +818,6 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
ts.reduceProperties = reduceProperties;
|
||||
function reduceOwnProperties(map, callback, initial) {
|
||||
var result = initial;
|
||||
for (var key in map)
|
||||
if (hasOwnProperty.call(map, key)) {
|
||||
result = callback(result, map[key], String(key));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
ts.reduceOwnProperties = reduceOwnProperties;
|
||||
function equalOwnProperties(left, right, equalityComparer) {
|
||||
if (left === right)
|
||||
return true;
|
||||
@@ -1227,6 +1238,14 @@ var ts;
|
||||
getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
|
||||
}
|
||||
ts.getEmitModuleKind = getEmitModuleKind;
|
||||
function getEmitModuleResolutionKind(compilerOptions) {
|
||||
var moduleResolution = compilerOptions.moduleResolution;
|
||||
if (moduleResolution === undefined) {
|
||||
moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
|
||||
}
|
||||
return moduleResolution;
|
||||
}
|
||||
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
|
||||
function hasZeroOrOneAsteriskCharacter(str) {
|
||||
var seenAsterisk = false;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
@@ -1645,8 +1664,19 @@ var ts;
|
||||
ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"];
|
||||
ts.supportedJavascriptExtensions = [".js", ".jsx"];
|
||||
var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);
|
||||
function getSupportedExtensions(options) {
|
||||
return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
function getSupportedExtensions(options, extraFileExtensions) {
|
||||
var needAllExtensions = options && options.allowJs;
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
||||
return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
}
|
||||
var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0);
|
||||
for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) {
|
||||
var extInfo = extraFileExtensions_1[_i];
|
||||
if (needAllExtensions || extInfo.scriptKind === 3) {
|
||||
extensions.push(extInfo.extension);
|
||||
}
|
||||
}
|
||||
return extensions;
|
||||
}
|
||||
ts.getSupportedExtensions = getSupportedExtensions;
|
||||
function hasJavaScriptFileExtension(fileName) {
|
||||
@@ -1657,11 +1687,11 @@ var ts;
|
||||
return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });
|
||||
}
|
||||
ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;
|
||||
function isSupportedSourceFileName(fileName, compilerOptions) {
|
||||
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
||||
if (!fileName) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) {
|
||||
var extension = _a[_i];
|
||||
if (fileExtensionIs(fileName, extension)) {
|
||||
return true;
|
||||
@@ -1777,6 +1807,16 @@ var ts;
|
||||
}
|
||||
Debug.fail = fail;
|
||||
})(Debug = ts.Debug || (ts.Debug = {}));
|
||||
function orderedRemoveItem(array, item) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (array[i] === item) {
|
||||
orderedRemoveItemAt(array, i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
ts.orderedRemoveItem = orderedRemoveItem;
|
||||
function orderedRemoveItemAt(array, index) {
|
||||
for (var i = index; i < array.length - 1; i++) {
|
||||
array[i] = array[i + 1];
|
||||
@@ -2591,6 +2631,7 @@ var ts;
|
||||
Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." },
|
||||
Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." },
|
||||
A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." },
|
||||
An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." },
|
||||
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." },
|
||||
@@ -2634,6 +2675,7 @@ var ts;
|
||||
Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." },
|
||||
Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." },
|
||||
An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." },
|
||||
This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." },
|
||||
Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." },
|
||||
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
|
||||
Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." },
|
||||
@@ -2644,6 +2686,7 @@ var ts;
|
||||
Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." },
|
||||
Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." },
|
||||
Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." },
|
||||
This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." },
|
||||
A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." },
|
||||
An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." },
|
||||
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." },
|
||||
@@ -2811,7 +2854,7 @@ var ts;
|
||||
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
|
||||
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
|
||||
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
|
||||
Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
|
||||
Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
|
||||
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
|
||||
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
|
||||
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
|
||||
@@ -2876,7 +2919,8 @@ var ts;
|
||||
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
|
||||
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
|
||||
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
|
||||
An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
|
||||
The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
|
||||
_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -2947,7 +2991,10 @@ var ts;
|
||||
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
|
||||
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
|
||||
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
|
||||
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
|
||||
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
|
||||
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." },
|
||||
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." },
|
||||
@@ -2989,7 +3036,7 @@ var ts;
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." },
|
||||
Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." },
|
||||
Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" },
|
||||
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." },
|
||||
@@ -3150,6 +3197,7 @@ var ts;
|
||||
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." },
|
||||
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
|
||||
class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." },
|
||||
Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." },
|
||||
JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." },
|
||||
JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." },
|
||||
Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." },
|
||||
@@ -3160,9 +3208,10 @@ var ts;
|
||||
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
|
||||
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
|
||||
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
|
||||
Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
|
||||
Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
|
||||
super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." },
|
||||
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
|
||||
The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
|
||||
A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
|
||||
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
|
||||
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
|
||||
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
|
||||
@@ -3174,6 +3223,9 @@ var ts;
|
||||
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
|
||||
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
};
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
@@ -4994,7 +5046,7 @@ var ts;
|
||||
"es2017": 4,
|
||||
"esnext": 5,
|
||||
}),
|
||||
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015,
|
||||
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT,
|
||||
paramType: ts.Diagnostics.VERSION,
|
||||
},
|
||||
{
|
||||
@@ -5175,11 +5227,15 @@ var ts;
|
||||
description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
|
||||
}
|
||||
];
|
||||
ts.typingOptionDeclarations = [
|
||||
ts.typeAcquisitionDeclarations = [
|
||||
{
|
||||
name: "enableAutoDiscovery",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "enable",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "include",
|
||||
type: "list",
|
||||
@@ -5204,6 +5260,18 @@ var ts;
|
||||
sourceMap: false,
|
||||
};
|
||||
var optionNameMapCache;
|
||||
function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
|
||||
if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
|
||||
var result = {
|
||||
enable: typeAcquisition.enableAutoDiscovery,
|
||||
include: typeAcquisition.include || [],
|
||||
exclude: typeAcquisition.exclude || []
|
||||
};
|
||||
return result;
|
||||
}
|
||||
return typeAcquisition;
|
||||
}
|
||||
ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
|
||||
function getOptionNameMap() {
|
||||
if (optionNameMapCache) {
|
||||
return optionNameMapCache;
|
||||
@@ -5226,14 +5294,7 @@ var ts;
|
||||
}
|
||||
ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
|
||||
function parseCustomTypeOption(opt, value, errors) {
|
||||
var key = trimString((value || "")).toLowerCase();
|
||||
var map = opt.type;
|
||||
if (key in map) {
|
||||
return map[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
|
||||
}
|
||||
return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors);
|
||||
}
|
||||
ts.parseCustomTypeOption = parseCustomTypeOption;
|
||||
function parseListTypeOption(opt, value, errors) {
|
||||
@@ -5473,9 +5534,10 @@ var ts;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {
|
||||
function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
|
||||
if (existingOptions === void 0) { existingOptions = {}; }
|
||||
if (resolutionStack === void 0) { resolutionStack = []; }
|
||||
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
|
||||
var errors = [];
|
||||
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName);
|
||||
@@ -5483,14 +5545,15 @@ var ts;
|
||||
return {
|
||||
options: {},
|
||||
fileNames: [],
|
||||
typingOptions: {},
|
||||
typeAcquisition: {},
|
||||
raw: json,
|
||||
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
|
||||
wildcardDirectories: {}
|
||||
};
|
||||
}
|
||||
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
|
||||
var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
|
||||
var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
|
||||
var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
|
||||
if (json["extends"]) {
|
||||
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
|
||||
if (typeof json["extends"] === "string") {
|
||||
@@ -5517,7 +5580,7 @@ var ts;
|
||||
return {
|
||||
options: options,
|
||||
fileNames: fileNames,
|
||||
typingOptions: typingOptions,
|
||||
typeAcquisition: typeAcquisition,
|
||||
raw: json,
|
||||
errors: errors,
|
||||
wildcardDirectories: wildcardDirectories,
|
||||
@@ -5525,7 +5588,7 @@ var ts;
|
||||
};
|
||||
function tryExtendsName(extendedConfig) {
|
||||
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
|
||||
return;
|
||||
}
|
||||
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
|
||||
@@ -5588,7 +5651,7 @@ var ts;
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
||||
}
|
||||
else {
|
||||
excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
|
||||
excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
|
||||
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
|
||||
if (outDir) {
|
||||
excludeSpecs.push(outDir);
|
||||
@@ -5597,7 +5660,7 @@ var ts;
|
||||
if (fileNames === undefined && includeSpecs === undefined) {
|
||||
includeSpecs = ["**/*"];
|
||||
}
|
||||
var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
|
||||
var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions);
|
||||
if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])));
|
||||
}
|
||||
@@ -5623,12 +5686,12 @@ var ts;
|
||||
return { options: options, errors: errors };
|
||||
}
|
||||
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
|
||||
function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
|
||||
function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
|
||||
var errors = [];
|
||||
var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
|
||||
var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
|
||||
return { options: options, errors: errors };
|
||||
}
|
||||
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
|
||||
ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
|
||||
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
|
||||
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
|
||||
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
|
||||
@@ -5636,9 +5699,10 @@ var ts;
|
||||
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
|
||||
return options;
|
||||
}
|
||||
function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
|
||||
var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
|
||||
convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
|
||||
function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
|
||||
var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
|
||||
var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
|
||||
convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
|
||||
return options;
|
||||
}
|
||||
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
|
||||
@@ -5700,7 +5764,7 @@ var ts;
|
||||
var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/;
|
||||
var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
|
||||
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
||||
function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {
|
||||
function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) {
|
||||
basePath = ts.normalizePath(basePath);
|
||||
var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
|
||||
var literalFileMap = ts.createMap();
|
||||
@@ -5712,7 +5776,7 @@ var ts;
|
||||
exclude = validateSpecs(exclude, errors, true);
|
||||
}
|
||||
var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
||||
if (fileNames) {
|
||||
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
|
||||
var fileName = fileNames_1[_i];
|
||||
@@ -5857,9 +5921,9 @@ var ts;
|
||||
"constants", "process", "v8", "timers", "console"
|
||||
];
|
||||
var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });
|
||||
function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
|
||||
function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
|
||||
var inferredTypings = ts.createMap();
|
||||
if (!typingOptions || !typingOptions.enableAutoDiscovery) {
|
||||
if (!typeAcquisition || !typeAcquisition.enable) {
|
||||
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
|
||||
}
|
||||
fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
|
||||
@@ -5873,8 +5937,8 @@ var ts;
|
||||
var filesToWatch = [];
|
||||
var searchDirs = [];
|
||||
var exclude = [];
|
||||
mergeTypings(typingOptions.include);
|
||||
exclude = typingOptions.exclude || [];
|
||||
mergeTypings(typeAcquisition.include);
|
||||
exclude = typeAcquisition.exclude || [];
|
||||
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
|
||||
if (projectRootPath) {
|
||||
possibleSearchDirs.push(projectRootPath);
|
||||
@@ -6007,7 +6071,8 @@ var ts;
|
||||
(function (server) {
|
||||
server.ActionSet = "action::set";
|
||||
server.ActionInvalidate = "action::invalidate";
|
||||
server.EventInstall = "event::install";
|
||||
server.EventBeginInstallTypes = "event::beginInstallTypes";
|
||||
server.EventEndInstallTypes = "event::endInstallTypes";
|
||||
var Arguments;
|
||||
(function (Arguments) {
|
||||
Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation";
|
||||
@@ -6057,6 +6122,7 @@ var ts;
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
|
||||
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent = readJson(packageJsonPath, state.host);
|
||||
switch (extensions) {
|
||||
@@ -6618,9 +6684,17 @@ var ts;
|
||||
isEnabled: function () { return false; },
|
||||
writeLine: ts.noop
|
||||
};
|
||||
function typingToFileName(cachePath, packageName, installTypingHost) {
|
||||
var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
|
||||
return result.resolvedModule && result.resolvedModule.resolvedFileName;
|
||||
function typingToFileName(cachePath, packageName, installTypingHost, log) {
|
||||
try {
|
||||
var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
|
||||
return result.resolvedModule && result.resolvedModule.resolvedFileName;
|
||||
}
|
||||
catch (e) {
|
||||
if (log.isEnabled()) {
|
||||
log.writeLine("Failed to resolve " + packageName + " in folder '" + cachePath + "': " + e.message);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var PackageNameValidationResult;
|
||||
(function (PackageNameValidationResult) {
|
||||
@@ -6656,13 +6730,12 @@ var ts;
|
||||
}
|
||||
typingsInstaller.validatePackageName = validatePackageName;
|
||||
var TypingsInstaller = (function () {
|
||||
function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, telemetryEnabled, log) {
|
||||
function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, log) {
|
||||
if (log === void 0) { log = nullLog; }
|
||||
this.installTypingHost = installTypingHost;
|
||||
this.globalCachePath = globalCachePath;
|
||||
this.safeListPath = safeListPath;
|
||||
this.throttleLimit = throttleLimit;
|
||||
this.telemetryEnabled = telemetryEnabled;
|
||||
this.log = log;
|
||||
this.packageNameToTypingLocation = ts.createMap();
|
||||
this.missingTypingsSet = ts.createMap();
|
||||
@@ -6709,7 +6782,7 @@ var ts;
|
||||
}
|
||||
this.processCacheLocation(req.cachePath);
|
||||
}
|
||||
var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typingOptions, req.unresolvedImports);
|
||||
var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typeAcquisition, req.unresolvedImports);
|
||||
if (this.log.isEnabled()) {
|
||||
this.log.writeLine("Finished typings discovery: " + JSON.stringify(discoverTypingsResult));
|
||||
}
|
||||
@@ -6749,8 +6822,9 @@ var ts;
|
||||
if (!packageName) {
|
||||
continue;
|
||||
}
|
||||
var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost);
|
||||
var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log);
|
||||
if (!typingFile) {
|
||||
this.missingTypingsSet[packageName] = true;
|
||||
continue;
|
||||
}
|
||||
var existingTypingFile = this.packageNameToTypingLocation[packageName];
|
||||
@@ -6781,7 +6855,7 @@ var ts;
|
||||
var result = [];
|
||||
for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) {
|
||||
var typing = typingsToInstall_1[_i];
|
||||
if (this.missingTypingsSet[typing]) {
|
||||
if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) {
|
||||
continue;
|
||||
}
|
||||
var validationResult = validatePackageName(typing);
|
||||
@@ -6852,47 +6926,55 @@ var ts;
|
||||
this.ensurePackageDirectoryExists(cachePath);
|
||||
var requestId = this.installRunCount;
|
||||
this.installRunCount++;
|
||||
this.sendResponse({
|
||||
kind: server.EventBeginInstallTypes,
|
||||
eventId: requestId,
|
||||
typingsInstallerVersion: ts.version,
|
||||
projectName: req.projectName
|
||||
});
|
||||
this.installTypingsAsync(requestId, scopedTypings, cachePath, function (ok) {
|
||||
if (_this.telemetryEnabled) {
|
||||
try {
|
||||
if (!ok) {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("install request failed, marking packages as missing to prevent repeated requests: " + JSON.stringify(filteredTypings));
|
||||
}
|
||||
for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) {
|
||||
var typing = filteredTypings_1[_i];
|
||||
_this.missingTypingsSet[typing] = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Installed typings " + JSON.stringify(scopedTypings));
|
||||
}
|
||||
var installedTypingFiles = [];
|
||||
for (var _a = 0, filteredTypings_2 = filteredTypings; _a < filteredTypings_2.length; _a++) {
|
||||
var packageName = filteredTypings_2[_a];
|
||||
var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log);
|
||||
if (!typingFile) {
|
||||
_this.missingTypingsSet[packageName] = true;
|
||||
continue;
|
||||
}
|
||||
if (!_this.packageNameToTypingLocation[packageName]) {
|
||||
_this.packageNameToTypingLocation[packageName] = typingFile;
|
||||
}
|
||||
installedTypingFiles.push(typingFile);
|
||||
}
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles));
|
||||
}
|
||||
_this.sendResponse(_this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles)));
|
||||
}
|
||||
finally {
|
||||
_this.sendResponse({
|
||||
kind: server.EventInstall,
|
||||
kind: server.EventEndInstallTypes,
|
||||
eventId: requestId,
|
||||
projectName: req.projectName,
|
||||
packagesToInstall: scopedTypings,
|
||||
installSuccess: ok
|
||||
installSuccess: ok,
|
||||
typingsInstallerVersion: ts.version
|
||||
});
|
||||
}
|
||||
if (!ok) {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("install request failed, marking packages as missing to prevent repeated requests: " + JSON.stringify(filteredTypings));
|
||||
}
|
||||
for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) {
|
||||
var typing = filteredTypings_1[_i];
|
||||
_this.missingTypingsSet[typing] = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Requested to install typings " + JSON.stringify(scopedTypings) + ", installed typings " + JSON.stringify(scopedTypings));
|
||||
}
|
||||
var installedTypingFiles = [];
|
||||
for (var _a = 0, scopedTypings_1 = scopedTypings; _a < scopedTypings_1.length; _a++) {
|
||||
var t = scopedTypings_1[_a];
|
||||
var packageName = ts.getBaseFileName(t);
|
||||
if (!packageName) {
|
||||
continue;
|
||||
}
|
||||
var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost);
|
||||
if (!typingFile) {
|
||||
continue;
|
||||
}
|
||||
if (!_this.packageNameToTypingLocation[packageName]) {
|
||||
_this.packageNameToTypingLocation[packageName] = typingFile;
|
||||
}
|
||||
installedTypingFiles.push(typingFile);
|
||||
}
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles));
|
||||
}
|
||||
_this.sendResponse(_this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles)));
|
||||
});
|
||||
};
|
||||
TypingsInstaller.prototype.ensureDirectoryExists = function (directory, host) {
|
||||
@@ -6930,7 +7012,7 @@ var ts;
|
||||
TypingsInstaller.prototype.createSetTypings = function (request, typings) {
|
||||
return {
|
||||
projectName: request.projectName,
|
||||
typingOptions: request.typingOptions,
|
||||
typeAcquisition: request.typeAcquisition,
|
||||
compilerOptions: request.compilerOptions,
|
||||
typings: typings,
|
||||
unresolvedImports: request.unresolvedImports,
|
||||
@@ -7015,20 +7097,19 @@ var ts;
|
||||
}
|
||||
var NodeTypingsInstaller = (function (_super) {
|
||||
__extends(NodeTypingsInstaller, _super);
|
||||
function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, telemetryEnabled, log) {
|
||||
var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, telemetryEnabled, log) || this;
|
||||
function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, log) {
|
||||
var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log) || this;
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Process id: " + process.pid);
|
||||
}
|
||||
_this.npmPath = getNPMLocation(process.argv[0]);
|
||||
var execSync;
|
||||
(_a = require("child_process"), _this.exec = _a.exec, execSync = _a.execSync, _a);
|
||||
(_this.execSync = require("child_process").execSync);
|
||||
_this.ensurePackageDirectoryExists(globalTypingsCacheLocation);
|
||||
try {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Updating " + TypesRegistryPackageName + " npm package...");
|
||||
}
|
||||
execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" });
|
||||
_this.execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" });
|
||||
}
|
||||
catch (e) {
|
||||
if (_this.log.isEnabled()) {
|
||||
@@ -7037,7 +7118,6 @@ var ts;
|
||||
}
|
||||
_this.typesRegistry = loadTypesRegistryFile(getTypesRegistryFileLocation(globalTypingsCacheLocation), _this.installTypingHost, _this.log);
|
||||
return _this;
|
||||
var _a;
|
||||
}
|
||||
NodeTypingsInstaller.prototype.listen = function () {
|
||||
var _this = this;
|
||||
@@ -7061,25 +7141,32 @@ var ts;
|
||||
}
|
||||
};
|
||||
NodeTypingsInstaller.prototype.installWorker = function (requestId, args, cwd, onRequestCompleted) {
|
||||
var _this = this;
|
||||
if (this.log.isEnabled()) {
|
||||
this.log.writeLine("#" + requestId + " with arguments'" + JSON.stringify(args) + "'.");
|
||||
}
|
||||
var command = this.npmPath + " install " + args.join(" ") + " --save-dev";
|
||||
var command = this.npmPath + " install " + args.join(" ") + " --save-dev --user-agent=\"typesInstaller/" + ts.version + "\"";
|
||||
var start = Date.now();
|
||||
this.exec(command, { cwd: cwd }, function (err, stdout, stderr) {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + stdout + ts.sys.newLine + "stderr: " + stderr);
|
||||
}
|
||||
onRequestCompleted(!err);
|
||||
});
|
||||
var stdout;
|
||||
var stderr;
|
||||
var hasError = false;
|
||||
try {
|
||||
stdout = this.execSync(command, { cwd: cwd });
|
||||
}
|
||||
catch (e) {
|
||||
stdout = e.stdout;
|
||||
stderr = e.stderr;
|
||||
hasError = true;
|
||||
}
|
||||
if (this.log.isEnabled()) {
|
||||
this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + (stdout && stdout.toString()) + ts.sys.newLine + "stderr: " + (stderr && stderr.toString()));
|
||||
}
|
||||
onRequestCompleted(!hasError);
|
||||
};
|
||||
return NodeTypingsInstaller;
|
||||
}(typingsInstaller.TypingsInstaller));
|
||||
typingsInstaller.NodeTypingsInstaller = NodeTypingsInstaller;
|
||||
var logFilePath = server.findArgument(server.Arguments.LogFile);
|
||||
var globalTypingsCacheLocation = server.findArgument(server.Arguments.GlobalCacheLocation);
|
||||
var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry);
|
||||
var log = new FileLog(logFilePath);
|
||||
if (log.isEnabled()) {
|
||||
process.on("uncaughtException", function (e) {
|
||||
@@ -7092,7 +7179,7 @@ var ts;
|
||||
}
|
||||
process.exit(0);
|
||||
});
|
||||
var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, telemetryEnabled, log);
|
||||
var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, log);
|
||||
installer.listen();
|
||||
})(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {}));
|
||||
})(server = ts.server || (ts.server = {}));
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@
|
||||
"through2": "latest",
|
||||
"travis-fold": "latest",
|
||||
"ts-node": "latest",
|
||||
"tslint": "next",
|
||||
"tslint": "4.0.0-dev.3",
|
||||
"typescript": "next"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
+24
-8
@@ -4618,8 +4618,8 @@ namespace ts {
|
||||
// the modifiers type is T. Otherwise, the modifiers type is {}.
|
||||
const declaredType = <MappedType>getTypeFromMappedTypeNode(type.declaration);
|
||||
const constraint = getConstraintTypeFromMappedType(declaredType);
|
||||
const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
|
||||
type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
|
||||
const extendedConstraint = constraint && constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
|
||||
type.modifiersType = extendedConstraint && extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
|
||||
}
|
||||
}
|
||||
return type.modifiersType;
|
||||
@@ -6651,7 +6651,7 @@ namespace ts {
|
||||
// Starting with the parent of the symbol's declaration, check if the mapper maps any of
|
||||
// the type parameters introduced by enclosing declarations. We just pick the first
|
||||
// declaration since multiple declarations will all have the same parent anyway.
|
||||
let node = symbol.declarations[0].parent;
|
||||
let node: Node = symbol.declarations[0];
|
||||
while (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionType:
|
||||
@@ -6671,7 +6671,7 @@ namespace ts {
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
const declaration = <DeclarationWithTypeParameters>node;
|
||||
const declaration = node as DeclarationWithTypeParameters;
|
||||
if (declaration.typeParameters) {
|
||||
for (const d of declaration.typeParameters) {
|
||||
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
|
||||
@@ -6686,6 +6686,14 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
const func = node as JSDocFunctionType;
|
||||
for (const p of func.parameters) {
|
||||
if (contains(mappedTypes, getTypeOfNode(p))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.SourceFile:
|
||||
return false;
|
||||
@@ -7736,8 +7744,11 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(<ObjectType>target))) {
|
||||
return Ternary.True;
|
||||
else if (relation !== identityRelation) {
|
||||
const resolved = resolveStructuredTypeMembers(<ObjectType>target);
|
||||
if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & TypeFlags.Any) {
|
||||
return Ternary.True;
|
||||
}
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
@@ -21851,8 +21862,13 @@ namespace ts {
|
||||
|
||||
function checkGrammarNumericLiteral(node: NumericLiteral): boolean {
|
||||
// Grammar checking
|
||||
if (node.isOctalLiteral && languageVersion >= ScriptTarget.ES5) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher);
|
||||
if (node.isOctalLiteral) {
|
||||
if (languageVersion >= ScriptTarget.ES5) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0o_0, node.text);
|
||||
}
|
||||
if (isChildOfLiteralType(node)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0o_0, node.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
"category": "Error",
|
||||
"code": 1084
|
||||
},
|
||||
"Octal literals are not available when targeting ECMAScript 5 and higher.": {
|
||||
"Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 1085
|
||||
},
|
||||
@@ -2693,6 +2693,10 @@
|
||||
"category": "Message",
|
||||
"code": 6080
|
||||
},
|
||||
"File '{0}' has an unsupported extension, so skipping it.": {
|
||||
"category": "Message",
|
||||
"code": 6081
|
||||
},
|
||||
"Only 'amd' and 'system' modules are supported alongside --{0}.": {
|
||||
"category": "Error",
|
||||
"code": 6082
|
||||
@@ -2953,6 +2957,10 @@
|
||||
"category": "Message",
|
||||
"code": 6146
|
||||
},
|
||||
"Resolution for module '{0}' was found in cache": {
|
||||
"category": "Message",
|
||||
"code": 6147
|
||||
},
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
@@ -3242,5 +3250,9 @@
|
||||
"Add {0} to existing import declaration from {1}": {
|
||||
"category": "Message",
|
||||
"code": 90015
|
||||
},
|
||||
"Octal literal types must use ES2015 syntax. Use the syntax '0o{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 8017
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,6 @@ namespace ts {
|
||||
return resolved.path;
|
||||
}
|
||||
|
||||
/** Create Resolved from a file with unknown extension. */
|
||||
function resolvedFromAnyFile(path: string): Resolved | undefined {
|
||||
return { path, extension: extensionFromPath(path) };
|
||||
}
|
||||
|
||||
/** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */
|
||||
function resolvedModuleFromResolved({ path, extension }: Resolved, isExternalLibraryImport: boolean): ResolvedModuleFull {
|
||||
return { resolvedFileName: path, extension, isExternalLibraryImport };
|
||||
@@ -71,7 +66,8 @@ namespace ts {
|
||||
traceEnabled: boolean;
|
||||
}
|
||||
|
||||
function tryReadTypesSection(extensions: Extensions, packageJsonPath: string, baseDirectory: string, state: ModuleResolutionState): string {
|
||||
/** Reads from "main" or "types"/"typings" depending on `extensions`. */
|
||||
function tryReadPackageJsonMainOrTypes(extensions: Extensions, packageJsonPath: string, baseDirectory: string, state: ModuleResolutionState): string {
|
||||
const jsonContent = readJson(packageJsonPath, state.host);
|
||||
|
||||
switch (extensions) {
|
||||
@@ -153,6 +149,7 @@ namespace ts {
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
return typeRoots;
|
||||
}
|
||||
@@ -241,7 +238,8 @@ namespace ts {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
||||
}
|
||||
resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState));
|
||||
const result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined);
|
||||
resolvedFile = resolvedTypeScriptOnly(result && result.value);
|
||||
if (!resolvedFile && traceEnabled) {
|
||||
trace(host, Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
||||
}
|
||||
@@ -293,33 +291,171 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
/**
|
||||
* Cached module resolutions per containing directory.
|
||||
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
|
||||
*/
|
||||
export interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
|
||||
getOrCreateCacheForDirectory(directoryName: string): Map<ResolvedModuleWithFailedLookupLocations>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
|
||||
* We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
|
||||
*/
|
||||
export interface NonRelativeModuleNameResolutionCache {
|
||||
getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache;
|
||||
}
|
||||
|
||||
export interface PerModuleNameCache {
|
||||
get(directory: string): ResolvedModuleWithFailedLookupLocations;
|
||||
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
|
||||
}
|
||||
|
||||
export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache {
|
||||
const directoryToModuleNameMap = createFileMap<Map<ResolvedModuleWithFailedLookupLocations>>();
|
||||
const moduleNameToDirectoryMap = createMap<PerModuleNameCache>();
|
||||
|
||||
return { getOrCreateCacheForDirectory, getOrCreateCacheForModuleName };
|
||||
|
||||
function getOrCreateCacheForDirectory(directoryName: string) {
|
||||
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
||||
let perFolderCache = directoryToModuleNameMap.get(path);
|
||||
if (!perFolderCache) {
|
||||
perFolderCache = createMap<ResolvedModuleWithFailedLookupLocations>();
|
||||
directoryToModuleNameMap.set(path, perFolderCache);
|
||||
}
|
||||
return perFolderCache;
|
||||
}
|
||||
|
||||
function getOrCreateCacheForModuleName(nonRelativeModuleName: string) {
|
||||
if (!moduleHasNonRelativeName(nonRelativeModuleName)) {
|
||||
return undefined;
|
||||
}
|
||||
let perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName];
|
||||
if (!perModuleNameCache) {
|
||||
moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache();
|
||||
}
|
||||
return perModuleNameCache;
|
||||
}
|
||||
|
||||
function createPerModuleNameCache(): PerModuleNameCache {
|
||||
const directoryPathMap = createFileMap<ResolvedModuleWithFailedLookupLocations>();
|
||||
|
||||
return { get, set };
|
||||
|
||||
function get(directory: string): ResolvedModuleWithFailedLookupLocations {
|
||||
return directoryPathMap.get(toPath(directory, currentDirectory, getCanonicalFileName));
|
||||
}
|
||||
|
||||
/**
|
||||
* At first this function add entry directory -> module resolution result to the table.
|
||||
* Then it computes the set of parent folders for 'directory' that should have the same module resolution result
|
||||
* and for every parent folder in set it adds entry: parent -> module resolution. .
|
||||
* Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts.
|
||||
* Set of parent folders that should have the same result will be:
|
||||
* [
|
||||
* /a/b/c/d, /a/b/c, /a/b
|
||||
* ]
|
||||
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
||||
*/
|
||||
function set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void {
|
||||
const path = toPath(directory, currentDirectory, getCanonicalFileName);
|
||||
// if entry is already in cache do nothing
|
||||
if (directoryPathMap.contains(path)) {
|
||||
return;
|
||||
}
|
||||
directoryPathMap.set(path, result);
|
||||
|
||||
const resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName;
|
||||
// find common prefix between directory and resolved file name
|
||||
// this common prefix should be the shorted path that has the same resolution
|
||||
// directory: /a/b/c/d/e
|
||||
// resolvedFileName: /a/b/foo.d.ts
|
||||
const commonPrefix = getCommonPrefix(path, resolvedFileName);
|
||||
let current = path;
|
||||
while (true) {
|
||||
const parent = getDirectoryPath(current);
|
||||
if (parent === current || directoryPathMap.contains(parent)) {
|
||||
break;
|
||||
}
|
||||
directoryPathMap.set(parent, result);
|
||||
current = parent;
|
||||
|
||||
if (current == commonPrefix) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCommonPrefix(directory: Path, resolution: string) {
|
||||
if (resolution === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const resolutionDirectory = toPath(getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
||||
|
||||
// find first position where directory and resolution differs
|
||||
let i = 0;
|
||||
while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
||||
i++;
|
||||
}
|
||||
|
||||
// find last directory separator before position i
|
||||
const sep = directory.lastIndexOf(directorySeparator, i);
|
||||
if (sep < 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return directory.substr(0, sep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations {
|
||||
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);
|
||||
}
|
||||
const containingDirectory = getDirectoryPath(containingFile);
|
||||
let perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
||||
let result = perFolderCache && perFolderCache[moduleName];
|
||||
|
||||
let moduleResolution = compilerOptions.moduleResolution;
|
||||
if (moduleResolution === undefined) {
|
||||
moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
|
||||
if (result) {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
|
||||
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
|
||||
let moduleResolution = compilerOptions.moduleResolution;
|
||||
if (moduleResolution === undefined) {
|
||||
moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let result: ResolvedModuleWithFailedLookupLocations;
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.NodeJs:
|
||||
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host);
|
||||
break;
|
||||
case ModuleResolutionKind.Classic:
|
||||
result = classicNameResolver(moduleName, containingFile, compilerOptions, host);
|
||||
break;
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.NodeJs:
|
||||
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache);
|
||||
break;
|
||||
case ModuleResolutionKind.Classic:
|
||||
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache);
|
||||
break;
|
||||
}
|
||||
|
||||
if (perFolderCache) {
|
||||
perFolderCache[moduleName] = result;
|
||||
// put result in per-module name cache
|
||||
const perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName);
|
||||
if (perModuleNameCache) {
|
||||
perModuleNameCache.set(containingDirectory, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (traceEnabled) {
|
||||
@@ -542,7 +678,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations {
|
||||
const containingDirectory = getDirectoryPath(containingFile);
|
||||
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
||||
|
||||
@@ -550,30 +686,30 @@ namespace ts {
|
||||
const state: ModuleResolutionState = { compilerOptions, host, traceEnabled };
|
||||
|
||||
const result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
||||
if (result) {
|
||||
const { resolved, isExternalLibraryImport } = result;
|
||||
if (result && result.value) {
|
||||
const { resolved, isExternalLibraryImport } = result.value;
|
||||
return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations);
|
||||
}
|
||||
return { resolvedModule: undefined, failedLookupLocations };
|
||||
|
||||
function tryResolve(extensions: Extensions): { resolved: Resolved, isExternalLibraryImport: boolean } | undefined {
|
||||
function tryResolve(extensions: Extensions): SearchResult<{ resolved: Resolved, isExternalLibraryImport: boolean }> {
|
||||
const resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);
|
||||
if (resolved) {
|
||||
return { resolved, isExternalLibraryImport: false };
|
||||
return toSearchResult({ resolved, isExternalLibraryImport: false });
|
||||
}
|
||||
|
||||
if (moduleHasNonRelativeName(moduleName)) {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);
|
||||
}
|
||||
const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state);
|
||||
const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache);
|
||||
// For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files.
|
||||
return resolved && { resolved: { path: realpath(resolved.path, host, traceEnabled), extension: resolved.extension }, isExternalLibraryImport: true };
|
||||
return resolved && { value: resolved.value && { resolved: { path: realpath(resolved.value.path, host, traceEnabled), extension: resolved.value.extension }, isExternalLibraryImport: true } };
|
||||
}
|
||||
else {
|
||||
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
||||
const resolved = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);
|
||||
return resolved && { resolved, isExternalLibraryImport: false };
|
||||
return resolved && toSearchResult({ resolved, isExternalLibraryImport: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -678,18 +814,21 @@ namespace ts {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
||||
}
|
||||
const typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);
|
||||
if (typesFile) {
|
||||
const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(typesFile), state.host);
|
||||
const mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state);
|
||||
if (mainOrTypesFile) {
|
||||
const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(mainOrTypesFile), state.host);
|
||||
// A package.json "typings" may specify an exact filename, or may choose to omit an extension.
|
||||
const fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures, state);
|
||||
if (fromFile) {
|
||||
// Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden.
|
||||
return resolvedFromAnyFile(fromFile);
|
||||
const fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures, state);
|
||||
if (fromExactFile) {
|
||||
const resolved = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile);
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
}
|
||||
trace(state.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
|
||||
}
|
||||
const x = tryAddingExtensions(typesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state);
|
||||
if (x) {
|
||||
return x;
|
||||
const resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state);
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -709,6 +848,24 @@ namespace ts {
|
||||
return loadModuleFromFile(extensions, combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state);
|
||||
}
|
||||
|
||||
/** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */
|
||||
function resolvedIfExtensionMatches(extensions: Extensions, path: string): Resolved | undefined {
|
||||
const extension = tryGetExtensionFromPath(path);
|
||||
return extension !== undefined && extensionIsOk(extensions, extension) ? { path, extension } : undefined;
|
||||
}
|
||||
|
||||
/** True if `extension` is one of the supported `extensions`. */
|
||||
function extensionIsOk(extensions: Extensions, extension: Extension): boolean {
|
||||
switch (extensions) {
|
||||
case Extensions.JavaScript:
|
||||
return extension === Extension.Js || extension === Extension.Jsx;
|
||||
case Extensions.TypeScript:
|
||||
return extension === Extension.Ts || extension === Extension.Tsx || extension === Extension.Dts;
|
||||
case Extensions.DtsOnly:
|
||||
return extension === Extension.Dts;
|
||||
}
|
||||
}
|
||||
|
||||
function pathToPackageJson(directory: string): string {
|
||||
return combinePaths(directory, "package.json");
|
||||
}
|
||||
@@ -722,18 +879,23 @@ namespace ts {
|
||||
loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
|
||||
}
|
||||
|
||||
function loadModuleFromNodeModules(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push<string>, state: ModuleResolutionState): Resolved | undefined {
|
||||
return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false);
|
||||
function loadModuleFromNodeModules(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push<string>, state: ModuleResolutionState, cache: NonRelativeModuleNameResolutionCache): SearchResult<Resolved> {
|
||||
return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache);
|
||||
}
|
||||
function loadModuleFromNodeModulesAtTypes(moduleName: string, directory: string, failedLookupLocations: Push<string>, state: ModuleResolutionState): Resolved | undefined {
|
||||
function loadModuleFromNodeModulesAtTypes(moduleName: string, directory: string, failedLookupLocations: Push<string>, state: ModuleResolutionState): SearchResult<Resolved> {
|
||||
// Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly.
|
||||
return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true);
|
||||
return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined);
|
||||
}
|
||||
|
||||
function loadModuleFromNodeModulesWorker(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push<string>, state: ModuleResolutionState, typesOnly: boolean): Resolved | undefined {
|
||||
function loadModuleFromNodeModulesWorker(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push<string>, state: ModuleResolutionState, typesOnly: boolean, cache: NonRelativeModuleNameResolutionCache): SearchResult<Resolved> {
|
||||
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
|
||||
return forEachAncestorDirectory(normalizeSlashes(directory), ancestorDirectory => {
|
||||
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
||||
return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly);
|
||||
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host);
|
||||
if (resolutionFromCache) {
|
||||
return resolutionFromCache;
|
||||
}
|
||||
return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -749,26 +911,41 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
function tryFindNonRelativeModuleNameInCache(cache: PerModuleNameCache | undefined, moduleName: string, containingDirectory: string, traceEnabled: boolean, host: ModuleResolutionHost): SearchResult<Resolved> {
|
||||
const result = cache && cache.get(containingDirectory);
|
||||
if (result) {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName)
|
||||
}
|
||||
return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } };
|
||||
}
|
||||
}
|
||||
|
||||
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations {
|
||||
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
||||
const state: ModuleResolutionState = { compilerOptions, host, traceEnabled };
|
||||
const failedLookupLocations: string[] = [];
|
||||
const containingDirectory = getDirectoryPath(containingFile);
|
||||
|
||||
const resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
||||
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations);
|
||||
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations);
|
||||
|
||||
function tryResolve(extensions: Extensions): Resolved | undefined {
|
||||
function tryResolve(extensions: Extensions): SearchResult<Resolved> {
|
||||
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);
|
||||
if (resolvedUsingSettings) {
|
||||
return resolvedUsingSettings;
|
||||
return { value: resolvedUsingSettings };
|
||||
}
|
||||
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
|
||||
|
||||
if (moduleHasNonRelativeName(moduleName)) {
|
||||
// Climb up parent directories looking for a module.
|
||||
const resolved = forEachAncestorDirectory(containingDirectory, directory => {
|
||||
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
|
||||
if (resolutionFromCache) {
|
||||
return resolutionFromCache;
|
||||
}
|
||||
const searchName = normalizePath(combinePaths(directory, moduleName));
|
||||
return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state);
|
||||
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state));
|
||||
});
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
@@ -780,7 +957,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
||||
return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);
|
||||
return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -801,8 +978,28 @@ namespace ts {
|
||||
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents result of search. Normally when searching among several alternatives we treat value `undefined` as indicator
|
||||
* that search fails and we should try another option.
|
||||
* However this does not allow us to represent final result that should be used instead of further searching (i.e. a final result that was found in cache).
|
||||
* SearchResult is used to deal with this issue, its values represents following outcomes:
|
||||
* - undefined - not found, continue searching
|
||||
* - { value: undefined } - not found - stop searching
|
||||
* - { value: <some-value> } - found - stop searching
|
||||
*/
|
||||
type SearchResult<T> = { value: T | undefined } | undefined;
|
||||
|
||||
/**
|
||||
* Wraps value to SearchResult.
|
||||
* @returns undefined if value is undefined or { value } otherwise
|
||||
*/
|
||||
function toSearchResult<T>(value: T | undefined): SearchResult<T> {
|
||||
return value !== undefined ? { value } : undefined;
|
||||
}
|
||||
|
||||
|
||||
/** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */
|
||||
function forEachAncestorDirectory<T>(directory: string, callback: (directory: string) => T | undefined): T | undefined {
|
||||
function forEachAncestorDirectory<T>(directory: string, callback: (directory: string) => SearchResult<T>): SearchResult<T> {
|
||||
while (true) {
|
||||
const result = callback(directory);
|
||||
if (result !== undefined) {
|
||||
|
||||
@@ -325,6 +325,7 @@ namespace ts {
|
||||
// Map storing if there is emit blocking diagnostics for given input
|
||||
const hasEmitBlockingDiagnostics = createFileMap<boolean>(getCanonicalFileName);
|
||||
|
||||
let moduleResolutionCache: ModuleResolutionCache;
|
||||
let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string) => ResolvedModuleFull[];
|
||||
if (host.resolveModuleNames) {
|
||||
resolveModuleNamesWorker = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile).map(resolved => {
|
||||
@@ -338,7 +339,8 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
else {
|
||||
const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host).resolvedModule;
|
||||
moduleResolutionCache = createModuleResolutionCache(currentDirectory, x => host.getCanonicalFileName(x));
|
||||
const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule;
|
||||
resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(moduleNames, containingFile, loader);
|
||||
}
|
||||
|
||||
@@ -391,6 +393,9 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks
|
||||
moduleResolutionCache = undefined;
|
||||
|
||||
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
||||
oldProgram = undefined;
|
||||
|
||||
|
||||
@@ -2290,7 +2290,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
startLexicalEnvironment();
|
||||
let loopBody = visitNode(node.statement, visitor, isStatement);
|
||||
let loopBody = visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock);
|
||||
const lexicalEnvironment = endLexicalEnvironment();
|
||||
|
||||
const currentState = convertedLoopState;
|
||||
@@ -2305,7 +2305,10 @@ namespace ts {
|
||||
loopBody = createBlock(statements, /*location*/ undefined, /*multiline*/ true);
|
||||
}
|
||||
|
||||
if (!isBlock(loopBody)) {
|
||||
if (isBlock(loopBody)) {
|
||||
loopBody.multiLine = true;
|
||||
}
|
||||
else {
|
||||
loopBody = createBlock([loopBody], /*location*/ undefined, /*multiline*/ true);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,20 @@ namespace ts {
|
||||
* @param context Context and state information for the transformation.
|
||||
*/
|
||||
export function transformES5(context: TransformationContext) {
|
||||
const compilerOptions = context.getCompilerOptions();
|
||||
|
||||
// enable emit notification only if using --jsx preserve
|
||||
let previousOnEmitNode: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void;
|
||||
let noSubstitution: boolean[];
|
||||
if (compilerOptions.jsx === JsxEmit.Preserve) {
|
||||
previousOnEmitNode = context.onEmitNode;
|
||||
context.onEmitNode = onEmitNode;
|
||||
context.enableEmitNotification(SyntaxKind.JsxOpeningElement);
|
||||
context.enableEmitNotification(SyntaxKind.JsxClosingElement);
|
||||
context.enableEmitNotification(SyntaxKind.JsxSelfClosingElement);
|
||||
noSubstitution = [];
|
||||
}
|
||||
|
||||
const previousOnSubstituteNode = context.onSubstituteNode;
|
||||
context.onSubstituteNode = onSubstituteNode;
|
||||
context.enableSubstitution(SyntaxKind.PropertyAccessExpression);
|
||||
@@ -24,6 +38,24 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the printer just before a node is printed.
|
||||
*
|
||||
* @param node The node to be printed.
|
||||
*/
|
||||
function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.JsxOpeningElement:
|
||||
case SyntaxKind.JsxClosingElement:
|
||||
case SyntaxKind.JsxSelfClosingElement:
|
||||
const tagName = (<JsxOpeningElement | JsxClosingElement | JsxSelfClosingElement>node).tagName;
|
||||
noSubstitution[getOriginalNodeId(tagName)] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks node substitutions.
|
||||
*
|
||||
@@ -31,6 +63,10 @@ namespace ts {
|
||||
* @param node The node to substitute.
|
||||
*/
|
||||
function onSubstituteNode(emitContext: EmitContext, node: Node) {
|
||||
if (node.id && noSubstitution && noSubstitution[node.id]) {
|
||||
return previousOnSubstituteNode(emitContext, node);
|
||||
}
|
||||
|
||||
node = previousOnSubstituteNode(emitContext, node);
|
||||
if (isPropertyAccessExpression(node)) {
|
||||
return substitutePropertyAccessExpression(node);
|
||||
|
||||
@@ -1555,12 +1555,15 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
type SerializedEntityNameAsExpression = Identifier | BinaryExpression | PropertyAccessExpression;
|
||||
type SerializedTypeNode = SerializedEntityNameAsExpression | VoidExpression | ConditionalExpression;
|
||||
|
||||
/**
|
||||
* Serializes the type of a node for use with decorator type metadata.
|
||||
*
|
||||
* @param node The node that should have its type serialized.
|
||||
*/
|
||||
function serializeTypeOfNode(node: Node): Expression {
|
||||
function serializeTypeOfNode(node: Node): SerializedTypeNode {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
@@ -1582,7 +1585,7 @@ namespace ts {
|
||||
*
|
||||
* @param node The node that should have its parameter types serialized.
|
||||
*/
|
||||
function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): Expression {
|
||||
function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): ArrayLiteralExpression {
|
||||
const valueDeclaration =
|
||||
isClassLike(node)
|
||||
? getFirstConstructorWithBody(node)
|
||||
@@ -1590,7 +1593,7 @@ namespace ts {
|
||||
? node
|
||||
: undefined;
|
||||
|
||||
const expressions: Expression[] = [];
|
||||
const expressions: SerializedTypeNode[] = [];
|
||||
if (valueDeclaration) {
|
||||
const parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container);
|
||||
const numParameters = parameters.length;
|
||||
@@ -1626,7 +1629,7 @@ namespace ts {
|
||||
*
|
||||
* @param node The node that should have its return type serialized.
|
||||
*/
|
||||
function serializeReturnTypeOfNode(node: Node): Expression {
|
||||
function serializeReturnTypeOfNode(node: Node): SerializedTypeNode {
|
||||
if (isFunctionLike(node) && node.type) {
|
||||
return serializeTypeNode(node.type);
|
||||
}
|
||||
@@ -1655,13 +1658,16 @@ namespace ts {
|
||||
*
|
||||
* @param node The type node to serialize.
|
||||
*/
|
||||
function serializeTypeNode(node: TypeNode): Expression {
|
||||
function serializeTypeNode(node: TypeNode): SerializedTypeNode {
|
||||
if (node === undefined) {
|
||||
return createIdentifier("Object");
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.UndefinedKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
case SyntaxKind.NeverKeyword:
|
||||
return createVoidZero();
|
||||
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
@@ -1713,37 +1719,8 @@ namespace ts {
|
||||
|
||||
case SyntaxKind.IntersectionType:
|
||||
case SyntaxKind.UnionType:
|
||||
{
|
||||
const unionOrIntersection = <UnionOrIntersectionTypeNode>node;
|
||||
let serializedUnion: Identifier;
|
||||
for (const typeNode of unionOrIntersection.types) {
|
||||
const serializedIndividual = serializeTypeNode(typeNode) as Identifier;
|
||||
// Non identifier
|
||||
if (serializedIndividual.kind !== SyntaxKind.Identifier) {
|
||||
serializedUnion = undefined;
|
||||
break;
|
||||
}
|
||||
return serializeUnionOrIntersectionType(<UnionOrIntersectionTypeNode>node);
|
||||
|
||||
// One of the individual is global object, return immediately
|
||||
if (serializedIndividual.text === "Object") {
|
||||
return serializedIndividual;
|
||||
}
|
||||
|
||||
// Different types
|
||||
if (serializedUnion && serializedUnion.text !== serializedIndividual.text) {
|
||||
serializedUnion = undefined;
|
||||
break;
|
||||
}
|
||||
|
||||
serializedUnion = serializedIndividual;
|
||||
}
|
||||
|
||||
// If we were able to find common type
|
||||
if (serializedUnion) {
|
||||
return serializedUnion;
|
||||
}
|
||||
}
|
||||
// Fallthrough
|
||||
case SyntaxKind.TypeQuery:
|
||||
case SyntaxKind.TypeOperator:
|
||||
case SyntaxKind.IndexedAccessType:
|
||||
@@ -1761,13 +1738,48 @@ namespace ts {
|
||||
return createIdentifier("Object");
|
||||
}
|
||||
|
||||
function serializeUnionOrIntersectionType(node: UnionOrIntersectionTypeNode): SerializedTypeNode {
|
||||
let serializedUnion: SerializedTypeNode;
|
||||
for (const typeNode of node.types) {
|
||||
const serializedIndividual = serializeTypeNode(typeNode);
|
||||
|
||||
if (isVoidExpression(serializedIndividual)) {
|
||||
// If we dont have any other type already set, set the initial type
|
||||
if (!serializedUnion) {
|
||||
serializedUnion = serializedIndividual;
|
||||
}
|
||||
}
|
||||
else if (isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") {
|
||||
// One of the individual is global object, return immediately
|
||||
return serializedIndividual;
|
||||
}
|
||||
// If there exists union that is not void 0 expression, check if the the common type is identifier.
|
||||
// anything more complex and we will just default to Object
|
||||
else if (serializedUnion && !isVoidExpression(serializedUnion)) {
|
||||
// Different types
|
||||
if (!isIdentifier(serializedUnion) ||
|
||||
!isIdentifier(serializedIndividual) ||
|
||||
serializedUnion.text !== serializedIndividual.text) {
|
||||
return createIdentifier("Object");
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Initialize the union type
|
||||
serializedUnion = serializedIndividual;
|
||||
}
|
||||
}
|
||||
|
||||
// If we were able to find common type, use it
|
||||
return serializedUnion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes a TypeReferenceNode to an appropriate JS constructor value for use with
|
||||
* decorator type metadata.
|
||||
*
|
||||
* @param node The type reference node.
|
||||
*/
|
||||
function serializeTypeReferenceNode(node: TypeReferenceNode) {
|
||||
function serializeTypeReferenceNode(node: TypeReferenceNode): SerializedTypeNode {
|
||||
switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) {
|
||||
case TypeReferenceSerializationKind.Unknown:
|
||||
const serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true);
|
||||
@@ -1822,7 +1834,7 @@ namespace ts {
|
||||
* @param useFallback A value indicating whether to use logical operators to test for the
|
||||
* entity name at runtime.
|
||||
*/
|
||||
function serializeEntityNameAsExpression(node: EntityName, useFallback: boolean): Expression {
|
||||
function serializeEntityNameAsExpression(node: EntityName, useFallback: boolean): SerializedEntityNameAsExpression {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
// Create a clone of the name with a new parent, and treat it as if it were
|
||||
@@ -1855,8 +1867,8 @@ namespace ts {
|
||||
* @param useFallback A value indicating whether to use logical operators to test for the
|
||||
* qualified name at runtime.
|
||||
*/
|
||||
function serializeQualifiedNameAsExpression(node: QualifiedName, useFallback: boolean): Expression {
|
||||
let left: Expression;
|
||||
function serializeQualifiedNameAsExpression(node: QualifiedName, useFallback: boolean): PropertyAccessExpression {
|
||||
let left: SerializedEntityNameAsExpression;
|
||||
if (node.left.kind === SyntaxKind.Identifier) {
|
||||
left = serializeEntityNameAsExpression(node.left, useFallback);
|
||||
}
|
||||
@@ -1881,7 +1893,7 @@ namespace ts {
|
||||
* Gets an expression that points to the global "Symbol" constructor at runtime if it is
|
||||
* available.
|
||||
*/
|
||||
function getGlobalSymbolNameWithFallback(): Expression {
|
||||
function getGlobalSymbolNameWithFallback(): ConditionalExpression {
|
||||
return createConditional(
|
||||
createTypeCheck(createIdentifier("Symbol"), "function"),
|
||||
createIdentifier("Symbol"),
|
||||
|
||||
@@ -732,6 +732,16 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isChildOfLiteralType(node: Node): boolean {
|
||||
while (node) {
|
||||
if (node.kind === SyntaxKind.LiteralType) {
|
||||
return true;
|
||||
}
|
||||
node = node.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Warning: This has the same semantics as the forEach family of functions,
|
||||
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
|
||||
export function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T {
|
||||
@@ -3570,6 +3580,10 @@ namespace ts {
|
||||
return node.kind === SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
export function isVoidExpression(node: Node): node is VoidExpression {
|
||||
return node.kind === SyntaxKind.VoidExpression;
|
||||
}
|
||||
|
||||
export function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier {
|
||||
// Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`.
|
||||
return isIdentifier(node) && node.autoGenerateKind > GeneratedIdentifierKind.None;
|
||||
|
||||
@@ -341,6 +341,7 @@ namespace FourSlash {
|
||||
insertSpaceAfterCommaDelimiter: true,
|
||||
insertSpaceAfterSemicolonInForStatements: true,
|
||||
insertSpaceBeforeAndAfterBinaryOperators: true,
|
||||
insertSpaceAfterConstructor: false,
|
||||
insertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
|
||||
@@ -1840,6 +1840,41 @@ namespace ts.projectSystem {
|
||||
assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 2");
|
||||
});
|
||||
|
||||
it("files are properly detached when language service is disabled", () => {
|
||||
const f1 = {
|
||||
path: "/a/app.js",
|
||||
content: "var x = 1"
|
||||
};
|
||||
const f2 = {
|
||||
path: "/a/largefile.js",
|
||||
content: ""
|
||||
};
|
||||
const f3 = {
|
||||
path: "/a/lib.js",
|
||||
content: "var x = 1"
|
||||
};
|
||||
const config = {
|
||||
path: "/a/tsconfig.json",
|
||||
content: JSON.stringify({ compilerOptions: { allowJs: true } })
|
||||
};
|
||||
const host = createServerHost([f1, f2, f3, config]);
|
||||
const originalGetFileSize = host.getFileSize;
|
||||
host.getFileSize = (filePath: string) =>
|
||||
filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath);
|
||||
|
||||
const projectService = createProjectService(host);
|
||||
projectService.openClientFile(f1.path);
|
||||
projectService.checkNumberOfProjects({ configuredProjects: 1 });
|
||||
|
||||
projectService.closeClientFile(f1.path);
|
||||
projectService.checkNumberOfProjects({});
|
||||
|
||||
for (const f of [f2, f3]) {
|
||||
const scriptInfo = projectService.getScriptInfoForNormalizedPath(server.toNormalizedPath(f.path));
|
||||
assert.equal(scriptInfo.containingProjects.length, 0, `expect 0 containing projects for '${f.path}'`)
|
||||
}
|
||||
});
|
||||
|
||||
it("language service disabled events are triggered", () => {
|
||||
const f1 = {
|
||||
path: "/a/app.js",
|
||||
|
||||
@@ -257,8 +257,9 @@ namespace ts.server {
|
||||
info.detachFromProject(this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// release all root files
|
||||
if (!this.program || !this.languageServiceEnabled) {
|
||||
// release all root files either if there is no program or language service is disabled.
|
||||
// in the latter case set of root files can be larger than the set of files in program.
|
||||
for (const root of this.rootFiles) {
|
||||
root.detachFromProject(this);
|
||||
}
|
||||
|
||||
@@ -2194,12 +2194,14 @@ namespace ts.server.protocol {
|
||||
insertSpaceAfterCommaDelimiter?: boolean;
|
||||
insertSpaceAfterSemicolonInForStatements?: boolean;
|
||||
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
|
||||
insertSpaceAfterConstructor?: boolean;
|
||||
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
insertSpaceBeforeFunctionParenthesis?: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace ts.server {
|
||||
newLineCharacter: host.newLine || "\n",
|
||||
convertTabsToSpaces: true,
|
||||
indentStyle: ts.IndentStyle.Smart,
|
||||
insertSpaceAfterConstructor: false,
|
||||
insertSpaceAfterCommaDelimiter: true,
|
||||
insertSpaceAfterSemicolonInForStatements: true,
|
||||
insertSpaceBeforeAndAfterBinaryOperators: true,
|
||||
@@ -87,6 +88,7 @@ namespace ts.server {
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
|
||||
insertSpaceBeforeFunctionParenthesis: false,
|
||||
placeOpenBraceOnNewLineForFunctions: false,
|
||||
placeOpenBraceOnNewLineForControlBlocks: false,
|
||||
};
|
||||
|
||||
@@ -488,14 +488,16 @@ namespace ts.formatting {
|
||||
// open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
case SyntaxKind.CloseBraceToken:
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
case SyntaxKind.CloseBracketToken:
|
||||
case SyntaxKind.OpenParenToken:
|
||||
case SyntaxKind.CloseParenToken:
|
||||
case SyntaxKind.ElseKeyword:
|
||||
case SyntaxKind.WhileKeyword:
|
||||
case SyntaxKind.AtToken:
|
||||
return indentation;
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
case SyntaxKind.CloseBracketToken:
|
||||
return (container.kind === SyntaxKind.MappedType) ?
|
||||
indentation + getEffectiveDelta(delta, container) : indentation;
|
||||
default:
|
||||
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
|
||||
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
|
||||
@@ -566,7 +568,7 @@ namespace ts.formatting {
|
||||
if (tokenInfo.token.end > node.end) {
|
||||
break;
|
||||
}
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
||||
}
|
||||
|
||||
function processChildNode(
|
||||
@@ -617,7 +619,7 @@ namespace ts.formatting {
|
||||
break;
|
||||
}
|
||||
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
|
||||
}
|
||||
|
||||
if (!formattingScanner.isOnToken()) {
|
||||
@@ -673,11 +675,11 @@ namespace ts.formatting {
|
||||
computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, parentStartLine);
|
||||
|
||||
listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
|
||||
}
|
||||
else {
|
||||
// consume any tokens that precede the list as child elements of 'node' using its indentation scope
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -697,13 +699,13 @@ namespace ts.formatting {
|
||||
// without this check close paren will be interpreted as list end token for function expression which is wrong
|
||||
if (tokenInfo.token.kind === listEndToken && rangeContainsRange(parent, tokenInfo.token)) {
|
||||
// consume list end token
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation, container?: Node): void {
|
||||
function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation, container: Node): void {
|
||||
Debug.assert(rangeContainsRange(parent, currentTokenInfo.token));
|
||||
|
||||
const lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine();
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace ts.formatting {
|
||||
public SpaceAfterLetConstInVariableDeclaration: Rule;
|
||||
public NoSpaceBeforeOpenParenInFuncCall: Rule;
|
||||
public SpaceAfterFunctionInFuncDecl: Rule;
|
||||
public SpaceBeforeOpenParenInFuncDecl: Rule;
|
||||
public NoSpaceBeforeOpenParenInFuncDecl: Rule;
|
||||
public SpaceAfterVoidOperator: Rule;
|
||||
|
||||
@@ -112,6 +113,7 @@ namespace ts.formatting {
|
||||
// TypeScript-specific rules
|
||||
|
||||
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
|
||||
public SpaceAfterConstructor: Rule;
|
||||
public NoSpaceAfterConstructor: Rule;
|
||||
|
||||
// Use of module as a function call. e.g.: import m2 = module("m2");
|
||||
@@ -329,6 +331,7 @@ namespace ts.formatting {
|
||||
this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete));
|
||||
this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.SpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space));
|
||||
|
||||
@@ -352,13 +355,14 @@ namespace ts.formatting {
|
||||
// TypeScript-specific higher priority rules
|
||||
|
||||
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
|
||||
this.SpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Use of module as a function call. e.g.: import m2 = module("m2");
|
||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Add a space around certain TypeScript keywords
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.ReadonlyKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword, SyntaxKind.KeyOfKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.FromKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
|
||||
@@ -437,7 +441,7 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute,
|
||||
|
||||
// TypeScript-specific rules
|
||||
this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,
|
||||
this.NoSpaceAfterModuleImport,
|
||||
this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords,
|
||||
this.SpaceAfterModuleName,
|
||||
this.SpaceBeforeArrow, this.SpaceAfterArrow,
|
||||
@@ -462,7 +466,6 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeOpenBracket,
|
||||
this.NoSpaceAfterCloseBracket,
|
||||
this.SpaceAfterSemicolon,
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl,
|
||||
this.SpaceBetweenStatements, this.SpaceAfterTryFinally
|
||||
];
|
||||
|
||||
@@ -575,6 +578,8 @@ namespace ts.formatting {
|
||||
return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
|
||||
// "in" keyword in for (let x in []) { }
|
||||
case SyntaxKind.ForInStatement:
|
||||
// "in" keyword in [P in keyof T]: T[P]
|
||||
case SyntaxKind.TypeParameter:
|
||||
return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword;
|
||||
// Technically, "of" is not a binary operator, but format it the same way as "in"
|
||||
case SyntaxKind.ForOfStatement:
|
||||
@@ -829,6 +834,7 @@ namespace ts.formatting {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
|
||||
@@ -38,6 +38,13 @@ namespace ts.formatting {
|
||||
private createActiveRules(options: ts.FormatCodeSettings): Rule[] {
|
||||
let rules = this.globalRules.HighPriorityCommonRules.slice(0);
|
||||
|
||||
if (options.insertSpaceAfterConstructor) {
|
||||
rules.push(this.globalRules.SpaceAfterConstructor);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterConstructor);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterCommaDelimiter) {
|
||||
rules.push(this.globalRules.SpaceAfterComma);
|
||||
}
|
||||
@@ -128,6 +135,13 @@ namespace ts.formatting {
|
||||
rules.push(this.globalRules.NoSpaceAfterBinaryOperator);
|
||||
}
|
||||
|
||||
if (options.insertSpaceBeforeFunctionParenthesis) {
|
||||
rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl);
|
||||
}
|
||||
|
||||
if (options.placeOpenBraceOnNewLineForControlBlocks) {
|
||||
rules.push(this.globalRules.NewLineBeforeOpenBraceInControl);
|
||||
}
|
||||
|
||||
@@ -438,6 +438,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.MappedType:
|
||||
case SyntaxKind.TupleType:
|
||||
case SyntaxKind.CaseBlock:
|
||||
case SyntaxKind.DefaultClause:
|
||||
|
||||
@@ -418,6 +418,7 @@ namespace ts {
|
||||
InsertSpaceAfterCommaDelimiter: boolean;
|
||||
InsertSpaceAfterSemicolonInForStatements: boolean;
|
||||
InsertSpaceBeforeAndAfterBinaryOperators: boolean;
|
||||
InsertSpaceAfterConstructor?: boolean;
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
@@ -426,6 +427,7 @@ namespace ts {
|
||||
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
InsertSpaceAfterTypeAssertion?: boolean;
|
||||
InsertSpaceBeforeFunctionParenthesis?: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
}
|
||||
@@ -434,6 +436,7 @@ namespace ts {
|
||||
insertSpaceAfterCommaDelimiter?: boolean;
|
||||
insertSpaceAfterSemicolonInForStatements?: boolean;
|
||||
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
|
||||
insertSpaceAfterConstructor?: boolean;
|
||||
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
@@ -442,6 +445,7 @@ namespace ts {
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
insertSpaceAfterTypeAssertion?: boolean;
|
||||
insertSpaceBeforeFunctionParenthesis?: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [tests/cases/compiler/cacheResolutions.ts] ////
|
||||
|
||||
//// [app.ts]
|
||||
|
||||
export let x = 1;
|
||||
|
||||
//// [lib1.ts]
|
||||
export let x = 1;
|
||||
|
||||
//// [lib2.ts]
|
||||
export let x = 1;
|
||||
|
||||
//// [app.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.x = 1;
|
||||
});
|
||||
//// [lib1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.x = 1;
|
||||
});
|
||||
//// [lib2.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.x = 1;
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/c/app.ts ===
|
||||
|
||||
export let x = 1;
|
||||
>x : Symbol(x, Decl(app.ts, 1, 10))
|
||||
|
||||
=== /a/b/c/lib1.ts ===
|
||||
export let x = 1;
|
||||
>x : Symbol(x, Decl(lib1.ts, 0, 10))
|
||||
|
||||
=== /a/b/c/lib2.ts ===
|
||||
export let x = 1;
|
||||
>x : Symbol(x, Decl(lib2.ts, 0, 10))
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
[
|
||||
"======== Resolving module 'tslib' from '/a/b/c/app.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'Classic'.",
|
||||
"File '/a/b/c/tslib.ts' does not exist.",
|
||||
"File '/a/b/c/tslib.tsx' does not exist.",
|
||||
"File '/a/b/c/tslib.d.ts' does not exist.",
|
||||
"File '/a/b/tslib.ts' does not exist.",
|
||||
"File '/a/b/tslib.tsx' does not exist.",
|
||||
"File '/a/b/tslib.d.ts' does not exist.",
|
||||
"File '/a/tslib.ts' does not exist.",
|
||||
"File '/a/tslib.tsx' does not exist.",
|
||||
"File '/a/tslib.d.ts' does not exist.",
|
||||
"File '/tslib.ts' does not exist.",
|
||||
"File '/tslib.tsx' does not exist.",
|
||||
"File '/tslib.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/tslib.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/tslib/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/tslib/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/tslib.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/tslib/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/@types/tslib/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/tslib.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/tslib/package.json' does not exist.",
|
||||
"File '/a/node_modules/@types/tslib/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/tslib.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/tslib/package.json' does not exist.",
|
||||
"File '/node_modules/@types/tslib/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/tslib.js' does not exist.",
|
||||
"File '/a/b/c/tslib.jsx' does not exist.",
|
||||
"File '/a/b/tslib.js' does not exist.",
|
||||
"File '/a/b/tslib.jsx' does not exist.",
|
||||
"File '/a/tslib.js' does not exist.",
|
||||
"File '/a/tslib.jsx' does not exist.",
|
||||
"File '/tslib.js' does not exist.",
|
||||
"File '/tslib.jsx' does not exist.",
|
||||
"======== Module name 'tslib' was not resolved. ========",
|
||||
"======== Resolving module 'tslib' from '/a/b/c/lib1.ts'. ========",
|
||||
"Resolution for module 'tslib' was found in cache",
|
||||
"======== Module name 'tslib' was not resolved. ========",
|
||||
"======== Resolving module 'tslib' from '/a/b/c/lib2.ts'. ========",
|
||||
"Resolution for module 'tslib' was found in cache",
|
||||
"======== Module name 'tslib' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
=== /a/b/c/app.ts ===
|
||||
|
||||
export let x = 1;
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
=== /a/b/c/lib1.ts ===
|
||||
export let x = 1;
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
=== /a/b/c/lib2.ts ===
|
||||
export let x = 1;
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution1.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export declare let x: number
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/node_modules/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 18))
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(app.ts, 0, 8))
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(lib.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/node_modules/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution2.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export declare let x: number
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/node_modules/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 18))
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(lib.ts, 0, 8))
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(app.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/node_modules/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution3.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export declare let x: number
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 18))
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(app.ts, 0, 8))
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(lib.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"File '/a/b/c/d/e/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/foo.ts' does not exist.",
|
||||
"File '/a/b/c/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/foo.d.ts' does not exist.",
|
||||
"File '/a/b/foo.ts' does not exist.",
|
||||
"File '/a/b/foo.tsx' does not exist.",
|
||||
"File '/a/b/foo.d.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution4.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export declare let x: number
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 18))
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(lib.ts, 0, 8))
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(app.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"File '/a/b/c/foo.ts' does not exist.",
|
||||
"File '/a/b/c/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/foo.d.ts' does not exist.",
|
||||
"File '/a/b/foo.ts' does not exist.",
|
||||
"File '/a/b/foo.tsx' does not exist.",
|
||||
"File '/a/b/foo.d.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"File '/a/b/c/d/e/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/foo.d.ts' does not exist.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution5.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export declare let x: number
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/node_modules/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 18))
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(app.ts, 0, 8))
|
||||
|
||||
=== /a/b/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : Symbol(x, Decl(lib.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'",
|
||||
"======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
=== /a/b/node_modules/foo.d.ts ===
|
||||
|
||||
export declare let x: number
|
||||
>x : number
|
||||
|
||||
=== /a/b/c/d/e/app.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
=== /a/b/lib.ts ===
|
||||
import {x} from "foo";
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/a/b/c/d/e/app.ts(2,17): error TS2307: Cannot find module 'foo'.
|
||||
/a/b/c/lib.ts(1,17): error TS2307: Cannot find module 'foo'.
|
||||
|
||||
|
||||
==== /a/b/c/d/e/app.ts (1 errors) ====
|
||||
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
|
||||
==== /a/b/c/lib.ts (1 errors) ====
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution6.ts] ////
|
||||
|
||||
//// [app.ts]
|
||||
|
||||
import {x} from "foo";
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,102 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/foo.ts' does not exist.",
|
||||
"File '/node_modules/foo.tsx' does not exist.",
|
||||
"File '/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/foo/package.json' does not exist.",
|
||||
"File '/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.js' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.js' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.js' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.js' does not exist.",
|
||||
"File '/a/b/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/a/node_modules/foo.js' does not exist.",
|
||||
"File '/a/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/node_modules/foo.js' does not exist.",
|
||||
"File '/node_modules/foo.jsx' does not exist.",
|
||||
"File '/node_modules/foo/package.json' does not exist.",
|
||||
"File '/node_modules/foo/index.js' does not exist.",
|
||||
"File '/node_modules/foo/index.jsx' does not exist.",
|
||||
"======== Module name 'foo' was not resolved. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"======== Module name 'foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,15 @@
|
||||
/a/b/c/d/e/app.ts(1,17): error TS2307: Cannot find module 'foo'.
|
||||
/a/b/c/lib.ts(2,17): error TS2307: Cannot find module 'foo'.
|
||||
|
||||
|
||||
==== /a/b/c/lib.ts (1 errors) ====
|
||||
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
|
||||
==== /a/b/c/d/e/app.ts (1 errors) ====
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution7.ts] ////
|
||||
|
||||
//// [lib.ts]
|
||||
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,92 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/foo.ts' does not exist.",
|
||||
"File '/node_modules/foo.tsx' does not exist.",
|
||||
"File '/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/foo/package.json' does not exist.",
|
||||
"File '/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/node_modules/foo.js' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/b/c/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo.js' does not exist.",
|
||||
"File '/a/b/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/b/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/b/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/a/node_modules/foo.js' does not exist.",
|
||||
"File '/a/node_modules/foo.jsx' does not exist.",
|
||||
"File '/a/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/foo/index.js' does not exist.",
|
||||
"File '/a/node_modules/foo/index.jsx' does not exist.",
|
||||
"File '/node_modules/foo.js' does not exist.",
|
||||
"File '/node_modules/foo.jsx' does not exist.",
|
||||
"File '/node_modules/foo/package.json' does not exist.",
|
||||
"File '/node_modules/foo/index.js' does not exist.",
|
||||
"File '/node_modules/foo/index.jsx' does not exist.",
|
||||
"======== Module name 'foo' was not resolved. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"======== Module name 'foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
/a/b/c/d/e/app.ts(2,17): error TS2307: Cannot find module 'foo'.
|
||||
/a/b/c/lib.ts(1,17): error TS2307: Cannot find module 'foo'.
|
||||
|
||||
|
||||
==== /a/b/c/d/e/app.ts (1 errors) ====
|
||||
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
|
||||
==== /a/b/c/lib.ts (1 errors) ====
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution8.ts] ////
|
||||
|
||||
//// [app.ts]
|
||||
|
||||
import {x} from "foo";
|
||||
|
||||
//// [lib.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,57 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"File '/a/b/c/d/e/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/foo.ts' does not exist.",
|
||||
"File '/a/b/c/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/foo.d.ts' does not exist.",
|
||||
"File '/a/b/foo.ts' does not exist.",
|
||||
"File '/a/b/foo.tsx' does not exist.",
|
||||
"File '/a/b/foo.d.ts' does not exist.",
|
||||
"File '/a/foo.ts' does not exist.",
|
||||
"File '/a/foo.tsx' does not exist.",
|
||||
"File '/a/foo.d.ts' does not exist.",
|
||||
"File '/foo.ts' does not exist.",
|
||||
"File '/foo.tsx' does not exist.",
|
||||
"File '/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.js' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.jsx' does not exist.",
|
||||
"File '/a/b/c/d/foo.js' does not exist.",
|
||||
"File '/a/b/c/d/foo.jsx' does not exist.",
|
||||
"File '/a/b/c/foo.js' does not exist.",
|
||||
"File '/a/b/c/foo.jsx' does not exist.",
|
||||
"File '/a/b/foo.js' does not exist.",
|
||||
"File '/a/b/foo.jsx' does not exist.",
|
||||
"File '/a/foo.js' does not exist.",
|
||||
"File '/a/foo.jsx' does not exist.",
|
||||
"File '/foo.js' does not exist.",
|
||||
"File '/foo.jsx' does not exist.",
|
||||
"======== Module name 'foo' was not resolved. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"======== Module name 'foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
/a/b/c/d/e/app.ts(1,17): error TS2307: Cannot find module 'foo'.
|
||||
/a/b/c/lib.ts(2,17): error TS2307: Cannot find module 'foo'.
|
||||
|
||||
|
||||
==== /a/b/c/lib.ts (1 errors) ====
|
||||
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
|
||||
|
||||
==== /a/b/c/d/e/app.ts (1 errors) ====
|
||||
import {x} from "foo";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'foo'.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [tests/cases/compiler/cachedModuleResolution9.ts] ////
|
||||
|
||||
//// [lib.ts]
|
||||
|
||||
import {x} from "foo";
|
||||
|
||||
|
||||
//// [app.ts]
|
||||
import {x} from "foo";
|
||||
|
||||
|
||||
//// [lib.js]
|
||||
"use strict";
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,47 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"File '/a/b/c/foo.ts' does not exist.",
|
||||
"File '/a/b/c/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/foo.d.ts' does not exist.",
|
||||
"File '/a/b/foo.ts' does not exist.",
|
||||
"File '/a/b/foo.tsx' does not exist.",
|
||||
"File '/a/b/foo.d.ts' does not exist.",
|
||||
"File '/a/foo.ts' does not exist.",
|
||||
"File '/a/foo.tsx' does not exist.",
|
||||
"File '/a/foo.d.ts' does not exist.",
|
||||
"File '/foo.ts' does not exist.",
|
||||
"File '/foo.tsx' does not exist.",
|
||||
"File '/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/a/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"File '/a/b/c/foo.js' does not exist.",
|
||||
"File '/a/b/c/foo.jsx' does not exist.",
|
||||
"File '/a/b/foo.js' does not exist.",
|
||||
"File '/a/b/foo.jsx' does not exist.",
|
||||
"File '/a/foo.js' does not exist.",
|
||||
"File '/a/foo.jsx' does not exist.",
|
||||
"File '/foo.js' does not exist.",
|
||||
"File '/foo.jsx' does not exist.",
|
||||
"======== Module name 'foo' was not resolved. ========",
|
||||
"======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Classic'.",
|
||||
"File '/a/b/c/d/e/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/e/foo.d.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.ts' does not exist.",
|
||||
"File '/a/b/c/d/foo.tsx' does not exist.",
|
||||
"File '/a/b/c/d/foo.d.ts' does not exist.",
|
||||
"Resolution for module 'foo' was found in cache",
|
||||
"======== Module name 'foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [tests/cases/compiler/jsxViaImport.2.tsx] ////
|
||||
|
||||
//// [component.d.ts]
|
||||
|
||||
declare module JSX {
|
||||
interface ElementAttributesProperty { props; }
|
||||
}
|
||||
declare module React {
|
||||
class Component<T, U> { }
|
||||
}
|
||||
declare module "BaseComponent" {
|
||||
export default class extends React.Component<any, {}> {
|
||||
}
|
||||
}
|
||||
|
||||
//// [consumer.tsx]
|
||||
/// <reference path="component.d.ts" />
|
||||
import BaseComponent from 'BaseComponent';
|
||||
class TestComponent extends React.Component<any, {}> {
|
||||
render() {
|
||||
return <BaseComponent />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [consumer.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
/// <reference path="component.d.ts" />
|
||||
var BaseComponent_1 = require("BaseComponent");
|
||||
var TestComponent = (function (_super) {
|
||||
__extends(TestComponent, _super);
|
||||
function TestComponent() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
}
|
||||
TestComponent.prototype.render = function () {
|
||||
return <BaseComponent_1.default />;
|
||||
};
|
||||
return TestComponent;
|
||||
}(React.Component));
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/compiler/consumer.tsx ===
|
||||
/// <reference path="component.d.ts" />
|
||||
import BaseComponent from 'BaseComponent';
|
||||
>BaseComponent : Symbol(BaseComponent, Decl(consumer.tsx, 1, 6))
|
||||
|
||||
class TestComponent extends React.Component<any, {}> {
|
||||
>TestComponent : Symbol(TestComponent, Decl(consumer.tsx, 1, 42))
|
||||
>React.Component : Symbol(React.Component, Decl(component.d.ts, 4, 22))
|
||||
>React : Symbol(React, Decl(component.d.ts, 3, 1))
|
||||
>Component : Symbol(React.Component, Decl(component.d.ts, 4, 22))
|
||||
|
||||
render() {
|
||||
>render : Symbol(TestComponent.render, Decl(consumer.tsx, 2, 54))
|
||||
|
||||
return <BaseComponent />;
|
||||
>BaseComponent : Symbol(BaseComponent, Decl(consumer.tsx, 1, 6))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/component.d.ts ===
|
||||
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(component.d.ts, 0, 0))
|
||||
|
||||
interface ElementAttributesProperty { props; }
|
||||
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(component.d.ts, 1, 20))
|
||||
>props : Symbol(ElementAttributesProperty.props, Decl(component.d.ts, 2, 39))
|
||||
}
|
||||
declare module React {
|
||||
>React : Symbol(React, Decl(component.d.ts, 3, 1))
|
||||
|
||||
class Component<T, U> { }
|
||||
>Component : Symbol(Component, Decl(component.d.ts, 4, 22))
|
||||
>T : Symbol(T, Decl(component.d.ts, 5, 18))
|
||||
>U : Symbol(U, Decl(component.d.ts, 5, 20))
|
||||
}
|
||||
declare module "BaseComponent" {
|
||||
export default class extends React.Component<any, {}> {
|
||||
>React.Component : Symbol(React.Component, Decl(component.d.ts, 4, 22))
|
||||
>React : Symbol(React, Decl(component.d.ts, 3, 1))
|
||||
>Component : Symbol(React.Component, Decl(component.d.ts, 4, 22))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/consumer.tsx ===
|
||||
/// <reference path="component.d.ts" />
|
||||
import BaseComponent from 'BaseComponent';
|
||||
>BaseComponent : typeof BaseComponent
|
||||
|
||||
class TestComponent extends React.Component<any, {}> {
|
||||
>TestComponent : TestComponent
|
||||
>React.Component : React.Component<any, {}>
|
||||
>React : typeof React
|
||||
>Component : typeof React.Component
|
||||
|
||||
render() {
|
||||
>render : () => any
|
||||
|
||||
return <BaseComponent />;
|
||||
><BaseComponent /> : any
|
||||
>BaseComponent : typeof BaseComponent
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/component.d.ts ===
|
||||
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface ElementAttributesProperty { props; }
|
||||
>ElementAttributesProperty : ElementAttributesProperty
|
||||
>props : any
|
||||
}
|
||||
declare module React {
|
||||
>React : typeof React
|
||||
|
||||
class Component<T, U> { }
|
||||
>Component : Component<T, U>
|
||||
>T : T
|
||||
>U : U
|
||||
}
|
||||
declare module "BaseComponent" {
|
||||
export default class extends React.Component<any, {}> {
|
||||
>React.Component : React.Component<any, {}>
|
||||
>React : typeof React
|
||||
>Component : typeof React.Component
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: Th
|
||||
tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ====
|
||||
@@ -36,14 +36,14 @@ tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: O
|
||||
var n = 1e4;
|
||||
var n = 001; // Error in ES5
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
var n = 0x1;
|
||||
var n = -1;
|
||||
var n = -1.0;
|
||||
var n = -1e-4;
|
||||
var n = -003; // Error in ES5
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'.
|
||||
var n = -0x1;
|
||||
|
||||
var s: string;
|
||||
|
||||
@@ -45,9 +45,11 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,5): error TS2322: T
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(131,5): error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,16): error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,21): error TS2536: Type 'P' cannot be used to index type 'T'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (24 errors) ====
|
||||
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (26 errors) ====
|
||||
|
||||
interface Shape {
|
||||
name: string;
|
||||
@@ -249,4 +251,22 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(131,5): error TS2322: T
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
|
||||
// Repro from #13044
|
||||
|
||||
type Foo2<T, F extends keyof T> = {
|
||||
pf: {[P in F]?: T[P]},
|
||||
pt: {[P in T]?: T[P]}, // note: should be in keyof T
|
||||
~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2536: Type 'P' cannot be used to index type 'T'.
|
||||
};
|
||||
type O = {x: number, y: boolean};
|
||||
let o: O = {x: 5, y: false};
|
||||
let f: Foo2<O, 'x'> = {
|
||||
pf: {x: 7},
|
||||
pt: {x: 7, y: false},
|
||||
};
|
||||
|
||||
@@ -129,7 +129,21 @@ type T2 = { a?: number, [key: string]: any };
|
||||
|
||||
let x1: T2 = { a: 'no' }; // Error
|
||||
let x2: Partial<T2> = { a: 'no' }; // Error
|
||||
let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error
|
||||
let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error
|
||||
|
||||
// Repro from #13044
|
||||
|
||||
type Foo2<T, F extends keyof T> = {
|
||||
pf: {[P in F]?: T[P]},
|
||||
pt: {[P in T]?: T[P]}, // note: should be in keyof T
|
||||
};
|
||||
type O = {x: number, y: boolean};
|
||||
let o: O = {x: 5, y: false};
|
||||
let f: Foo2<O, 'x'> = {
|
||||
pf: {x: 7},
|
||||
pt: {x: 7, y: false},
|
||||
};
|
||||
|
||||
|
||||
//// [mappedTypeErrors.js]
|
||||
function f1(x) {
|
||||
@@ -204,6 +218,11 @@ c.setState({ c: true }); // Error
|
||||
var x1 = { a: 'no' }; // Error
|
||||
var x2 = { a: 'no' }; // Error
|
||||
var x3 = { a: 'no' }; // Error
|
||||
var o = { x: 5, y: false };
|
||||
var f = {
|
||||
pf: { x: 7 },
|
||||
pt: { x: 7, y: false }
|
||||
};
|
||||
|
||||
|
||||
//// [mappedTypeErrors.d.ts]
|
||||
@@ -268,3 +287,17 @@ declare let x2: Partial<T2>;
|
||||
declare let x3: {
|
||||
[P in keyof T2]: T2[P];
|
||||
};
|
||||
declare type Foo2<T, F extends keyof T> = {
|
||||
pf: {
|
||||
[P in F]?: T[P];
|
||||
};
|
||||
pt: {
|
||||
[P in T]?: T[P];
|
||||
};
|
||||
};
|
||||
declare type O = {
|
||||
x: number;
|
||||
y: boolean;
|
||||
};
|
||||
declare let o: O;
|
||||
declare let f: Foo2<O, 'x'>;
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//// [mappedTypesAndObjects.ts]
|
||||
|
||||
function f1<T>(x: Partial<T>, y: Readonly<T>) {
|
||||
let obj: {};
|
||||
obj = x;
|
||||
obj = y;
|
||||
}
|
||||
|
||||
function f2<T>(x: Partial<T>, y: Readonly<T>) {
|
||||
let obj: { [x: string]: any };
|
||||
obj = x;
|
||||
obj = y;
|
||||
}
|
||||
|
||||
// Repro from #12900
|
||||
|
||||
interface Base {
|
||||
foo: { [key: string]: any };
|
||||
bar: any;
|
||||
baz: any;
|
||||
}
|
||||
|
||||
interface E1<T> extends Base {
|
||||
foo: T;
|
||||
}
|
||||
|
||||
interface Something { name: string, value: string };
|
||||
interface E2 extends Base {
|
||||
foo: Partial<Something>; // or other mapped type
|
||||
}
|
||||
|
||||
interface E3<T> extends Base {
|
||||
foo: Partial<T>; // or other mapped type
|
||||
}
|
||||
|
||||
//// [mappedTypesAndObjects.js]
|
||||
function f1(x, y) {
|
||||
var obj;
|
||||
obj = x;
|
||||
obj = y;
|
||||
}
|
||||
function f2(x, y) {
|
||||
var obj;
|
||||
obj = x;
|
||||
obj = y;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
//// [mappedTypesAndObjects.d.ts]
|
||||
declare function f1<T>(x: Partial<T>, y: Readonly<T>): void;
|
||||
declare function f2<T>(x: Partial<T>, y: Readonly<T>): void;
|
||||
interface Base {
|
||||
foo: {
|
||||
[key: string]: any;
|
||||
};
|
||||
bar: any;
|
||||
baz: any;
|
||||
}
|
||||
interface E1<T> extends Base {
|
||||
foo: T;
|
||||
}
|
||||
interface Something {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
interface E2 extends Base {
|
||||
foo: Partial<Something>;
|
||||
}
|
||||
interface E3<T> extends Base {
|
||||
foo: Partial<T>;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
=== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts ===
|
||||
|
||||
function f1<T>(x: Partial<T>, y: Readonly<T>) {
|
||||
>f1 : Symbol(f1, Decl(mappedTypesAndObjects.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12))
|
||||
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 1, 15))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12))
|
||||
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 1, 29))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12))
|
||||
|
||||
let obj: {};
|
||||
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7))
|
||||
|
||||
obj = x;
|
||||
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7))
|
||||
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 1, 15))
|
||||
|
||||
obj = y;
|
||||
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 1, 29))
|
||||
}
|
||||
|
||||
function f2<T>(x: Partial<T>, y: Readonly<T>) {
|
||||
>f2 : Symbol(f2, Decl(mappedTypesAndObjects.ts, 5, 1))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12))
|
||||
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 7, 15))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12))
|
||||
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 7, 29))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12))
|
||||
|
||||
let obj: { [x: string]: any };
|
||||
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7))
|
||||
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 8, 16))
|
||||
|
||||
obj = x;
|
||||
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7))
|
||||
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 7, 15))
|
||||
|
||||
obj = y;
|
||||
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7))
|
||||
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 7, 29))
|
||||
}
|
||||
|
||||
// Repro from #12900
|
||||
|
||||
interface Base {
|
||||
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
|
||||
|
||||
foo: { [key: string]: any };
|
||||
>foo : Symbol(Base.foo, Decl(mappedTypesAndObjects.ts, 15, 16))
|
||||
>key : Symbol(key, Decl(mappedTypesAndObjects.ts, 16, 11))
|
||||
|
||||
bar: any;
|
||||
>bar : Symbol(Base.bar, Decl(mappedTypesAndObjects.ts, 16, 31))
|
||||
|
||||
baz: any;
|
||||
>baz : Symbol(Base.baz, Decl(mappedTypesAndObjects.ts, 17, 12))
|
||||
}
|
||||
|
||||
interface E1<T> extends Base {
|
||||
>E1 : Symbol(E1, Decl(mappedTypesAndObjects.ts, 19, 1))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 21, 13))
|
||||
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
|
||||
|
||||
foo: T;
|
||||
>foo : Symbol(E1.foo, Decl(mappedTypesAndObjects.ts, 21, 30))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 21, 13))
|
||||
}
|
||||
|
||||
interface Something { name: string, value: string };
|
||||
>Something : Symbol(Something, Decl(mappedTypesAndObjects.ts, 23, 1))
|
||||
>name : Symbol(Something.name, Decl(mappedTypesAndObjects.ts, 25, 21))
|
||||
>value : Symbol(Something.value, Decl(mappedTypesAndObjects.ts, 25, 35))
|
||||
|
||||
interface E2 extends Base {
|
||||
>E2 : Symbol(E2, Decl(mappedTypesAndObjects.ts, 25, 52))
|
||||
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
|
||||
|
||||
foo: Partial<Something>; // or other mapped type
|
||||
>foo : Symbol(E2.foo, Decl(mappedTypesAndObjects.ts, 26, 27))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>Something : Symbol(Something, Decl(mappedTypesAndObjects.ts, 23, 1))
|
||||
}
|
||||
|
||||
interface E3<T> extends Base {
|
||||
>E3 : Symbol(E3, Decl(mappedTypesAndObjects.ts, 28, 1))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 30, 13))
|
||||
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
|
||||
|
||||
foo: Partial<T>; // or other mapped type
|
||||
>foo : Symbol(E3.foo, Decl(mappedTypesAndObjects.ts, 30, 30))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 30, 13))
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
=== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts ===
|
||||
|
||||
function f1<T>(x: Partial<T>, y: Readonly<T>) {
|
||||
>f1 : <T>(x: Partial<T>, y: Readonly<T>) => void
|
||||
>T : T
|
||||
>x : Partial<T>
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
>y : Readonly<T>
|
||||
>Readonly : Readonly<T>
|
||||
>T : T
|
||||
|
||||
let obj: {};
|
||||
>obj : {}
|
||||
|
||||
obj = x;
|
||||
>obj = x : Partial<T>
|
||||
>obj : {}
|
||||
>x : Partial<T>
|
||||
|
||||
obj = y;
|
||||
>obj = y : Readonly<T>
|
||||
>obj : {}
|
||||
>y : Readonly<T>
|
||||
}
|
||||
|
||||
function f2<T>(x: Partial<T>, y: Readonly<T>) {
|
||||
>f2 : <T>(x: Partial<T>, y: Readonly<T>) => void
|
||||
>T : T
|
||||
>x : Partial<T>
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
>y : Readonly<T>
|
||||
>Readonly : Readonly<T>
|
||||
>T : T
|
||||
|
||||
let obj: { [x: string]: any };
|
||||
>obj : { [x: string]: any; }
|
||||
>x : string
|
||||
|
||||
obj = x;
|
||||
>obj = x : Partial<T>
|
||||
>obj : { [x: string]: any; }
|
||||
>x : Partial<T>
|
||||
|
||||
obj = y;
|
||||
>obj = y : Readonly<T>
|
||||
>obj : { [x: string]: any; }
|
||||
>y : Readonly<T>
|
||||
}
|
||||
|
||||
// Repro from #12900
|
||||
|
||||
interface Base {
|
||||
>Base : Base
|
||||
|
||||
foo: { [key: string]: any };
|
||||
>foo : { [key: string]: any; }
|
||||
>key : string
|
||||
|
||||
bar: any;
|
||||
>bar : any
|
||||
|
||||
baz: any;
|
||||
>baz : any
|
||||
}
|
||||
|
||||
interface E1<T> extends Base {
|
||||
>E1 : E1<T>
|
||||
>T : T
|
||||
>Base : Base
|
||||
|
||||
foo: T;
|
||||
>foo : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
interface Something { name: string, value: string };
|
||||
>Something : Something
|
||||
>name : string
|
||||
>value : string
|
||||
|
||||
interface E2 extends Base {
|
||||
>E2 : E2
|
||||
>Base : Base
|
||||
|
||||
foo: Partial<Something>; // or other mapped type
|
||||
>foo : Partial<Something>
|
||||
>Partial : Partial<T>
|
||||
>Something : Something
|
||||
}
|
||||
|
||||
interface E3<T> extends Base {
|
||||
>E3 : E3<T>
|
||||
>T : T
|
||||
>Base : Base
|
||||
|
||||
foo: Partial<T>; // or other mapped type
|
||||
>foo : Partial<T>
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
//// [metadataOfUnionWithNull.ts]
|
||||
function PropDeco(target: Object, propKey: string | symbol) { }
|
||||
|
||||
class A {
|
||||
}
|
||||
|
||||
class B {
|
||||
@PropDeco
|
||||
x: "foo" | null;
|
||||
|
||||
@PropDeco
|
||||
y: true | never;
|
||||
|
||||
@PropDeco
|
||||
z: "foo" | undefined;
|
||||
|
||||
@PropDeco
|
||||
a: null;
|
||||
|
||||
@PropDeco
|
||||
b: never;
|
||||
|
||||
@PropDeco
|
||||
c: undefined;
|
||||
|
||||
@PropDeco
|
||||
d: undefined | null;
|
||||
|
||||
@PropDeco
|
||||
e: symbol | null;
|
||||
|
||||
@PropDeco
|
||||
f: symbol | A;
|
||||
|
||||
@PropDeco
|
||||
g: A | null;
|
||||
|
||||
@PropDeco
|
||||
h: null | B;
|
||||
|
||||
@PropDeco
|
||||
j: null | symbol;
|
||||
}
|
||||
|
||||
//// [metadataOfUnionWithNull.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
function PropDeco(target, propKey) { }
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
}());
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", String)
|
||||
], B.prototype, "x");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", Boolean)
|
||||
], B.prototype, "y");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", String)
|
||||
], B.prototype, "z");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", void 0)
|
||||
], B.prototype, "a");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", void 0)
|
||||
], B.prototype, "b");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", void 0)
|
||||
], B.prototype, "c");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", void 0)
|
||||
], B.prototype, "d");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", typeof Symbol === "function" ? Symbol : Object)
|
||||
], B.prototype, "e");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", Object)
|
||||
], B.prototype, "f");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", A)
|
||||
], B.prototype, "g");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", B)
|
||||
], B.prototype, "h");
|
||||
__decorate([
|
||||
PropDeco,
|
||||
__metadata("design:type", typeof Symbol === "function" ? Symbol : Object)
|
||||
], B.prototype, "j");
|
||||
@@ -0,0 +1,89 @@
|
||||
=== tests/cases/compiler/metadataOfUnionWithNull.ts ===
|
||||
function PropDeco(target: Object, propKey: string | symbol) { }
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
>target : Symbol(target, Decl(metadataOfUnionWithNull.ts, 0, 18))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>propKey : Symbol(propKey, Decl(metadataOfUnionWithNull.ts, 0, 33))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(metadataOfUnionWithNull.ts, 0, 63))
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : Symbol(B, Decl(metadataOfUnionWithNull.ts, 3, 1))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
x: "foo" | null;
|
||||
>x : Symbol(B.x, Decl(metadataOfUnionWithNull.ts, 5, 9))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
y: true | never;
|
||||
>y : Symbol(B.y, Decl(metadataOfUnionWithNull.ts, 7, 20))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
z: "foo" | undefined;
|
||||
>z : Symbol(B.z, Decl(metadataOfUnionWithNull.ts, 10, 20))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
a: null;
|
||||
>a : Symbol(B.a, Decl(metadataOfUnionWithNull.ts, 13, 25))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
b: never;
|
||||
>b : Symbol(B.b, Decl(metadataOfUnionWithNull.ts, 16, 12))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
c: undefined;
|
||||
>c : Symbol(B.c, Decl(metadataOfUnionWithNull.ts, 19, 13))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
d: undefined | null;
|
||||
>d : Symbol(B.d, Decl(metadataOfUnionWithNull.ts, 22, 17))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
e: symbol | null;
|
||||
>e : Symbol(B.e, Decl(metadataOfUnionWithNull.ts, 25, 24))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
f: symbol | A;
|
||||
>f : Symbol(B.f, Decl(metadataOfUnionWithNull.ts, 28, 21))
|
||||
>A : Symbol(A, Decl(metadataOfUnionWithNull.ts, 0, 63))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
g: A | null;
|
||||
>g : Symbol(B.g, Decl(metadataOfUnionWithNull.ts, 31, 18))
|
||||
>A : Symbol(A, Decl(metadataOfUnionWithNull.ts, 0, 63))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
h: null | B;
|
||||
>h : Symbol(B.h, Decl(metadataOfUnionWithNull.ts, 34, 16))
|
||||
>B : Symbol(B, Decl(metadataOfUnionWithNull.ts, 3, 1))
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0))
|
||||
|
||||
j: null | symbol;
|
||||
>j : Symbol(B.j, Decl(metadataOfUnionWithNull.ts, 37, 16))
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
=== tests/cases/compiler/metadataOfUnionWithNull.ts ===
|
||||
function PropDeco(target: Object, propKey: string | symbol) { }
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
>target : Object
|
||||
>Object : Object
|
||||
>propKey : string | symbol
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
x: "foo" | null;
|
||||
>x : "foo"
|
||||
>null : null
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
y: true | never;
|
||||
>y : true
|
||||
>true : true
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
z: "foo" | undefined;
|
||||
>z : "foo"
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
a: null;
|
||||
>a : null
|
||||
>null : null
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
b: never;
|
||||
>b : never
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
c: undefined;
|
||||
>c : undefined
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
d: undefined | null;
|
||||
>d : null
|
||||
>null : null
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
e: symbol | null;
|
||||
>e : symbol
|
||||
>null : null
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
f: symbol | A;
|
||||
>f : symbol | A
|
||||
>A : A
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
g: A | null;
|
||||
>g : A
|
||||
>A : A
|
||||
>null : null
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
h: null | B;
|
||||
>h : B
|
||||
>null : null
|
||||
>B : B
|
||||
|
||||
@PropDeco
|
||||
>PropDeco : (target: Object, propKey: string | symbol) => void
|
||||
|
||||
j: null | symbol;
|
||||
>j : symbol
|
||||
>null : null
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts] ////
|
||||
|
||||
//// [normalize.css]
|
||||
// This tests that a package.json "main" with an unexpected extension is ignored.
|
||||
|
||||
This file is not read.
|
||||
|
||||
//// [package.json]
|
||||
{ "main": "normalize.css" }
|
||||
|
||||
//// [a.ts]
|
||||
import "normalize.css";
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
require("normalize.css");
|
||||
@@ -0,0 +1,4 @@
|
||||
=== /a.ts ===
|
||||
import "normalize.css";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,29 @@
|
||||
[
|
||||
"======== Resolving module 'normalize.css' from '/a.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module 'normalize.css' from 'node_modules' folder.",
|
||||
"File '/node_modules/normalize.css.ts' does not exist.",
|
||||
"File '/node_modules/normalize.css.tsx' does not exist.",
|
||||
"File '/node_modules/normalize.css.d.ts' does not exist.",
|
||||
"Found 'package.json' at '/node_modules/normalize.css/package.json'.",
|
||||
"'package.json' does not have a 'types' or 'main' field.",
|
||||
"File '/node_modules/normalize.css/index.ts' does not exist.",
|
||||
"File '/node_modules/normalize.css/index.tsx' does not exist.",
|
||||
"File '/node_modules/normalize.css/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/normalize.css.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/normalize.css/package.json' does not exist.",
|
||||
"File '/node_modules/@types/normalize.css/index.d.ts' does not exist.",
|
||||
"Loading module 'normalize.css' from 'node_modules' folder.",
|
||||
"File '/node_modules/normalize.css.js' does not exist.",
|
||||
"File '/node_modules/normalize.css.jsx' does not exist.",
|
||||
"Found 'package.json' at '/node_modules/normalize.css/package.json'.",
|
||||
"No types specified in 'package.json', so returning 'main' value of 'normalize.css'",
|
||||
"File '/node_modules/normalize.css/normalize.css' exist - use it as a name resolution result.",
|
||||
"File '/node_modules/normalize.css/normalize.css' has an unsupported extension, so skipping it.",
|
||||
"File '/node_modules/normalize.css/normalize.css.ts' does not exist.",
|
||||
"File '/node_modules/normalize.css/normalize.css.tsx' does not exist.",
|
||||
"File '/node_modules/normalize.css/normalize.css.d.ts' does not exist.",
|
||||
"File '/node_modules/normalize.css/index.js' does not exist.",
|
||||
"File '/node_modules/normalize.css/index.jsx' does not exist.",
|
||||
"======== Module name 'normalize.css' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
=== /a.ts ===
|
||||
import "normalize.css";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithExtensions_unexpected2.ts] ////
|
||||
|
||||
//// [foo.js]
|
||||
// This tests that a package.json "types" with an unexpected extension is ignored.
|
||||
|
||||
This file is not read.
|
||||
|
||||
//// [package.json]
|
||||
{ "types": "foo.js" }
|
||||
|
||||
//// [a.ts]
|
||||
import "foo";
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
require("foo");
|
||||
@@ -0,0 +1,4 @@
|
||||
=== /a.ts ===
|
||||
import "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,29 @@
|
||||
[
|
||||
"======== Resolving module 'foo' from '/a.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/node_modules/foo.ts' does not exist.",
|
||||
"File '/node_modules/foo.tsx' does not exist.",
|
||||
"File '/node_modules/foo.d.ts' does not exist.",
|
||||
"Found 'package.json' at '/node_modules/foo/package.json'.",
|
||||
"'package.json' has 'types' field 'foo.js' that references '/node_modules/foo/foo.js'.",
|
||||
"File '/node_modules/foo/foo.js' exist - use it as a name resolution result.",
|
||||
"File '/node_modules/foo/foo.js' has an unsupported extension, so skipping it.",
|
||||
"File '/node_modules/foo/foo.js.ts' does not exist.",
|
||||
"File '/node_modules/foo/foo.js.tsx' does not exist.",
|
||||
"File '/node_modules/foo/foo.js.d.ts' does not exist.",
|
||||
"File '/node_modules/foo/index.ts' does not exist.",
|
||||
"File '/node_modules/foo/index.tsx' does not exist.",
|
||||
"File '/node_modules/foo/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/foo/package.json' does not exist.",
|
||||
"File '/node_modules/@types/foo/index.d.ts' does not exist.",
|
||||
"Loading module 'foo' from 'node_modules' folder.",
|
||||
"File '/node_modules/foo.js' does not exist.",
|
||||
"File '/node_modules/foo.jsx' does not exist.",
|
||||
"Found 'package.json' at '/node_modules/foo/package.json'.",
|
||||
"'package.json' does not have a 'types' or 'main' field.",
|
||||
"File '/node_modules/foo/index.js' does not exist.",
|
||||
"File '/node_modules/foo/index.jsx' does not exist.",
|
||||
"======== Module name 'foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
=== /a.ts ===
|
||||
import "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,47 @@
|
||||
//// [nestedLoops.ts]
|
||||
export class Test {
|
||||
constructor() {
|
||||
|
||||
let outerArray: Array<number> = [1, 2, 3];
|
||||
let innerArray: Array<number> = [1, 2, 3];
|
||||
|
||||
for (let outer of outerArray)
|
||||
for (let inner of innerArray) {
|
||||
this.aFunction((newValue, oldValue) => {
|
||||
let x = outer + inner + newValue;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public aFunction(func: (newValue: any, oldValue: any) => void): void {
|
||||
}
|
||||
}
|
||||
|
||||
//// [nestedLoops.js]
|
||||
"use strict";
|
||||
var Test = (function () {
|
||||
function Test() {
|
||||
var outerArray = [1, 2, 3];
|
||||
var innerArray = [1, 2, 3];
|
||||
var _loop_1 = function (outer) {
|
||||
var _loop_2 = function (inner) {
|
||||
this_1.aFunction(function (newValue, oldValue) {
|
||||
var x = outer + inner + newValue;
|
||||
});
|
||||
};
|
||||
for (var _i = 0, innerArray_1 = innerArray; _i < innerArray_1.length; _i++) {
|
||||
var inner = innerArray_1[_i];
|
||||
_loop_2(inner);
|
||||
}
|
||||
};
|
||||
var this_1 = this;
|
||||
for (var _i = 0, outerArray_1 = outerArray; _i < outerArray_1.length; _i++) {
|
||||
var outer = outerArray_1[_i];
|
||||
_loop_1(outer);
|
||||
}
|
||||
}
|
||||
Test.prototype.aFunction = function (func) {
|
||||
};
|
||||
return Test;
|
||||
}());
|
||||
exports.Test = Test;
|
||||
@@ -0,0 +1,46 @@
|
||||
=== tests/cases/compiler/nestedLoops.ts ===
|
||||
export class Test {
|
||||
>Test : Symbol(Test, Decl(nestedLoops.ts, 0, 0))
|
||||
|
||||
constructor() {
|
||||
|
||||
let outerArray: Array<number> = [1, 2, 3];
|
||||
>outerArray : Symbol(outerArray, Decl(nestedLoops.ts, 3, 11))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
let innerArray: Array<number> = [1, 2, 3];
|
||||
>innerArray : Symbol(innerArray, Decl(nestedLoops.ts, 4, 11))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
for (let outer of outerArray)
|
||||
>outer : Symbol(outer, Decl(nestedLoops.ts, 6, 16))
|
||||
>outerArray : Symbol(outerArray, Decl(nestedLoops.ts, 3, 11))
|
||||
|
||||
for (let inner of innerArray) {
|
||||
>inner : Symbol(inner, Decl(nestedLoops.ts, 7, 20))
|
||||
>innerArray : Symbol(innerArray, Decl(nestedLoops.ts, 4, 11))
|
||||
|
||||
this.aFunction((newValue, oldValue) => {
|
||||
>this.aFunction : Symbol(Test.aFunction, Decl(nestedLoops.ts, 12, 5))
|
||||
>this : Symbol(Test, Decl(nestedLoops.ts, 0, 0))
|
||||
>aFunction : Symbol(Test.aFunction, Decl(nestedLoops.ts, 12, 5))
|
||||
>newValue : Symbol(newValue, Decl(nestedLoops.ts, 8, 32))
|
||||
>oldValue : Symbol(oldValue, Decl(nestedLoops.ts, 8, 41))
|
||||
|
||||
let x = outer + inner + newValue;
|
||||
>x : Symbol(x, Decl(nestedLoops.ts, 9, 23))
|
||||
>outer : Symbol(outer, Decl(nestedLoops.ts, 6, 16))
|
||||
>inner : Symbol(inner, Decl(nestedLoops.ts, 7, 20))
|
||||
>newValue : Symbol(newValue, Decl(nestedLoops.ts, 8, 32))
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public aFunction(func: (newValue: any, oldValue: any) => void): void {
|
||||
>aFunction : Symbol(Test.aFunction, Decl(nestedLoops.ts, 12, 5))
|
||||
>func : Symbol(func, Decl(nestedLoops.ts, 14, 21))
|
||||
>newValue : Symbol(newValue, Decl(nestedLoops.ts, 14, 28))
|
||||
>oldValue : Symbol(oldValue, Decl(nestedLoops.ts, 14, 42))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
=== tests/cases/compiler/nestedLoops.ts ===
|
||||
export class Test {
|
||||
>Test : Test
|
||||
|
||||
constructor() {
|
||||
|
||||
let outerArray: Array<number> = [1, 2, 3];
|
||||
>outerArray : number[]
|
||||
>Array : T[]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
|
||||
let innerArray: Array<number> = [1, 2, 3];
|
||||
>innerArray : number[]
|
||||
>Array : T[]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
|
||||
for (let outer of outerArray)
|
||||
>outer : number
|
||||
>outerArray : number[]
|
||||
|
||||
for (let inner of innerArray) {
|
||||
>inner : number
|
||||
>innerArray : number[]
|
||||
|
||||
this.aFunction((newValue, oldValue) => {
|
||||
>this.aFunction((newValue, oldValue) => { let x = outer + inner + newValue; }) : void
|
||||
>this.aFunction : (func: (newValue: any, oldValue: any) => void) => void
|
||||
>this : this
|
||||
>aFunction : (func: (newValue: any, oldValue: any) => void) => void
|
||||
>(newValue, oldValue) => { let x = outer + inner + newValue; } : (newValue: any, oldValue: any) => void
|
||||
>newValue : any
|
||||
>oldValue : any
|
||||
|
||||
let x = outer + inner + newValue;
|
||||
>x : any
|
||||
>outer + inner + newValue : any
|
||||
>outer + inner : number
|
||||
>outer : number
|
||||
>inner : number
|
||||
>newValue : any
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public aFunction(func: (newValue: any, oldValue: any) => void): void {
|
||||
>aFunction : (func: (newValue: any, oldValue: any) => void) => void
|
||||
>func : (newValue: any, oldValue: any) => void
|
||||
>newValue : any
|
||||
>oldValue : any
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21)
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '3.2e1'.
|
||||
@@ -125,7 +125,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55)
|
||||
!!! error TS2300: Duplicate identifier '0x0'.
|
||||
var e14 = { 0: 0, 000: 0 };
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier '000'.
|
||||
var e15 = { "100": 0, 1e2: 0 };
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'.
|
||||
tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/oldStyleOctalLiteralTypes.ts (2 errors) ====
|
||||
let x: 010;
|
||||
~~~
|
||||
!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'.
|
||||
let y: -020;
|
||||
~~~
|
||||
!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [oldStyleOctalLiteralTypes.ts]
|
||||
let x: 010;
|
||||
let y: -020;
|
||||
|
||||
|
||||
//// [oldStyleOctalLiteralTypes.js]
|
||||
var x;
|
||||
var y;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user