mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into fix4867_transpiling
This commit is contained in:
+3
-1
@@ -169,7 +169,9 @@ var librarySourceMap = [
|
||||
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["header.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
|
||||
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
|
||||
{ target: "lib.core.es7.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts", "es7.d.ts"]},
|
||||
{ target: "lib.es7.d.ts", sources: ["header.d.ts", "es6.d.ts", "es7.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
|
||||
];
|
||||
|
||||
var libraryTargets = librarySourceMap.map(function (f) {
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -3885,7 +3885,7 @@ function g(x: number) {
|
||||
|
||||
the inferred return type for 'f' and 'g' is Any because the functions reference themselves through a cycle with no return type annotations. Adding an explicit return type 'number' to either breaks the cycle and causes the return type 'number' to be inferred for the other.
|
||||
|
||||
An explicitly typed function whose return type isn't the Void or the Any type must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
An explicitly typed function whose return type isn't the Void type, the Any type, or a union type containing the Void or Any type as a constituent must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
|
||||
The type of 'this' in a function implementation is the Any type.
|
||||
|
||||
|
||||
Vendored
-1
@@ -14,7 +14,6 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
|
||||
Vendored
+8
-9
@@ -14,7 +14,6 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
@@ -5121,15 +5120,15 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+32
-14
@@ -14,7 +14,6 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
@@ -5296,7 +5295,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -5555,9 +5554,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -6610,6 +6609,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -7022,6 +7023,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -7811,6 +7813,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -10965,7 +10968,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -11681,7 +11684,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -14410,17 +14413,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -16018,7 +16020,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -16620,6 +16622,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -16674,6 +16684,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -16870,7 +16888,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+32
-13
@@ -1472,7 +1472,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -1731,9 +1731,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -2786,6 +2786,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -3198,6 +3200,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -3987,6 +3990,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -7141,7 +7145,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -7857,7 +7861,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -10586,17 +10590,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -12194,7 +12197,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -12796,6 +12799,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -12850,6 +12861,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -13046,7 +13065,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+41
-23
@@ -13,6 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Symbol {
|
||||
@@ -1296,15 +1297,15 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
@@ -1346,8 +1347,6 @@ interface PromiseConstructor {
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
@@ -6629,7 +6628,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -6888,9 +6887,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -7943,6 +7942,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -8355,6 +8356,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -9144,6 +9146,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -12298,7 +12301,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -13014,7 +13017,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -15743,17 +15746,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -17351,7 +17353,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -17953,6 +17955,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -18007,6 +18017,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -18203,7 +18221,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+2
-2
@@ -286,7 +286,7 @@ interface Console {
|
||||
select(element: any): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
|
||||
+3048
-2636
File diff suppressed because it is too large
Load Diff
+4087
-3504
File diff suppressed because it is too large
Load Diff
Vendored
+169
-149
@@ -167,161 +167,162 @@ declare namespace ts {
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
OfKeyword = 134,
|
||||
QualifiedName = 135,
|
||||
ComputedPropertyName = 136,
|
||||
TypeParameter = 137,
|
||||
Parameter = 138,
|
||||
Decorator = 139,
|
||||
PropertySignature = 140,
|
||||
PropertyDeclaration = 141,
|
||||
MethodSignature = 142,
|
||||
MethodDeclaration = 143,
|
||||
Constructor = 144,
|
||||
GetAccessor = 145,
|
||||
SetAccessor = 146,
|
||||
CallSignature = 147,
|
||||
ConstructSignature = 148,
|
||||
IndexSignature = 149,
|
||||
TypePredicate = 150,
|
||||
TypeReference = 151,
|
||||
FunctionType = 152,
|
||||
ConstructorType = 153,
|
||||
TypeQuery = 154,
|
||||
TypeLiteral = 155,
|
||||
ArrayType = 156,
|
||||
TupleType = 157,
|
||||
UnionType = 158,
|
||||
IntersectionType = 159,
|
||||
ParenthesizedType = 160,
|
||||
ThisType = 161,
|
||||
StringLiteralType = 162,
|
||||
ObjectBindingPattern = 163,
|
||||
ArrayBindingPattern = 164,
|
||||
BindingElement = 165,
|
||||
ArrayLiteralExpression = 166,
|
||||
ObjectLiteralExpression = 167,
|
||||
PropertyAccessExpression = 168,
|
||||
ElementAccessExpression = 169,
|
||||
CallExpression = 170,
|
||||
NewExpression = 171,
|
||||
TaggedTemplateExpression = 172,
|
||||
TypeAssertionExpression = 173,
|
||||
ParenthesizedExpression = 174,
|
||||
FunctionExpression = 175,
|
||||
ArrowFunction = 176,
|
||||
DeleteExpression = 177,
|
||||
TypeOfExpression = 178,
|
||||
VoidExpression = 179,
|
||||
AwaitExpression = 180,
|
||||
PrefixUnaryExpression = 181,
|
||||
PostfixUnaryExpression = 182,
|
||||
BinaryExpression = 183,
|
||||
ConditionalExpression = 184,
|
||||
TemplateExpression = 185,
|
||||
YieldExpression = 186,
|
||||
SpreadElementExpression = 187,
|
||||
ClassExpression = 188,
|
||||
OmittedExpression = 189,
|
||||
ExpressionWithTypeArguments = 190,
|
||||
AsExpression = 191,
|
||||
TemplateSpan = 192,
|
||||
SemicolonClassElement = 193,
|
||||
Block = 194,
|
||||
VariableStatement = 195,
|
||||
EmptyStatement = 196,
|
||||
ExpressionStatement = 197,
|
||||
IfStatement = 198,
|
||||
DoStatement = 199,
|
||||
WhileStatement = 200,
|
||||
ForStatement = 201,
|
||||
ForInStatement = 202,
|
||||
ForOfStatement = 203,
|
||||
ContinueStatement = 204,
|
||||
BreakStatement = 205,
|
||||
ReturnStatement = 206,
|
||||
WithStatement = 207,
|
||||
SwitchStatement = 208,
|
||||
LabeledStatement = 209,
|
||||
ThrowStatement = 210,
|
||||
TryStatement = 211,
|
||||
DebuggerStatement = 212,
|
||||
VariableDeclaration = 213,
|
||||
VariableDeclarationList = 214,
|
||||
FunctionDeclaration = 215,
|
||||
ClassDeclaration = 216,
|
||||
InterfaceDeclaration = 217,
|
||||
TypeAliasDeclaration = 218,
|
||||
EnumDeclaration = 219,
|
||||
ModuleDeclaration = 220,
|
||||
ModuleBlock = 221,
|
||||
CaseBlock = 222,
|
||||
ImportEqualsDeclaration = 223,
|
||||
ImportDeclaration = 224,
|
||||
ImportClause = 225,
|
||||
NamespaceImport = 226,
|
||||
NamedImports = 227,
|
||||
ImportSpecifier = 228,
|
||||
ExportAssignment = 229,
|
||||
ExportDeclaration = 230,
|
||||
NamedExports = 231,
|
||||
ExportSpecifier = 232,
|
||||
MissingDeclaration = 233,
|
||||
ExternalModuleReference = 234,
|
||||
JsxElement = 235,
|
||||
JsxSelfClosingElement = 236,
|
||||
JsxOpeningElement = 237,
|
||||
JsxText = 238,
|
||||
JsxClosingElement = 239,
|
||||
JsxAttribute = 240,
|
||||
JsxSpreadAttribute = 241,
|
||||
JsxExpression = 242,
|
||||
CaseClause = 243,
|
||||
DefaultClause = 244,
|
||||
HeritageClause = 245,
|
||||
CatchClause = 246,
|
||||
PropertyAssignment = 247,
|
||||
ShorthandPropertyAssignment = 248,
|
||||
EnumMember = 249,
|
||||
SourceFile = 250,
|
||||
JSDocTypeExpression = 251,
|
||||
JSDocAllType = 252,
|
||||
JSDocUnknownType = 253,
|
||||
JSDocArrayType = 254,
|
||||
JSDocUnionType = 255,
|
||||
JSDocTupleType = 256,
|
||||
JSDocNullableType = 257,
|
||||
JSDocNonNullableType = 258,
|
||||
JSDocRecordType = 259,
|
||||
JSDocRecordMember = 260,
|
||||
JSDocTypeReference = 261,
|
||||
JSDocOptionalType = 262,
|
||||
JSDocFunctionType = 263,
|
||||
JSDocVariadicType = 264,
|
||||
JSDocConstructorType = 265,
|
||||
JSDocThisType = 266,
|
||||
JSDocComment = 267,
|
||||
JSDocTag = 268,
|
||||
JSDocParameterTag = 269,
|
||||
JSDocReturnTag = 270,
|
||||
JSDocTypeTag = 271,
|
||||
JSDocTemplateTag = 272,
|
||||
SyntaxList = 273,
|
||||
Count = 274,
|
||||
GlobalKeyword = 134,
|
||||
OfKeyword = 135,
|
||||
QualifiedName = 136,
|
||||
ComputedPropertyName = 137,
|
||||
TypeParameter = 138,
|
||||
Parameter = 139,
|
||||
Decorator = 140,
|
||||
PropertySignature = 141,
|
||||
PropertyDeclaration = 142,
|
||||
MethodSignature = 143,
|
||||
MethodDeclaration = 144,
|
||||
Constructor = 145,
|
||||
GetAccessor = 146,
|
||||
SetAccessor = 147,
|
||||
CallSignature = 148,
|
||||
ConstructSignature = 149,
|
||||
IndexSignature = 150,
|
||||
TypePredicate = 151,
|
||||
TypeReference = 152,
|
||||
FunctionType = 153,
|
||||
ConstructorType = 154,
|
||||
TypeQuery = 155,
|
||||
TypeLiteral = 156,
|
||||
ArrayType = 157,
|
||||
TupleType = 158,
|
||||
UnionType = 159,
|
||||
IntersectionType = 160,
|
||||
ParenthesizedType = 161,
|
||||
ThisType = 162,
|
||||
StringLiteralType = 163,
|
||||
ObjectBindingPattern = 164,
|
||||
ArrayBindingPattern = 165,
|
||||
BindingElement = 166,
|
||||
ArrayLiteralExpression = 167,
|
||||
ObjectLiteralExpression = 168,
|
||||
PropertyAccessExpression = 169,
|
||||
ElementAccessExpression = 170,
|
||||
CallExpression = 171,
|
||||
NewExpression = 172,
|
||||
TaggedTemplateExpression = 173,
|
||||
TypeAssertionExpression = 174,
|
||||
ParenthesizedExpression = 175,
|
||||
FunctionExpression = 176,
|
||||
ArrowFunction = 177,
|
||||
DeleteExpression = 178,
|
||||
TypeOfExpression = 179,
|
||||
VoidExpression = 180,
|
||||
AwaitExpression = 181,
|
||||
PrefixUnaryExpression = 182,
|
||||
PostfixUnaryExpression = 183,
|
||||
BinaryExpression = 184,
|
||||
ConditionalExpression = 185,
|
||||
TemplateExpression = 186,
|
||||
YieldExpression = 187,
|
||||
SpreadElementExpression = 188,
|
||||
ClassExpression = 189,
|
||||
OmittedExpression = 190,
|
||||
ExpressionWithTypeArguments = 191,
|
||||
AsExpression = 192,
|
||||
TemplateSpan = 193,
|
||||
SemicolonClassElement = 194,
|
||||
Block = 195,
|
||||
VariableStatement = 196,
|
||||
EmptyStatement = 197,
|
||||
ExpressionStatement = 198,
|
||||
IfStatement = 199,
|
||||
DoStatement = 200,
|
||||
WhileStatement = 201,
|
||||
ForStatement = 202,
|
||||
ForInStatement = 203,
|
||||
ForOfStatement = 204,
|
||||
ContinueStatement = 205,
|
||||
BreakStatement = 206,
|
||||
ReturnStatement = 207,
|
||||
WithStatement = 208,
|
||||
SwitchStatement = 209,
|
||||
LabeledStatement = 210,
|
||||
ThrowStatement = 211,
|
||||
TryStatement = 212,
|
||||
DebuggerStatement = 213,
|
||||
VariableDeclaration = 214,
|
||||
VariableDeclarationList = 215,
|
||||
FunctionDeclaration = 216,
|
||||
ClassDeclaration = 217,
|
||||
InterfaceDeclaration = 218,
|
||||
TypeAliasDeclaration = 219,
|
||||
EnumDeclaration = 220,
|
||||
ModuleDeclaration = 221,
|
||||
ModuleBlock = 222,
|
||||
CaseBlock = 223,
|
||||
ImportEqualsDeclaration = 224,
|
||||
ImportDeclaration = 225,
|
||||
ImportClause = 226,
|
||||
NamespaceImport = 227,
|
||||
NamedImports = 228,
|
||||
ImportSpecifier = 229,
|
||||
ExportAssignment = 230,
|
||||
ExportDeclaration = 231,
|
||||
NamedExports = 232,
|
||||
ExportSpecifier = 233,
|
||||
MissingDeclaration = 234,
|
||||
ExternalModuleReference = 235,
|
||||
JsxElement = 236,
|
||||
JsxSelfClosingElement = 237,
|
||||
JsxOpeningElement = 238,
|
||||
JsxText = 239,
|
||||
JsxClosingElement = 240,
|
||||
JsxAttribute = 241,
|
||||
JsxSpreadAttribute = 242,
|
||||
JsxExpression = 243,
|
||||
CaseClause = 244,
|
||||
DefaultClause = 245,
|
||||
HeritageClause = 246,
|
||||
CatchClause = 247,
|
||||
PropertyAssignment = 248,
|
||||
ShorthandPropertyAssignment = 249,
|
||||
EnumMember = 250,
|
||||
SourceFile = 251,
|
||||
JSDocTypeExpression = 252,
|
||||
JSDocAllType = 253,
|
||||
JSDocUnknownType = 254,
|
||||
JSDocArrayType = 255,
|
||||
JSDocUnionType = 256,
|
||||
JSDocTupleType = 257,
|
||||
JSDocNullableType = 258,
|
||||
JSDocNonNullableType = 259,
|
||||
JSDocRecordType = 260,
|
||||
JSDocRecordMember = 261,
|
||||
JSDocTypeReference = 262,
|
||||
JSDocOptionalType = 263,
|
||||
JSDocFunctionType = 264,
|
||||
JSDocVariadicType = 265,
|
||||
JSDocConstructorType = 266,
|
||||
JSDocThisType = 267,
|
||||
JSDocComment = 268,
|
||||
JSDocTag = 269,
|
||||
JSDocParameterTag = 270,
|
||||
JSDocReturnTag = 271,
|
||||
JSDocTypeTag = 272,
|
||||
JSDocTemplateTag = 273,
|
||||
SyntaxList = 274,
|
||||
Count = 275,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 134,
|
||||
LastKeyword = 135,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 150,
|
||||
LastTypeNode = 162,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 163,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 134,
|
||||
LastToken = 135,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -330,7 +331,7 @@ declare namespace ts {
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 135,
|
||||
FirstNode = 136,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -354,10 +355,16 @@ declare namespace ts {
|
||||
ContainsThis = 262144,
|
||||
HasImplicitReturn = 524288,
|
||||
HasExplicitReturn = 1048576,
|
||||
GlobalAugmentation = 2097152,
|
||||
HasClassExtends = 4194304,
|
||||
HasDecorators = 8388608,
|
||||
HasParamDecorators = 16777216,
|
||||
HasAsyncFunctions = 33554432,
|
||||
Modifier = 1022,
|
||||
AccessibilityModifier = 56,
|
||||
BlockScoped = 24576,
|
||||
ReachabilityCheckFlags = 1572864,
|
||||
EmitHelperFlags = 62914560,
|
||||
}
|
||||
enum JsxFlags {
|
||||
None = 0,
|
||||
@@ -1141,6 +1148,7 @@ declare namespace ts {
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
|
||||
getTypeAtLocation(node: Node): Type;
|
||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||
@@ -1154,6 +1162,7 @@ declare namespace ts {
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
isUnknownSymbol(symbol: Symbol): boolean;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
@@ -1543,6 +1552,8 @@ declare namespace ts {
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (path: string, removed?: boolean) => void;
|
||||
type DirectoryWatcherCallback = (path: string) => void;
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -1550,8 +1561,8 @@ declare namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -1565,6 +1576,10 @@ declare namespace ts {
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
interface DirectoryWatcher extends FileWatcher {
|
||||
directoryPath: Path;
|
||||
referenceCount: number;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare namespace ts {
|
||||
@@ -2237,6 +2252,9 @@ declare namespace ts {
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
@@ -2260,6 +2278,9 @@ declare namespace ts {
|
||||
jsxOpenTagName = 19,
|
||||
jsxCloseTagName = 20,
|
||||
jsxSelfClosingTagName = 21,
|
||||
jsxAttribute = 22,
|
||||
jsxText = 23,
|
||||
jsxAttributeStringLiteralValue = 24,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
@@ -2283,7 +2304,6 @@ declare namespace ts {
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
||||
+4697
-3925
File diff suppressed because it is too large
Load Diff
Vendored
+169
-149
@@ -167,161 +167,162 @@ declare namespace ts {
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
OfKeyword = 134,
|
||||
QualifiedName = 135,
|
||||
ComputedPropertyName = 136,
|
||||
TypeParameter = 137,
|
||||
Parameter = 138,
|
||||
Decorator = 139,
|
||||
PropertySignature = 140,
|
||||
PropertyDeclaration = 141,
|
||||
MethodSignature = 142,
|
||||
MethodDeclaration = 143,
|
||||
Constructor = 144,
|
||||
GetAccessor = 145,
|
||||
SetAccessor = 146,
|
||||
CallSignature = 147,
|
||||
ConstructSignature = 148,
|
||||
IndexSignature = 149,
|
||||
TypePredicate = 150,
|
||||
TypeReference = 151,
|
||||
FunctionType = 152,
|
||||
ConstructorType = 153,
|
||||
TypeQuery = 154,
|
||||
TypeLiteral = 155,
|
||||
ArrayType = 156,
|
||||
TupleType = 157,
|
||||
UnionType = 158,
|
||||
IntersectionType = 159,
|
||||
ParenthesizedType = 160,
|
||||
ThisType = 161,
|
||||
StringLiteralType = 162,
|
||||
ObjectBindingPattern = 163,
|
||||
ArrayBindingPattern = 164,
|
||||
BindingElement = 165,
|
||||
ArrayLiteralExpression = 166,
|
||||
ObjectLiteralExpression = 167,
|
||||
PropertyAccessExpression = 168,
|
||||
ElementAccessExpression = 169,
|
||||
CallExpression = 170,
|
||||
NewExpression = 171,
|
||||
TaggedTemplateExpression = 172,
|
||||
TypeAssertionExpression = 173,
|
||||
ParenthesizedExpression = 174,
|
||||
FunctionExpression = 175,
|
||||
ArrowFunction = 176,
|
||||
DeleteExpression = 177,
|
||||
TypeOfExpression = 178,
|
||||
VoidExpression = 179,
|
||||
AwaitExpression = 180,
|
||||
PrefixUnaryExpression = 181,
|
||||
PostfixUnaryExpression = 182,
|
||||
BinaryExpression = 183,
|
||||
ConditionalExpression = 184,
|
||||
TemplateExpression = 185,
|
||||
YieldExpression = 186,
|
||||
SpreadElementExpression = 187,
|
||||
ClassExpression = 188,
|
||||
OmittedExpression = 189,
|
||||
ExpressionWithTypeArguments = 190,
|
||||
AsExpression = 191,
|
||||
TemplateSpan = 192,
|
||||
SemicolonClassElement = 193,
|
||||
Block = 194,
|
||||
VariableStatement = 195,
|
||||
EmptyStatement = 196,
|
||||
ExpressionStatement = 197,
|
||||
IfStatement = 198,
|
||||
DoStatement = 199,
|
||||
WhileStatement = 200,
|
||||
ForStatement = 201,
|
||||
ForInStatement = 202,
|
||||
ForOfStatement = 203,
|
||||
ContinueStatement = 204,
|
||||
BreakStatement = 205,
|
||||
ReturnStatement = 206,
|
||||
WithStatement = 207,
|
||||
SwitchStatement = 208,
|
||||
LabeledStatement = 209,
|
||||
ThrowStatement = 210,
|
||||
TryStatement = 211,
|
||||
DebuggerStatement = 212,
|
||||
VariableDeclaration = 213,
|
||||
VariableDeclarationList = 214,
|
||||
FunctionDeclaration = 215,
|
||||
ClassDeclaration = 216,
|
||||
InterfaceDeclaration = 217,
|
||||
TypeAliasDeclaration = 218,
|
||||
EnumDeclaration = 219,
|
||||
ModuleDeclaration = 220,
|
||||
ModuleBlock = 221,
|
||||
CaseBlock = 222,
|
||||
ImportEqualsDeclaration = 223,
|
||||
ImportDeclaration = 224,
|
||||
ImportClause = 225,
|
||||
NamespaceImport = 226,
|
||||
NamedImports = 227,
|
||||
ImportSpecifier = 228,
|
||||
ExportAssignment = 229,
|
||||
ExportDeclaration = 230,
|
||||
NamedExports = 231,
|
||||
ExportSpecifier = 232,
|
||||
MissingDeclaration = 233,
|
||||
ExternalModuleReference = 234,
|
||||
JsxElement = 235,
|
||||
JsxSelfClosingElement = 236,
|
||||
JsxOpeningElement = 237,
|
||||
JsxText = 238,
|
||||
JsxClosingElement = 239,
|
||||
JsxAttribute = 240,
|
||||
JsxSpreadAttribute = 241,
|
||||
JsxExpression = 242,
|
||||
CaseClause = 243,
|
||||
DefaultClause = 244,
|
||||
HeritageClause = 245,
|
||||
CatchClause = 246,
|
||||
PropertyAssignment = 247,
|
||||
ShorthandPropertyAssignment = 248,
|
||||
EnumMember = 249,
|
||||
SourceFile = 250,
|
||||
JSDocTypeExpression = 251,
|
||||
JSDocAllType = 252,
|
||||
JSDocUnknownType = 253,
|
||||
JSDocArrayType = 254,
|
||||
JSDocUnionType = 255,
|
||||
JSDocTupleType = 256,
|
||||
JSDocNullableType = 257,
|
||||
JSDocNonNullableType = 258,
|
||||
JSDocRecordType = 259,
|
||||
JSDocRecordMember = 260,
|
||||
JSDocTypeReference = 261,
|
||||
JSDocOptionalType = 262,
|
||||
JSDocFunctionType = 263,
|
||||
JSDocVariadicType = 264,
|
||||
JSDocConstructorType = 265,
|
||||
JSDocThisType = 266,
|
||||
JSDocComment = 267,
|
||||
JSDocTag = 268,
|
||||
JSDocParameterTag = 269,
|
||||
JSDocReturnTag = 270,
|
||||
JSDocTypeTag = 271,
|
||||
JSDocTemplateTag = 272,
|
||||
SyntaxList = 273,
|
||||
Count = 274,
|
||||
GlobalKeyword = 134,
|
||||
OfKeyword = 135,
|
||||
QualifiedName = 136,
|
||||
ComputedPropertyName = 137,
|
||||
TypeParameter = 138,
|
||||
Parameter = 139,
|
||||
Decorator = 140,
|
||||
PropertySignature = 141,
|
||||
PropertyDeclaration = 142,
|
||||
MethodSignature = 143,
|
||||
MethodDeclaration = 144,
|
||||
Constructor = 145,
|
||||
GetAccessor = 146,
|
||||
SetAccessor = 147,
|
||||
CallSignature = 148,
|
||||
ConstructSignature = 149,
|
||||
IndexSignature = 150,
|
||||
TypePredicate = 151,
|
||||
TypeReference = 152,
|
||||
FunctionType = 153,
|
||||
ConstructorType = 154,
|
||||
TypeQuery = 155,
|
||||
TypeLiteral = 156,
|
||||
ArrayType = 157,
|
||||
TupleType = 158,
|
||||
UnionType = 159,
|
||||
IntersectionType = 160,
|
||||
ParenthesizedType = 161,
|
||||
ThisType = 162,
|
||||
StringLiteralType = 163,
|
||||
ObjectBindingPattern = 164,
|
||||
ArrayBindingPattern = 165,
|
||||
BindingElement = 166,
|
||||
ArrayLiteralExpression = 167,
|
||||
ObjectLiteralExpression = 168,
|
||||
PropertyAccessExpression = 169,
|
||||
ElementAccessExpression = 170,
|
||||
CallExpression = 171,
|
||||
NewExpression = 172,
|
||||
TaggedTemplateExpression = 173,
|
||||
TypeAssertionExpression = 174,
|
||||
ParenthesizedExpression = 175,
|
||||
FunctionExpression = 176,
|
||||
ArrowFunction = 177,
|
||||
DeleteExpression = 178,
|
||||
TypeOfExpression = 179,
|
||||
VoidExpression = 180,
|
||||
AwaitExpression = 181,
|
||||
PrefixUnaryExpression = 182,
|
||||
PostfixUnaryExpression = 183,
|
||||
BinaryExpression = 184,
|
||||
ConditionalExpression = 185,
|
||||
TemplateExpression = 186,
|
||||
YieldExpression = 187,
|
||||
SpreadElementExpression = 188,
|
||||
ClassExpression = 189,
|
||||
OmittedExpression = 190,
|
||||
ExpressionWithTypeArguments = 191,
|
||||
AsExpression = 192,
|
||||
TemplateSpan = 193,
|
||||
SemicolonClassElement = 194,
|
||||
Block = 195,
|
||||
VariableStatement = 196,
|
||||
EmptyStatement = 197,
|
||||
ExpressionStatement = 198,
|
||||
IfStatement = 199,
|
||||
DoStatement = 200,
|
||||
WhileStatement = 201,
|
||||
ForStatement = 202,
|
||||
ForInStatement = 203,
|
||||
ForOfStatement = 204,
|
||||
ContinueStatement = 205,
|
||||
BreakStatement = 206,
|
||||
ReturnStatement = 207,
|
||||
WithStatement = 208,
|
||||
SwitchStatement = 209,
|
||||
LabeledStatement = 210,
|
||||
ThrowStatement = 211,
|
||||
TryStatement = 212,
|
||||
DebuggerStatement = 213,
|
||||
VariableDeclaration = 214,
|
||||
VariableDeclarationList = 215,
|
||||
FunctionDeclaration = 216,
|
||||
ClassDeclaration = 217,
|
||||
InterfaceDeclaration = 218,
|
||||
TypeAliasDeclaration = 219,
|
||||
EnumDeclaration = 220,
|
||||
ModuleDeclaration = 221,
|
||||
ModuleBlock = 222,
|
||||
CaseBlock = 223,
|
||||
ImportEqualsDeclaration = 224,
|
||||
ImportDeclaration = 225,
|
||||
ImportClause = 226,
|
||||
NamespaceImport = 227,
|
||||
NamedImports = 228,
|
||||
ImportSpecifier = 229,
|
||||
ExportAssignment = 230,
|
||||
ExportDeclaration = 231,
|
||||
NamedExports = 232,
|
||||
ExportSpecifier = 233,
|
||||
MissingDeclaration = 234,
|
||||
ExternalModuleReference = 235,
|
||||
JsxElement = 236,
|
||||
JsxSelfClosingElement = 237,
|
||||
JsxOpeningElement = 238,
|
||||
JsxText = 239,
|
||||
JsxClosingElement = 240,
|
||||
JsxAttribute = 241,
|
||||
JsxSpreadAttribute = 242,
|
||||
JsxExpression = 243,
|
||||
CaseClause = 244,
|
||||
DefaultClause = 245,
|
||||
HeritageClause = 246,
|
||||
CatchClause = 247,
|
||||
PropertyAssignment = 248,
|
||||
ShorthandPropertyAssignment = 249,
|
||||
EnumMember = 250,
|
||||
SourceFile = 251,
|
||||
JSDocTypeExpression = 252,
|
||||
JSDocAllType = 253,
|
||||
JSDocUnknownType = 254,
|
||||
JSDocArrayType = 255,
|
||||
JSDocUnionType = 256,
|
||||
JSDocTupleType = 257,
|
||||
JSDocNullableType = 258,
|
||||
JSDocNonNullableType = 259,
|
||||
JSDocRecordType = 260,
|
||||
JSDocRecordMember = 261,
|
||||
JSDocTypeReference = 262,
|
||||
JSDocOptionalType = 263,
|
||||
JSDocFunctionType = 264,
|
||||
JSDocVariadicType = 265,
|
||||
JSDocConstructorType = 266,
|
||||
JSDocThisType = 267,
|
||||
JSDocComment = 268,
|
||||
JSDocTag = 269,
|
||||
JSDocParameterTag = 270,
|
||||
JSDocReturnTag = 271,
|
||||
JSDocTypeTag = 272,
|
||||
JSDocTemplateTag = 273,
|
||||
SyntaxList = 274,
|
||||
Count = 275,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 134,
|
||||
LastKeyword = 135,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 150,
|
||||
LastTypeNode = 162,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 163,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 134,
|
||||
LastToken = 135,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -330,7 +331,7 @@ declare namespace ts {
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 135,
|
||||
FirstNode = 136,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -354,10 +355,16 @@ declare namespace ts {
|
||||
ContainsThis = 262144,
|
||||
HasImplicitReturn = 524288,
|
||||
HasExplicitReturn = 1048576,
|
||||
GlobalAugmentation = 2097152,
|
||||
HasClassExtends = 4194304,
|
||||
HasDecorators = 8388608,
|
||||
HasParamDecorators = 16777216,
|
||||
HasAsyncFunctions = 33554432,
|
||||
Modifier = 1022,
|
||||
AccessibilityModifier = 56,
|
||||
BlockScoped = 24576,
|
||||
ReachabilityCheckFlags = 1572864,
|
||||
EmitHelperFlags = 62914560,
|
||||
}
|
||||
enum JsxFlags {
|
||||
None = 0,
|
||||
@@ -1141,6 +1148,7 @@ declare namespace ts {
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
|
||||
getTypeAtLocation(node: Node): Type;
|
||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||
@@ -1154,6 +1162,7 @@ declare namespace ts {
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
isUnknownSymbol(symbol: Symbol): boolean;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
@@ -1543,6 +1552,8 @@ declare namespace ts {
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (path: string, removed?: boolean) => void;
|
||||
type DirectoryWatcherCallback = (path: string) => void;
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -1550,8 +1561,8 @@ declare namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -1565,6 +1576,10 @@ declare namespace ts {
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
interface DirectoryWatcher extends FileWatcher {
|
||||
directoryPath: Path;
|
||||
referenceCount: number;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare namespace ts {
|
||||
@@ -2237,6 +2252,9 @@ declare namespace ts {
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
@@ -2260,6 +2278,9 @@ declare namespace ts {
|
||||
jsxOpenTagName = 19,
|
||||
jsxCloseTagName = 20,
|
||||
jsxSelfClosingTagName = 21,
|
||||
jsxAttribute = 22,
|
||||
jsxText = 23,
|
||||
jsxAttributeStringLiteralValue = 24,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
@@ -2283,7 +2304,6 @@ declare namespace ts {
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
||||
+4697
-3925
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
+103
-11
@@ -117,6 +117,12 @@ namespace ts {
|
||||
let labelIndexMap: Map<number>;
|
||||
let implicitLabels: number[];
|
||||
|
||||
// state used for emit helpers
|
||||
let hasClassExtends: boolean;
|
||||
let hasAsyncFunctions: boolean;
|
||||
let hasDecorators: boolean;
|
||||
let hasParameterDecorators: boolean;
|
||||
|
||||
// If this file is an external module, then it is automatically in strict-mode according to
|
||||
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
|
||||
// not depending on if we see "use strict" in certain places (or if we hit a class/namespace).
|
||||
@@ -151,6 +157,10 @@ namespace ts {
|
||||
labelStack = undefined;
|
||||
labelIndexMap = undefined;
|
||||
implicitLabels = undefined;
|
||||
hasClassExtends = false;
|
||||
hasAsyncFunctions = false;
|
||||
hasDecorators = false;
|
||||
hasParameterDecorators = false;
|
||||
}
|
||||
|
||||
return bindSourceFile;
|
||||
@@ -241,6 +251,15 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return node.flags & NodeFlags.Default ? "default" : undefined;
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
return isJSDocConstructSignature(node) ? "__new" : "__call";
|
||||
case SyntaxKind.Parameter:
|
||||
// Parameters with names are handled at the top of this function. Parameters
|
||||
// without names can only come from JSDocFunctionTypes.
|
||||
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType);
|
||||
let functionType = <JSDocFunctionType>node.parent;
|
||||
let index = indexOf(functionType.parameters, node);
|
||||
return "p" + index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,8 +370,8 @@ namespace ts {
|
||||
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
|
||||
|
||||
// NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge
|
||||
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
|
||||
// and this case is specially handled. Module augmentations should only be merged with original module definition
|
||||
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
|
||||
// and this case is specially handled. Module augmentations should only be merged with original module definition
|
||||
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
|
||||
if (!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) {
|
||||
const exportKind =
|
||||
@@ -411,7 +430,6 @@ namespace ts {
|
||||
|
||||
addToContainerChain(container);
|
||||
}
|
||||
|
||||
else if (containerFlags & ContainerFlags.IsBlockScopedContainer) {
|
||||
blockScopeContainer = node;
|
||||
blockScopeContainer.locals = undefined;
|
||||
@@ -429,6 +447,9 @@ namespace ts {
|
||||
// reset all reachability check related flags on node (for incremental scenarios)
|
||||
flags &= ~NodeFlags.ReachabilityCheckFlags;
|
||||
|
||||
// reset all emit helper flags on node (for incremental scenarios)
|
||||
flags &= ~NodeFlags.EmitHelperFlags;
|
||||
|
||||
if (kind === SyntaxKind.InterfaceDeclaration) {
|
||||
seenThisKeyword = false;
|
||||
}
|
||||
@@ -446,6 +467,10 @@ namespace ts {
|
||||
labelStack = labelIndexMap = implicitLabels = undefined;
|
||||
}
|
||||
|
||||
if (isInJavaScriptFile(node) && node.jsDocComment) {
|
||||
bind(node.jsDocComment);
|
||||
}
|
||||
|
||||
bindReachableStatement(node);
|
||||
|
||||
if (currentReachabilityState === Reachability.Reachable && isFunctionLikeKind(kind) && nodeIsPresent((<FunctionLikeDeclaration>node).body)) {
|
||||
@@ -459,6 +484,21 @@ namespace ts {
|
||||
flags = seenThisKeyword ? flags | NodeFlags.ContainsThis : flags & ~NodeFlags.ContainsThis;
|
||||
}
|
||||
|
||||
if (kind === SyntaxKind.SourceFile) {
|
||||
if (hasClassExtends) {
|
||||
flags |= NodeFlags.HasClassExtends;
|
||||
}
|
||||
if (hasDecorators) {
|
||||
flags |= NodeFlags.HasDecorators;
|
||||
}
|
||||
if (hasParameterDecorators) {
|
||||
flags |= NodeFlags.HasParamDecorators;
|
||||
}
|
||||
if (hasAsyncFunctions) {
|
||||
flags |= NodeFlags.HasAsyncFunctions;
|
||||
}
|
||||
}
|
||||
|
||||
node.flags = flags;
|
||||
|
||||
if (saveState) {
|
||||
@@ -694,8 +734,9 @@ namespace ts {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
return ContainerFlags.IsContainer;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
@@ -781,6 +822,7 @@ namespace ts {
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
// Interface/Object-types always have their children added to the 'members' of
|
||||
// their container. They are only accessible through an instance of their
|
||||
// container, and are never in scope otherwise (even inside the body of the
|
||||
@@ -801,6 +843,7 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
// All the children of these container types are never visible through another
|
||||
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
|
||||
@@ -882,7 +925,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function bindFunctionOrConstructorType(node: SignatureDeclaration) {
|
||||
function bindFunctionOrConstructorType(node: SignatureDeclaration): void {
|
||||
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
|
||||
// to the one we would get for: { <...>(...): T }
|
||||
//
|
||||
@@ -957,7 +1000,7 @@ namespace ts {
|
||||
declareModuleMember(node, symbolFlags, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
// fall through.
|
||||
// fall through.
|
||||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
@@ -1236,12 +1279,14 @@ namespace ts {
|
||||
return bindVariableDeclarationOrBindingElement(<VariableDeclaration | BindingElement>node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.JSDocRecordMember:
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
case SyntaxKind.EnumMember:
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes);
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
@@ -1255,8 +1300,7 @@ namespace ts {
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None),
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
checkStrictModeFunctionName(<FunctionDeclaration>node);
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
|
||||
return bindFunctionDeclaration(<FunctionDeclaration>node);
|
||||
case SyntaxKind.Constructor:
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ SymbolFlags.None);
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -1265,16 +1309,16 @@ namespace ts {
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
return bindFunctionOrConstructorType(<SignatureDeclaration>node);
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
return bindAnonymousDeclaration(<TypeLiteralNode>node, SymbolFlags.TypeLiteral, "__type");
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return bindObjectLiteralExpression(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
checkStrictModeFunctionName(<FunctionExpression>node);
|
||||
const bindingName = (<FunctionExpression>node).name ? (<FunctionExpression>node).name.text : "__function";
|
||||
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
|
||||
return bindFunctionExpression(<FunctionExpression>node);
|
||||
|
||||
case SyntaxKind.CallExpression:
|
||||
if (isInJavaScriptFile(node)) {
|
||||
@@ -1424,6 +1468,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
function bindClassLikeDeclaration(node: ClassLikeDeclaration) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (getClassExtendsHeritageClauseElement(node) !== undefined) {
|
||||
hasClassExtends = true;
|
||||
}
|
||||
if (nodeIsDecorated(node)) {
|
||||
hasDecorators = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
|
||||
}
|
||||
@@ -1493,6 +1546,13 @@ namespace ts {
|
||||
}
|
||||
|
||||
function bindParameter(node: ParameterDeclaration) {
|
||||
if (!isDeclarationFile(file) &&
|
||||
!isInAmbientContext(node) &&
|
||||
nodeIsDecorated(node)) {
|
||||
hasDecorators = true;
|
||||
hasParameterDecorators = true;
|
||||
}
|
||||
|
||||
if (inStrictMode) {
|
||||
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
|
||||
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
|
||||
@@ -1514,7 +1574,39 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function bindFunctionDeclaration(node: FunctionDeclaration) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
hasAsyncFunctions = true;
|
||||
}
|
||||
}
|
||||
|
||||
checkStrictModeFunctionName(<FunctionDeclaration>node);
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
|
||||
}
|
||||
|
||||
function bindFunctionExpression(node: FunctionExpression) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
hasAsyncFunctions = true;
|
||||
}
|
||||
}
|
||||
|
||||
checkStrictModeFunctionName(<FunctionExpression>node);
|
||||
const bindingName = (<FunctionExpression>node).name ? (<FunctionExpression>node).name.text : "__function";
|
||||
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
|
||||
}
|
||||
|
||||
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
hasAsyncFunctions = true;
|
||||
}
|
||||
if (nodeIsDecorated(node)) {
|
||||
hasDecorators = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasDynamicName(node)
|
||||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
|
||||
+329
-91
@@ -174,11 +174,6 @@ namespace ts {
|
||||
const unionTypes: Map<UnionType> = {};
|
||||
const intersectionTypes: Map<IntersectionType> = {};
|
||||
const stringLiteralTypes: Map<StringLiteralType> = {};
|
||||
let emitExtends = false;
|
||||
let emitDecorate = false;
|
||||
let emitParam = false;
|
||||
let emitAwaiter = false;
|
||||
const emitGenerator = false;
|
||||
|
||||
const resolutionTargets: TypeSystemEntity[] = [];
|
||||
const resolutionResults: boolean[] = [];
|
||||
@@ -381,8 +376,8 @@ namespace ts {
|
||||
const moduleAugmentation = <ModuleDeclaration>moduleName.parent;
|
||||
if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) {
|
||||
// this is a combined symbol for multiple augmentations within the same file.
|
||||
// its symbol already has accumulated information for all declarations
|
||||
// so we need to add it just once - do the work only for first declaration
|
||||
// its symbol already has accumulated information for all declarations
|
||||
// so we need to add it just once - do the work only for first declaration
|
||||
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
|
||||
return;
|
||||
}
|
||||
@@ -391,7 +386,7 @@ namespace ts {
|
||||
mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
|
||||
}
|
||||
else {
|
||||
// find a module that about to be augmented
|
||||
// find a module that about to be augmented
|
||||
let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found);
|
||||
if (!mainModule) {
|
||||
return;
|
||||
@@ -458,7 +453,7 @@ namespace ts {
|
||||
* Get symbols that represent parameter-property-declaration as parameter and as property declaration
|
||||
* @param parameter a parameterDeclaration node
|
||||
* @param parameterName a name of the parameter to get the symbols for.
|
||||
* @return a tuple of two symbols
|
||||
* @return a tuple of two symbols
|
||||
*/
|
||||
function getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): [Symbol, Symbol] {
|
||||
const constructoDeclaration = parameter.parent;
|
||||
@@ -562,7 +557,9 @@ namespace ts {
|
||||
// - Type parameters of a function are in scope in the entire function declaration, including the parameter
|
||||
// list and return type. However, local types are only in scope in the function body.
|
||||
// - parameters are only in the scope of function body
|
||||
if (meaning & result.flags & SymbolFlags.Type) {
|
||||
// This restriction does not apply to JSDoc comment types because they are parented
|
||||
// at a higher level than type parameters would normally be
|
||||
if (meaning & result.flags & SymbolFlags.Type && lastLocation.kind !== SyntaxKind.JSDocComment) {
|
||||
useResult = result.flags & SymbolFlags.TypeParameter
|
||||
// type parameters are visible in parameter list, return type and type parameter list
|
||||
? lastLocation === (<FunctionLikeDeclaration>location).type ||
|
||||
@@ -815,7 +812,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// No static member is present.
|
||||
// Check if we're in an instance method and look for a relevant instance member.
|
||||
// Check if we're in an instance method and look for a relevant instance member.
|
||||
if (location === container && !(location.flags & NodeFlags.Static)) {
|
||||
const instanceType = (<InterfaceType>getDeclaredTypeOfSymbol(classSymbol)).thisType;
|
||||
if (getPropertyOfType(instanceType, name)) {
|
||||
@@ -1166,7 +1163,7 @@ namespace ts {
|
||||
return getMergedSymbol(sourceFile.symbol);
|
||||
}
|
||||
if (moduleNotFoundError) {
|
||||
// report errors only if it was requested
|
||||
// report errors only if it was requested
|
||||
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
||||
}
|
||||
return undefined;
|
||||
@@ -2596,8 +2593,54 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration) {
|
||||
const jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
if (jsDocType) {
|
||||
return getTypeFromTypeNode(jsDocType);
|
||||
}
|
||||
}
|
||||
|
||||
function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration): JSDocType {
|
||||
// First, see if this node has an @type annotation on it directly.
|
||||
const typeTag = getJSDocTypeTag(declaration);
|
||||
if (typeTag) {
|
||||
return typeTag.typeExpression.type;
|
||||
}
|
||||
|
||||
if (declaration.kind === SyntaxKind.VariableDeclaration &&
|
||||
declaration.parent.kind === SyntaxKind.VariableDeclarationList &&
|
||||
declaration.parent.parent.kind === SyntaxKind.VariableStatement) {
|
||||
|
||||
// @type annotation might have been on the variable statement, try that instead.
|
||||
const annotation = getJSDocTypeTag(declaration.parent.parent);
|
||||
if (annotation) {
|
||||
return annotation.typeExpression.type;
|
||||
}
|
||||
}
|
||||
else if (declaration.kind === SyntaxKind.Parameter) {
|
||||
// If it's a parameter, see if the parent has a jsdoc comment with an @param
|
||||
// annotation.
|
||||
const paramTag = getCorrespondingJSDocParameterTag(<ParameterDeclaration>declaration);
|
||||
if (paramTag && paramTag.typeExpression) {
|
||||
return paramTag.typeExpression.type;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Return the inferred type for a variable, parameter, or property declaration
|
||||
function getTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration): Type {
|
||||
if (declaration.parserContextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
// If this is a variable in a JavaScript file, then use the JSDoc type (if it has
|
||||
// one as its type), otherwise fallback to the below standard TS codepaths to
|
||||
// try to figure it out.
|
||||
const type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
if (type && type !== unknownType) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
// A variable declared in a for..in statement is always of type string
|
||||
if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) {
|
||||
return stringType;
|
||||
@@ -3915,6 +3958,17 @@ namespace ts {
|
||||
return getIndexTypeOfStructuredType(getApparentType(type), kind);
|
||||
}
|
||||
|
||||
function getTypeParametersFromJSDocTemplate(declaration: SignatureDeclaration): TypeParameter[] {
|
||||
if (declaration.parserContextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
const templateTag = getJSDocTemplateTag(declaration);
|
||||
if (templateTag) {
|
||||
return getTypeParametersFromDeclaration(templateTag.typeParameters);
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
||||
// type checking functions).
|
||||
function getTypeParametersFromDeclaration(typeParameterDeclarations: TypeParameterDeclaration[]): TypeParameter[] {
|
||||
@@ -3939,6 +3993,23 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isOptionalParameter(node: ParameterDeclaration) {
|
||||
if (node.parserContextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const paramTag = getCorrespondingJSDocParameterTag(node);
|
||||
if (paramTag) {
|
||||
if (paramTag.isBracketed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (paramTag.typeExpression) {
|
||||
return paramTag.typeExpression.type.kind === SyntaxKind.JSDocOptionalType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasQuestionToken(node)) {
|
||||
return true;
|
||||
}
|
||||
@@ -3979,12 +4050,20 @@ namespace ts {
|
||||
getDeclaredTypeOfClassOrInterface(getMergedSymbol((<ClassDeclaration>declaration.parent).symbol))
|
||||
: undefined;
|
||||
const typeParameters = classType ? classType.localTypeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
|
||||
getTypeParametersFromJSDocTemplate(declaration);
|
||||
const parameters: Symbol[] = [];
|
||||
let hasStringLiterals = false;
|
||||
let minArgumentCount = -1;
|
||||
for (let i = 0, n = declaration.parameters.length; i < n; i++) {
|
||||
const isJSConstructSignature = isJSDocConstructSignature(declaration);
|
||||
let returnType: Type = undefined;
|
||||
|
||||
// If this is a JSDoc construct signature, then skip the first parameter in the
|
||||
// parameter list. The first parameter represents the return type of the construct
|
||||
// signature.
|
||||
for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {
|
||||
const param = declaration.parameters[i];
|
||||
|
||||
let paramSymbol = param.symbol;
|
||||
// Include parameter symbol instead of property symbol in the signature
|
||||
if (paramSymbol && !!(paramSymbol.flags & SymbolFlags.Property) && !isBindingPattern(param.name)) {
|
||||
@@ -3992,6 +4071,7 @@ namespace ts {
|
||||
paramSymbol = resolvedSymbol;
|
||||
}
|
||||
parameters.push(paramSymbol);
|
||||
|
||||
if (param.type && param.type.kind === SyntaxKind.StringLiteralType) {
|
||||
hasStringLiterals = true;
|
||||
}
|
||||
@@ -4011,14 +4091,24 @@ namespace ts {
|
||||
minArgumentCount = declaration.parameters.length;
|
||||
}
|
||||
|
||||
let returnType: Type;
|
||||
if (classType) {
|
||||
if (isJSConstructSignature) {
|
||||
minArgumentCount--;
|
||||
returnType = getTypeFromTypeNode(declaration.parameters[0].type);
|
||||
}
|
||||
else if (classType) {
|
||||
returnType = classType;
|
||||
}
|
||||
else if (declaration.type) {
|
||||
returnType = getTypeFromTypeNode(declaration.type);
|
||||
}
|
||||
else {
|
||||
if (declaration.parserContextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
const type = getReturnTypeFromJSDocComment(declaration);
|
||||
if (type && type !== unknownType) {
|
||||
returnType = type;
|
||||
}
|
||||
}
|
||||
|
||||
// TypeScript 1.0 spec (April 2014):
|
||||
// If only one accessor includes a type annotation, the other behaves as if it had the same type annotation.
|
||||
if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) {
|
||||
@@ -4055,6 +4145,7 @@ namespace ts {
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
// Don't include signature if node is the implementation of an overloaded function. A node is considered
|
||||
// an implementation node if it has a body and the previous node is of the same kind and immediately
|
||||
// precedes the implementation node (i.e. has the same parent and ends where the implementation starts).
|
||||
@@ -4274,7 +4365,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Get type from reference to class or interface
|
||||
function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
|
||||
function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
|
||||
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
|
||||
const typeParameters = type.localTypeParameters;
|
||||
if (typeParameters) {
|
||||
@@ -4297,7 +4388,7 @@ namespace ts {
|
||||
// Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
|
||||
// references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
|
||||
// declared type. Instantiations are cached using the type identities of the type arguments as the key.
|
||||
function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
|
||||
function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
|
||||
const type = getDeclaredTypeOfSymbol(symbol);
|
||||
const links = getSymbolLinks(symbol);
|
||||
const typeParameters = links.typeParameters;
|
||||
@@ -4318,7 +4409,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Get type from reference to named type that cannot be generic (enum or type parameter)
|
||||
function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
|
||||
function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
|
||||
if (node.typeArguments) {
|
||||
error(node, Diagnostics.Type_0_is_not_generic, symbolToString(symbol));
|
||||
return unknownType;
|
||||
@@ -4326,18 +4417,83 @@ namespace ts {
|
||||
return getDeclaredTypeOfSymbol(symbol);
|
||||
}
|
||||
|
||||
function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments): Type {
|
||||
function getTypeReferenceName(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): LeftHandSideExpression | EntityName {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeReference:
|
||||
return (<TypeReferenceNode>node).typeName;
|
||||
case SyntaxKind.JSDocTypeReference:
|
||||
return (<JSDocTypeReference>node).name;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
// We only support expressions that are simple qualified names. For other
|
||||
// expressions this produces undefined.
|
||||
if (isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node)) {
|
||||
return (<ExpressionWithTypeArguments>node).expression;
|
||||
}
|
||||
|
||||
// fall through;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveTypeReferenceName(
|
||||
node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference,
|
||||
typeReferenceName: LeftHandSideExpression | EntityName) {
|
||||
|
||||
if (!typeReferenceName) {
|
||||
return unknownSymbol;
|
||||
}
|
||||
|
||||
return resolveEntityName(typeReferenceName, SymbolFlags.Type) || unknownSymbol;
|
||||
}
|
||||
|
||||
function getTypeReferenceType(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol) {
|
||||
if (symbol === unknownSymbol) {
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
return getTypeFromClassOrInterfaceReference(node, symbol);
|
||||
}
|
||||
|
||||
if (symbol.flags & SymbolFlags.TypeAlias) {
|
||||
return getTypeFromTypeAliasReference(node, symbol);
|
||||
}
|
||||
|
||||
if (symbol.flags & SymbolFlags.Value && node.kind === SyntaxKind.JSDocTypeReference) {
|
||||
// A JSDocTypeReference may have resolved to a value (as opposed to a type). In
|
||||
// that case, the type of this reference is just the type of the value we resolved
|
||||
// to.
|
||||
return getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
||||
return getTypeFromNonGenericTypeReference(node, symbol);
|
||||
}
|
||||
|
||||
function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
// We only support expressions that are simple qualified names. For other expressions this produces undefined.
|
||||
const typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (<TypeReferenceNode>node).typeName :
|
||||
isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node) ? (<ExpressionWithTypeArguments>node).expression :
|
||||
undefined;
|
||||
const symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol;
|
||||
const type = symbol === unknownSymbol ? unknownType :
|
||||
symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? getTypeFromClassOrInterfaceReference(node, symbol) :
|
||||
symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) :
|
||||
getTypeFromNonGenericTypeReference(node, symbol);
|
||||
let symbol: Symbol;
|
||||
let type: Type;
|
||||
if (node.kind === SyntaxKind.JSDocTypeReference) {
|
||||
const typeReferenceName = getTypeReferenceName(node);
|
||||
symbol = resolveTypeReferenceName(node, typeReferenceName);
|
||||
type = getTypeReferenceType(node, symbol);
|
||||
|
||||
links.resolvedSymbol = symbol;
|
||||
links.resolvedType = type;
|
||||
}
|
||||
else {
|
||||
// We only support expressions that are simple qualified names. For other expressions this produces undefined.
|
||||
const typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (<TypeReferenceNode>node).typeName :
|
||||
isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node) ? (<ExpressionWithTypeArguments>node).expression :
|
||||
undefined;
|
||||
symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol;
|
||||
type = symbol === unknownSymbol ? unknownType :
|
||||
symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? getTypeFromClassOrInterfaceReference(node, symbol) :
|
||||
symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) :
|
||||
getTypeFromNonGenericTypeReference(node, symbol);
|
||||
}
|
||||
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
|
||||
// type reference in checkTypeReferenceOrExpressionWithTypeArguments.
|
||||
links.resolvedSymbol = symbol;
|
||||
@@ -4632,6 +4788,24 @@ namespace ts {
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getTypeFromJSDocVariadicType(node: JSDocVariadicType): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
const type = getTypeFromTypeNode(node.type);
|
||||
links.resolvedType = type ? createArrayType(type) : unknownType;
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getTypeFromJSDocTupleType(node: JSDocTupleType): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
const types = map(node.types, getTypeFromTypeNode);
|
||||
links.resolvedType = createTupleType(types);
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getThisType(node: TypeNode): Type {
|
||||
const container = getThisContainer(node, /*includeArrowFunctions*/ false);
|
||||
const parent = container && container.parent;
|
||||
@@ -4675,6 +4849,8 @@ namespace ts {
|
||||
function getTypeFromTypeNode(node: TypeNode): Type {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.AnyKeyword:
|
||||
case SyntaxKind.JSDocAllType:
|
||||
case SyntaxKind.JSDocUnknownType:
|
||||
return anyType;
|
||||
case SyntaxKind.StringKeyword:
|
||||
return stringType;
|
||||
@@ -4691,6 +4867,7 @@ namespace ts {
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return getTypeFromStringLiteralTypeNode(<StringLiteralTypeNode>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.JSDocTypeReference:
|
||||
return getTypeFromTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.TypePredicate:
|
||||
return getTypeFromPredicateTypeNode(<TypePredicateNode>node);
|
||||
@@ -4699,18 +4876,27 @@ namespace ts {
|
||||
case SyntaxKind.TypeQuery:
|
||||
return getTypeFromTypeQueryNode(<TypeQueryNode>node);
|
||||
case SyntaxKind.ArrayType:
|
||||
case SyntaxKind.JSDocArrayType:
|
||||
return getTypeFromArrayTypeNode(<ArrayTypeNode>node);
|
||||
case SyntaxKind.TupleType:
|
||||
return getTypeFromTupleTypeNode(<TupleTypeNode>node);
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.JSDocUnionType:
|
||||
return getTypeFromUnionTypeNode(<UnionTypeNode>node);
|
||||
case SyntaxKind.IntersectionType:
|
||||
return getTypeFromIntersectionTypeNode(<IntersectionTypeNode>node);
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return getTypeFromTypeNode((<ParenthesizedTypeNode>node).type);
|
||||
case SyntaxKind.JSDocNullableType:
|
||||
case SyntaxKind.JSDocNonNullableType:
|
||||
case SyntaxKind.JSDocConstructorType:
|
||||
case SyntaxKind.JSDocThisType:
|
||||
case SyntaxKind.JSDocOptionalType:
|
||||
return getTypeFromTypeNode((<ParenthesizedTypeNode | JSDocTypeReferencingNode>node).type);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
|
||||
// This function assumes that an identifier or qualified name is a type expression
|
||||
// Callers should first ensure this by calling isTypeNode
|
||||
@@ -4718,6 +4904,10 @@ namespace ts {
|
||||
case SyntaxKind.QualifiedName:
|
||||
const symbol = getSymbolAtLocation(node);
|
||||
return symbol && getDeclaredTypeOfSymbol(symbol);
|
||||
case SyntaxKind.JSDocTupleType:
|
||||
return getTypeFromJSDocTupleType(<JSDocTupleType>node);
|
||||
case SyntaxKind.JSDocVariadicType:
|
||||
return getTypeFromJSDocVariadicType(<JSDocVariadicType>node);
|
||||
default:
|
||||
return unknownType;
|
||||
}
|
||||
@@ -6957,7 +7147,6 @@ namespace ts {
|
||||
|
||||
if (node.parserContextFlags & ParserContextFlags.Await) {
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.CaptureArguments;
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.LexicalArguments;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7093,18 +7282,25 @@ namespace ts {
|
||||
return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (<InterfaceType>getDeclaredTypeOfSymbol(symbol)).thisType;
|
||||
}
|
||||
|
||||
// If this is a function in a JS file, it might be a class method. Check if it's the RHS
|
||||
// of a x.prototype.y = function [name]() { .... }
|
||||
if (isInJavaScriptFile(node) && container.kind === SyntaxKind.FunctionExpression) {
|
||||
if (getSpecialPropertyAssignmentKind(container.parent) === SpecialPropertyAssignmentKind.PrototypeProperty) {
|
||||
// Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container')
|
||||
const className = (((container.parent as BinaryExpression) // x.protoype.y = f
|
||||
.left as PropertyAccessExpression) // x.prototype.y
|
||||
.expression as PropertyAccessExpression) // x.prototype
|
||||
.expression; // x
|
||||
const classSymbol = checkExpression(className).symbol;
|
||||
if (classSymbol && classSymbol.members && (classSymbol.flags & SymbolFlags.Function)) {
|
||||
return getInferredClassType(classSymbol);
|
||||
if (isInJavaScriptFile(node)) {
|
||||
const type = getTypeForThisExpressionFromJSDoc(container);
|
||||
if (type && type !== unknownType) {
|
||||
return type;
|
||||
}
|
||||
|
||||
// If this is a function in a JS file, it might be a class method. Check if it's the RHS
|
||||
// of a x.prototype.y = function [name]() { .... }
|
||||
if (container.kind === SyntaxKind.FunctionExpression) {
|
||||
if (getSpecialPropertyAssignmentKind(container.parent) === SpecialPropertyAssignmentKind.PrototypeProperty) {
|
||||
// Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container')
|
||||
const className = (((container.parent as BinaryExpression) // x.protoype.y = f
|
||||
.left as PropertyAccessExpression) // x.prototype.y
|
||||
.expression as PropertyAccessExpression) // x.prototype
|
||||
.expression; // x
|
||||
const classSymbol = checkExpression(className).symbol;
|
||||
if (classSymbol && classSymbol.members && (classSymbol.flags & SymbolFlags.Function)) {
|
||||
return getInferredClassType(classSymbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7112,6 +7308,16 @@ namespace ts {
|
||||
return anyType;
|
||||
}
|
||||
|
||||
function getTypeForThisExpressionFromJSDoc(node: Node) {
|
||||
const typeTag = getJSDocTypeTag(node);
|
||||
if (typeTag && typeTag.typeExpression.type.kind === SyntaxKind.JSDocFunctionType) {
|
||||
const jsDocFunctionType = <JSDocFunctionType>typeTag.typeExpression.type;
|
||||
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === SyntaxKind.JSDocThisType) {
|
||||
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean {
|
||||
for (let n = node; n && n !== constructorDecl; n = n.parent) {
|
||||
if (n.kind === SyntaxKind.Parameter) {
|
||||
@@ -7172,6 +7378,71 @@ namespace ts {
|
||||
|
||||
getNodeLinks(node).flags |= nodeCheckFlag;
|
||||
|
||||
// Due to how we emit async functions, we need to specialize the emit for an async method that contains a `super` reference.
|
||||
// This is due to the fact that we emit the body of an async function inside of a generator function. As generator
|
||||
// functions cannot reference `super`, we emit a helper inside of the method body, but outside of the generator. This helper
|
||||
// uses an arrow function, which is permitted to reference `super`.
|
||||
//
|
||||
// There are two primary ways we can access `super` from within an async method. The first is getting the value of a property
|
||||
// or indexed access on super, either as part of a right-hand-side expression or call expression. The second is when setting the value
|
||||
// of a property or indexed access, either as part of an assignment expression or destructuring assignment.
|
||||
//
|
||||
// The simplest case is reading a value, in which case we will emit something like the following:
|
||||
//
|
||||
// // ts
|
||||
// ...
|
||||
// async asyncMethod() {
|
||||
// let x = await super.asyncMethod();
|
||||
// return x;
|
||||
// }
|
||||
// ...
|
||||
//
|
||||
// // js
|
||||
// ...
|
||||
// asyncMethod() {
|
||||
// const _super = name => super[name];
|
||||
// return __awaiter(this, arguments, Promise, function *() {
|
||||
// let x = yield _super("asyncMethod").call(this);
|
||||
// return x;
|
||||
// });
|
||||
// }
|
||||
// ...
|
||||
//
|
||||
// The more complex case is when we wish to assign a value, especially as part of a destructuring assignment. As both cases
|
||||
// are legal in ES6, but also likely less frequent, we emit the same more complex helper for both scenarios:
|
||||
//
|
||||
// // ts
|
||||
// ...
|
||||
// async asyncMethod(ar: Promise<any[]>) {
|
||||
// [super.a, super.b] = await ar;
|
||||
// }
|
||||
// ...
|
||||
//
|
||||
// // js
|
||||
// ...
|
||||
// asyncMethod(ar) {
|
||||
// const _super = (function (geti, seti) {
|
||||
// const cache = Object.create(null);
|
||||
// return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
|
||||
// })(name => super[name], (name, value) => super[name] = value);
|
||||
// return __awaiter(this, arguments, Promise, function *() {
|
||||
// [_super("a").value, _super("b").value] = yield ar;
|
||||
// });
|
||||
// }
|
||||
// ...
|
||||
//
|
||||
// This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set.
|
||||
// This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment
|
||||
// while a property access can.
|
||||
if (container.kind === SyntaxKind.MethodDeclaration && container.flags & NodeFlags.Async) {
|
||||
if (isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) {
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuperBinding;
|
||||
}
|
||||
else {
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuper;
|
||||
}
|
||||
}
|
||||
|
||||
if (needToCaptureLexicalThis) {
|
||||
// call expressions are allowed only in constructors so they should always capture correct 'this'
|
||||
// super property access expressions can also appear in arrow functions -
|
||||
@@ -9919,7 +10190,8 @@ namespace ts {
|
||||
if (declaration &&
|
||||
declaration.kind !== SyntaxKind.Constructor &&
|
||||
declaration.kind !== SyntaxKind.ConstructSignature &&
|
||||
declaration.kind !== SyntaxKind.ConstructorType) {
|
||||
declaration.kind !== SyntaxKind.ConstructorType &&
|
||||
!isJSDocConstructSignature(declaration)) {
|
||||
|
||||
// When resolved signature is a call signature (and not a construct signature) the result type is any, unless
|
||||
// the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations
|
||||
@@ -10039,6 +10311,13 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getReturnTypeFromJSDocComment(func: SignatureDeclaration | FunctionDeclaration): Type {
|
||||
const returnTag = getJSDocReturnTag(func);
|
||||
if (returnTag) {
|
||||
return getTypeFromTypeNode(returnTag.typeExpression.type);
|
||||
}
|
||||
}
|
||||
|
||||
function createPromiseType(promisedType: Type): Type {
|
||||
// creates a `Promise<T>` type where `T` is the promisedType argument
|
||||
const globalPromiseType = getGlobalPromiseType();
|
||||
@@ -10189,7 +10468,8 @@ namespace ts {
|
||||
|
||||
/*
|
||||
*TypeScript Specification 1.0 (6.3) - July 2014
|
||||
* An explicitly typed function whose return type isn't the Void or the Any type
|
||||
* An explicitly typed function whose return type isn't the Void type,
|
||||
* the Any type, or a union type containing the Void or Any type as a constituent
|
||||
* must have at least one return statement somewhere in its body.
|
||||
* An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
* @param returnType - return type of the function, can be undefined if return type is not explicitly specified
|
||||
@@ -10200,7 +10480,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
|
||||
if (returnType === voidType || isTypeAny(returnType)) {
|
||||
if (returnType === voidType || isTypeAny(returnType) || (returnType && (returnType.flags & TypeFlags.Union) && someConstituentTypeHasKind(returnType, TypeFlags.Any | TypeFlags.Void))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10249,11 +10529,6 @@ namespace ts {
|
||||
return anyFunctionType;
|
||||
}
|
||||
|
||||
const isAsync = isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
emitAwaiter = true;
|
||||
}
|
||||
|
||||
const links = getNodeLinks(node);
|
||||
const type = getTypeOfSymbol(node.symbol);
|
||||
const contextSensitive = isContextSensitive(node);
|
||||
@@ -10302,10 +10577,6 @@ namespace ts {
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
|
||||
const isAsync = isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
emitAwaiter = true;
|
||||
}
|
||||
|
||||
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
|
||||
if (!node.asteriskToken) {
|
||||
// return is not necessary in the body of generators
|
||||
@@ -12442,11 +12713,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
emitDecorate = true;
|
||||
if (node.kind === SyntaxKind.Parameter) {
|
||||
emitParam = true;
|
||||
}
|
||||
|
||||
forEach(node.decorators, checkDecorator);
|
||||
}
|
||||
|
||||
@@ -12464,9 +12730,6 @@ namespace ts {
|
||||
checkDecorators(node);
|
||||
checkSignatureDeclaration(node);
|
||||
const isAsync = isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
emitAwaiter = true;
|
||||
}
|
||||
|
||||
// Do not use hasDynamicName here, because that returns false for well known symbols.
|
||||
// We want to perform checkComputedPropertyName for all computed properties, including
|
||||
@@ -13597,7 +13860,6 @@ namespace ts {
|
||||
|
||||
const baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
emitExtends = emitExtends || !isInAmbientContext(node);
|
||||
const baseTypes = getBaseTypes(type);
|
||||
if (baseTypes.length && produceDiagnostics) {
|
||||
const baseType = baseTypes[0];
|
||||
@@ -14228,10 +14490,10 @@ namespace ts {
|
||||
if (isAmbientExternalModule) {
|
||||
if (isExternalModuleAugmentation(node)) {
|
||||
// body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module)
|
||||
// otherwise we'll be swamped in cascading errors.
|
||||
// otherwise we'll be swamped in cascading errors.
|
||||
// We can detect if augmentation was applied using following rules:
|
||||
// - augmentation for a global scope is always applied
|
||||
// - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
|
||||
// - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
|
||||
const checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & SymbolFlags.Merged);
|
||||
if (checkBody) {
|
||||
// body of ambient external module is always a module block
|
||||
@@ -14499,7 +14761,7 @@ namespace ts {
|
||||
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
|
||||
const symbol = resolveName(exportedName, exportedName.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias,
|
||||
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
if (symbol && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0]))) {
|
||||
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
||||
error(exportedName, Diagnostics.Cannot_re_export_name_that_is_not_defined_in_the_module);
|
||||
}
|
||||
else {
|
||||
@@ -14777,10 +15039,6 @@ namespace ts {
|
||||
// Grammar checking
|
||||
checkGrammarSourceFile(node);
|
||||
|
||||
emitExtends = false;
|
||||
emitDecorate = false;
|
||||
emitParam = false;
|
||||
emitAwaiter = false;
|
||||
potentialThisCollisions.length = 0;
|
||||
|
||||
deferredNodes = [];
|
||||
@@ -14797,26 +15055,6 @@ namespace ts {
|
||||
potentialThisCollisions.length = 0;
|
||||
}
|
||||
|
||||
if (emitExtends) {
|
||||
links.flags |= NodeCheckFlags.EmitExtends;
|
||||
}
|
||||
|
||||
if (emitDecorate) {
|
||||
links.flags |= NodeCheckFlags.EmitDecorate;
|
||||
}
|
||||
|
||||
if (emitParam) {
|
||||
links.flags |= NodeCheckFlags.EmitParam;
|
||||
}
|
||||
|
||||
if (emitAwaiter) {
|
||||
links.flags |= NodeCheckFlags.EmitAwaiter;
|
||||
}
|
||||
|
||||
if (emitGenerator || (emitAwaiter && languageVersion < ScriptTarget.ES6)) {
|
||||
links.flags |= NodeCheckFlags.EmitGenerator;
|
||||
}
|
||||
|
||||
links.flags |= NodeCheckFlags.TypeChecked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,8 +493,8 @@ namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}): ParsedCommandLine {
|
||||
const { options: optionsFromJsonConfigFile, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath);
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string): ParsedCommandLine {
|
||||
const { options: optionsFromJsonConfigFile, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath, configFileName);
|
||||
|
||||
const options = extend(existingOptions, optionsFromJsonConfigFile);
|
||||
return {
|
||||
@@ -523,7 +523,7 @@ namespace ts {
|
||||
for (const extension of supportedExtensions) {
|
||||
const filesInDirWithExtension = host.readDirectory(basePath, extension, exclude);
|
||||
for (const fileName of filesInDirWithExtension) {
|
||||
// .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension,
|
||||
// .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension,
|
||||
// lets pick them when its turn comes up
|
||||
if (extension === ".ts" && fileExtensionIs(fileName, ".d.ts")) {
|
||||
continue;
|
||||
@@ -547,10 +547,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { options: CompilerOptions, errors: Diagnostic[] } {
|
||||
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions, errors: Diagnostic[] } {
|
||||
const options: CompilerOptions = {};
|
||||
const errors: Diagnostic[] = [];
|
||||
|
||||
if (configFileName && getBaseFileName(configFileName) === "jsconfig.json") {
|
||||
options.module = ModuleKind.CommonJS;
|
||||
options.allowJs = true;
|
||||
}
|
||||
|
||||
if (!jsonOptions) {
|
||||
return { options, errors };
|
||||
}
|
||||
|
||||
+78
-35
@@ -319,17 +319,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
};`;
|
||||
|
||||
const awaiterHelper = `
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};`;
|
||||
|
||||
@@ -1493,11 +1488,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitExpressionIdentifier(node: Identifier) {
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalArguments) {
|
||||
write("_arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
const container = resolver.getReferencedExportContainer(node);
|
||||
if (container) {
|
||||
if (container.kind === SyntaxKind.SourceFile) {
|
||||
@@ -2127,6 +2117,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return;
|
||||
}
|
||||
|
||||
if (languageVersion === ScriptTarget.ES6 &&
|
||||
node.expression.kind === SyntaxKind.SuperKeyword &&
|
||||
isInAsyncMethodWithSuperInES6(node)) {
|
||||
const name = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
|
||||
name.text = node.name.text;
|
||||
emitSuperAccessInAsyncMethod(node.expression, name);
|
||||
return;
|
||||
}
|
||||
|
||||
emit(node.expression);
|
||||
const indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
|
||||
|
||||
@@ -2212,6 +2211,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (tryEmitConstantValue(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (languageVersion === ScriptTarget.ES6 &&
|
||||
node.expression.kind === SyntaxKind.SuperKeyword &&
|
||||
isInAsyncMethodWithSuperInES6(node)) {
|
||||
emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression);
|
||||
return;
|
||||
}
|
||||
|
||||
emit(node.expression);
|
||||
write("[");
|
||||
emit(node.argumentExpression);
|
||||
@@ -2287,23 +2294,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(")");
|
||||
}
|
||||
|
||||
function isInAsyncMethodWithSuperInES6(node: Node) {
|
||||
if (languageVersion === ScriptTarget.ES6) {
|
||||
const container = getSuperContainer(node, /*includeFunctions*/ false);
|
||||
if (container && resolver.getNodeCheckFlags(container) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitSuperAccessInAsyncMethod(superNode: Node, argumentExpression: Expression) {
|
||||
const container = getSuperContainer(superNode, /*includeFunctions*/ false);
|
||||
const isSuperBinding = resolver.getNodeCheckFlags(container) & NodeCheckFlags.AsyncMethodWithSuperBinding;
|
||||
write("_super(");
|
||||
emit(argumentExpression);
|
||||
write(isSuperBinding ? ").value" : ")");
|
||||
}
|
||||
|
||||
function emitCallExpression(node: CallExpression) {
|
||||
if (languageVersion < ScriptTarget.ES6 && hasSpreadElement(node.arguments)) {
|
||||
emitCallWithSpread(node);
|
||||
return;
|
||||
}
|
||||
|
||||
const expression = node.expression;
|
||||
let superCall = false;
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
emitSuper(node.expression);
|
||||
let isAsyncMethodWithSuper = false;
|
||||
if (expression.kind === SyntaxKind.SuperKeyword) {
|
||||
emitSuper(expression);
|
||||
superCall = true;
|
||||
}
|
||||
else {
|
||||
emit(node.expression);
|
||||
superCall = node.expression.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.expression).expression.kind === SyntaxKind.SuperKeyword;
|
||||
superCall = isSuperPropertyOrElementAccess(expression);
|
||||
isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node);
|
||||
emit(expression);
|
||||
}
|
||||
if (superCall && languageVersion < ScriptTarget.ES6) {
|
||||
|
||||
if (superCall && (languageVersion < ScriptTarget.ES6 || isAsyncMethodWithSuper)) {
|
||||
write(".call(");
|
||||
emitThis(node.expression);
|
||||
emitThis(expression);
|
||||
if (node.arguments.length) {
|
||||
write(", ");
|
||||
emitCommaList(node.arguments);
|
||||
@@ -4479,6 +4510,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(" {");
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
writeLines(`
|
||||
const _super = (function (geti, seti) {
|
||||
const cache = Object.create(null);
|
||||
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
|
||||
})(name => super[name], (name, value) => super[name] = value);`);
|
||||
writeLine();
|
||||
}
|
||||
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) {
|
||||
write(`const _super = name => super[name];`);
|
||||
writeLine();
|
||||
}
|
||||
|
||||
write("return");
|
||||
}
|
||||
|
||||
@@ -4498,12 +4543,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
// Emit the call to __awaiter.
|
||||
if (hasLexicalArguments) {
|
||||
write(", function* (_arguments)");
|
||||
}
|
||||
else {
|
||||
write(", function* ()");
|
||||
}
|
||||
write(", function* ()");
|
||||
|
||||
// Emit the signature and body for the inner generator function.
|
||||
emitFunctionBody(node);
|
||||
@@ -6109,6 +6149,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (contains(externalImports, node)) {
|
||||
const isExportedImport = node.kind === SyntaxKind.ImportEqualsDeclaration && (node.flags & NodeFlags.Export) !== 0;
|
||||
const namespaceDeclaration = getNamespaceDeclarationNode(node);
|
||||
const varOrConst = (languageVersion <= ScriptTarget.ES5) ? "var " : "const ";
|
||||
|
||||
if (modulekind !== ModuleKind.AMD) {
|
||||
emitLeadingComments(node);
|
||||
@@ -6116,7 +6157,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (namespaceDeclaration && !isDefaultImport(node)) {
|
||||
// import x = require("foo")
|
||||
// import * as x from "foo"
|
||||
if (!isExportedImport) write("var ");
|
||||
if (!isExportedImport) {
|
||||
write(varOrConst);
|
||||
};
|
||||
emitModuleMemberName(namespaceDeclaration);
|
||||
write(" = ");
|
||||
}
|
||||
@@ -6128,7 +6171,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// import d, { x, y } from "foo"
|
||||
const isNakedImport = SyntaxKind.ImportDeclaration && !(<ImportDeclaration>node).importClause;
|
||||
if (!isNakedImport) {
|
||||
write("var ");
|
||||
write(varOrConst);
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>node));
|
||||
write(" = ");
|
||||
}
|
||||
@@ -6155,7 +6198,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else if (namespaceDeclaration && isDefaultImport(node)) {
|
||||
// import d, * as x from "foo"
|
||||
write("var ");
|
||||
write(varOrConst);
|
||||
emitModuleMemberName(namespaceDeclaration);
|
||||
write(" = ");
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>node));
|
||||
@@ -7358,12 +7401,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (!compilerOptions.noEmitHelpers) {
|
||||
// Only Emit __extends function when target ES5.
|
||||
// For target ES6 and above, we can emit classDeclaration as is.
|
||||
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) {
|
||||
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && node.flags & NodeFlags.HasClassExtends)) {
|
||||
writeLines(extendsHelper);
|
||||
extendsEmitted = true;
|
||||
}
|
||||
|
||||
if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) {
|
||||
if (!decorateEmitted && node.flags & NodeFlags.HasDecorators) {
|
||||
writeLines(decorateHelper);
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
writeLines(metadataHelper);
|
||||
@@ -7371,12 +7414,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
decorateEmitted = true;
|
||||
}
|
||||
|
||||
if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) {
|
||||
if (!paramEmitted && node.flags & NodeFlags.HasParamDecorators) {
|
||||
writeLines(paramHelper);
|
||||
paramEmitted = true;
|
||||
}
|
||||
|
||||
if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitAwaiter) {
|
||||
if (!awaiterEmitted && node.flags & NodeFlags.HasAsyncFunctions) {
|
||||
writeLines(awaiterHelper);
|
||||
awaiterEmitted = true;
|
||||
}
|
||||
|
||||
+135
-150
@@ -546,7 +546,7 @@ namespace ts {
|
||||
|
||||
function getLanguageVariant(fileName: string) {
|
||||
// .tsx and .jsx files are treated as jsx language variant.
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") || fileExtensionIs(fileName, ".js") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
}
|
||||
|
||||
function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, isJavaScriptFile: boolean, _syntaxCursor: IncrementalParser.SyntaxCursor) {
|
||||
@@ -611,44 +611,24 @@ namespace ts {
|
||||
fixupParentReferences(sourceFile);
|
||||
}
|
||||
|
||||
// If this is a javascript file, proactively see if we can get JSDoc comments for
|
||||
// relevant nodes in the file. We'll use these to provide typing informaion if they're
|
||||
// available.
|
||||
if (isSourceFileJavaScript(sourceFile)) {
|
||||
addJSDocComments();
|
||||
}
|
||||
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
function addJSDocComments() {
|
||||
forEachChild(sourceFile, visit);
|
||||
return;
|
||||
|
||||
function visit(node: Node) {
|
||||
// Add additional cases as necessary depending on how we see JSDoc comments used
|
||||
// in the wild.
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
addJSDocComment(node);
|
||||
}
|
||||
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
}
|
||||
|
||||
function addJSDocComment(node: Node) {
|
||||
const comments = getLeadingCommentRangesOfNode(node, sourceFile);
|
||||
if (comments) {
|
||||
for (const comment of comments) {
|
||||
const jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
|
||||
if (jsDocComment) {
|
||||
node.jsDocComment = jsDocComment;
|
||||
function addJSDocComment<T extends Node>(node: T): T {
|
||||
if (contextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
const comments = getLeadingCommentRangesOfNode(node, sourceFile);
|
||||
if (comments) {
|
||||
for (const comment of comments) {
|
||||
const jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
|
||||
if (jsDocComment) {
|
||||
node.jsDocComment = jsDocComment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
export function fixupParentReferences(sourceFile: Node) {
|
||||
@@ -2067,7 +2047,8 @@ namespace ts {
|
||||
// contexts. In addition, parameter initializers are semantically disallowed in
|
||||
// overload signatures. So parameter initializers are transitively disallowed in
|
||||
// ambient contexts.
|
||||
return finishNode(node);
|
||||
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseBindingElementInitializer(inParameter: boolean) {
|
||||
@@ -4773,7 +4754,7 @@ namespace ts {
|
||||
setModifiers(node, modifiers);
|
||||
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
|
||||
parseSemicolon();
|
||||
return finishNode(node);
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseFunctionDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): FunctionDeclaration {
|
||||
@@ -4787,7 +4768,7 @@ namespace ts {
|
||||
const isAsync = !!(node.flags & NodeFlags.Async);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, Diagnostics.or_expected);
|
||||
return finishNode(node);
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseConstructorDeclaration(pos: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ConstructorDeclaration {
|
||||
@@ -5624,23 +5605,19 @@ namespace ts {
|
||||
|
||||
export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) {
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined);
|
||||
const jsDocTypeExpression = parseJSDocTypeExpression(start, length);
|
||||
scanner.setText(content, start, length);
|
||||
token = scanner.scan();
|
||||
const jsDocTypeExpression = parseJSDocTypeExpression();
|
||||
const diagnostics = parseDiagnostics;
|
||||
clearState();
|
||||
|
||||
return jsDocTypeExpression ? { jsDocTypeExpression, diagnostics } : undefined;
|
||||
}
|
||||
|
||||
// Parses out a JSDoc type expression. The starting position should be right at the open
|
||||
// curly in the type expression. Returns 'undefined' if it encounters any errors while parsing.
|
||||
// Parses out a JSDoc type expression.
|
||||
/* @internal */
|
||||
export function parseJSDocTypeExpression(start: number, length: number): JSDocTypeExpression {
|
||||
scanner.setText(sourceText, start, length);
|
||||
|
||||
// Prime the first token for us to start processing.
|
||||
token = nextToken();
|
||||
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression);
|
||||
export function parseJSDocTypeExpression(): JSDocTypeExpression {
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos());
|
||||
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
result.type = parseJSDocTopLevelType();
|
||||
@@ -5938,7 +5915,8 @@ namespace ts {
|
||||
|
||||
export function parseIsolatedJSDocComment(content: string, start: number, length: number) {
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined);
|
||||
const jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length);
|
||||
sourceFile = <SourceFile>{ languageVariant: LanguageVariant.Standard, text: content };
|
||||
const jsDocComment = parseJSDocCommentWorker(start, length);
|
||||
const diagnostics = parseDiagnostics;
|
||||
clearState();
|
||||
|
||||
@@ -5946,12 +5924,19 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function parseJSDocComment(parent: Node, start: number, length: number): JSDocComment {
|
||||
const saveToken = token;
|
||||
const saveParseDiagnosticsLength = parseDiagnostics.length;
|
||||
const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
|
||||
|
||||
const comment = parseJSDocCommentWorker(start, length);
|
||||
if (comment) {
|
||||
fixupParentReferences(comment);
|
||||
comment.parent = parent;
|
||||
}
|
||||
|
||||
token = saveToken;
|
||||
parseDiagnostics.length = saveParseDiagnosticsLength;
|
||||
parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
@@ -5966,69 +5951,69 @@ namespace ts {
|
||||
Debug.assert(end <= content.length);
|
||||
|
||||
let tags: NodeArray<JSDocTag>;
|
||||
let pos: number;
|
||||
|
||||
// NOTE(cyrusn): This is essentially a handwritten scanner for JSDocComments. I
|
||||
// considered using an actual Scanner, but this would complicate things. The
|
||||
// scanner would need to know it was in a Doc Comment. Otherwise, it would then
|
||||
// produce comments *inside* the doc comment. In the end it was just easier to
|
||||
// write a simple scanner rather than go that route.
|
||||
if (length >= "/** */".length) {
|
||||
if (content.charCodeAt(start) === CharacterCodes.slash &&
|
||||
content.charCodeAt(start + 1) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 2) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 3) !== CharacterCodes.asterisk) {
|
||||
let result: JSDocComment;
|
||||
|
||||
// Check for /** (JSDoc opening part)
|
||||
if (content.charCodeAt(start) === CharacterCodes.slash &&
|
||||
content.charCodeAt(start + 1) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 2) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 3) !== CharacterCodes.asterisk) {
|
||||
|
||||
|
||||
// + 3 for leading /**, - 5 in total for /** */
|
||||
scanner.scanRange(start + 3, length - 5, () => {
|
||||
// Initially we can parse out a tag. We also have seen a starting asterisk.
|
||||
// This is so that /** * @type */ doesn't parse.
|
||||
let canParseTag = true;
|
||||
let seenAsterisk = true;
|
||||
|
||||
for (pos = start + "/**".length; pos < end; ) {
|
||||
const ch = content.charCodeAt(pos);
|
||||
pos++;
|
||||
nextJSDocToken();
|
||||
while (token !== SyntaxKind.EndOfFileToken) {
|
||||
switch (token) {
|
||||
case SyntaxKind.AtToken:
|
||||
if (canParseTag) {
|
||||
parseTag();
|
||||
}
|
||||
// This will take us to the end of the line, so it's OK to parse a tag on the next pass through the loop
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
|
||||
if (ch === CharacterCodes.at && canParseTag) {
|
||||
parseTag();
|
||||
case SyntaxKind.NewLineTrivia:
|
||||
// After a line break, we can parse a tag, and we haven't seen an asterisk on the next line yet
|
||||
canParseTag = true;
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
|
||||
// Once we parse out a tag, we cannot keep parsing out tags on this line.
|
||||
canParseTag = false;
|
||||
continue;
|
||||
}
|
||||
case SyntaxKind.AsteriskToken:
|
||||
if (seenAsterisk) {
|
||||
// If we've already seen an asterisk, then we can no longer parse a tag on this line
|
||||
canParseTag = false;
|
||||
}
|
||||
// Ignore the first asterisk on a line
|
||||
seenAsterisk = true;
|
||||
break;
|
||||
|
||||
if (isLineBreak(ch)) {
|
||||
// After a line break, we can parse a tag, and we haven't seen as asterisk
|
||||
// on the next line yet.
|
||||
canParseTag = true;
|
||||
seenAsterisk = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isWhiteSpace(ch)) {
|
||||
// Whitespace doesn't affect any of our parsing.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore the first asterisk on a line.
|
||||
if (ch === CharacterCodes.asterisk) {
|
||||
if (seenAsterisk) {
|
||||
// If we've already seen an asterisk, then we can no longer parse a tag
|
||||
// on this line.
|
||||
case SyntaxKind.Identifier:
|
||||
// Anything else is doc comment text. We can't do anything with it. Because it
|
||||
// wasn't a tag, we can no longer parse a tag on this line until we hit the next
|
||||
// line break.
|
||||
canParseTag = false;
|
||||
}
|
||||
seenAsterisk = true;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case SyntaxKind.EndOfFileToken:
|
||||
break;
|
||||
}
|
||||
|
||||
// Anything else is doc comment text. We can't do anything with it. Because it
|
||||
// wasn't a tag, we can no longer parse a tag on this line until we hit the next
|
||||
// line break.
|
||||
canParseTag = false;
|
||||
nextJSDocToken();
|
||||
}
|
||||
}
|
||||
|
||||
result = createJSDocComment();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return createJSDocComment();
|
||||
return result;
|
||||
|
||||
function createJSDocComment(): JSDocComment {
|
||||
if (!tags) {
|
||||
@@ -6041,17 +6026,18 @@ namespace ts {
|
||||
}
|
||||
|
||||
function skipWhitespace(): void {
|
||||
while (pos < end && isWhiteSpace(content.charCodeAt(pos))) {
|
||||
pos++;
|
||||
while (token === SyntaxKind.WhitespaceTrivia || token === SyntaxKind.NewLineTrivia) {
|
||||
nextJSDocToken();
|
||||
}
|
||||
}
|
||||
|
||||
function parseTag(): void {
|
||||
Debug.assert(content.charCodeAt(pos - 1) === CharacterCodes.at);
|
||||
const atToken = createNode(SyntaxKind.AtToken, pos - 1);
|
||||
atToken.end = pos;
|
||||
Debug.assert(token === SyntaxKind.AtToken);
|
||||
const atToken = createNode(SyntaxKind.AtToken, scanner.getTokenPos());
|
||||
atToken.end = scanner.getTextPos();
|
||||
nextJSDocToken();
|
||||
|
||||
const tagName = scanIdentifier();
|
||||
const tagName = parseJSDocIdentifier();
|
||||
if (!tagName) {
|
||||
return;
|
||||
}
|
||||
@@ -6082,7 +6068,7 @@ namespace ts {
|
||||
const result = <JSDocTag>createNode(SyntaxKind.JSDocTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function addTag(tag: JSDocTag): void {
|
||||
@@ -6098,14 +6084,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function tryParseTypeExpression(): JSDocTypeExpression {
|
||||
skipWhitespace();
|
||||
|
||||
if (content.charCodeAt(pos) !== CharacterCodes.openBrace) {
|
||||
if (token !== SyntaxKind.OpenBraceToken) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const typeExpression = parseJSDocTypeExpression(pos, end - pos);
|
||||
pos = typeExpression.end;
|
||||
const typeExpression = parseJSDocTypeExpression();
|
||||
return typeExpression;
|
||||
}
|
||||
|
||||
@@ -6115,18 +6098,25 @@ namespace ts {
|
||||
skipWhitespace();
|
||||
let name: Identifier;
|
||||
let isBracketed: boolean;
|
||||
if (content.charCodeAt(pos) === CharacterCodes.openBracket) {
|
||||
pos++;
|
||||
skipWhitespace();
|
||||
name = scanIdentifier();
|
||||
// Looking for something like '[foo]' or 'foo'
|
||||
if (parseOptionalToken(SyntaxKind.OpenBracketToken)) {
|
||||
name = parseJSDocIdentifier();
|
||||
isBracketed = true;
|
||||
|
||||
// May have an optional default, e.g. '[foo = 42]'
|
||||
if (parseOptionalToken(SyntaxKind.EqualsToken)) {
|
||||
parseExpression();
|
||||
}
|
||||
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
}
|
||||
else {
|
||||
name = scanIdentifier();
|
||||
else if (token === SyntaxKind.Identifier) {
|
||||
name = parseJSDocIdentifier();
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
parseErrorAtPosition(pos, 0, Diagnostics.Identifier_expected);
|
||||
parseErrorAtPosition(scanner.getStartPos(), 0, Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let preName: Identifier, postName: Identifier;
|
||||
@@ -6148,95 +6138,90 @@ namespace ts {
|
||||
result.typeExpression = typeExpression;
|
||||
result.postParameterName = postName;
|
||||
result.isBracketed = isBracketed;
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function handleReturnTag(atToken: Node, tagName: Identifier): JSDocReturnTag {
|
||||
if (forEach(tags, t => t.kind === SyntaxKind.JSDocReturnTag)) {
|
||||
parseErrorAtPosition(tagName.pos, pos - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
}
|
||||
|
||||
const result = <JSDocReturnTag>createNode(SyntaxKind.JSDocReturnTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeExpression = tryParseTypeExpression();
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function handleTypeTag(atToken: Node, tagName: Identifier): JSDocTypeTag {
|
||||
if (forEach(tags, t => t.kind === SyntaxKind.JSDocTypeTag)) {
|
||||
parseErrorAtPosition(tagName.pos, pos - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
}
|
||||
|
||||
const result = <JSDocTypeTag>createNode(SyntaxKind.JSDocTypeTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeExpression = tryParseTypeExpression();
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function handleTemplateTag(atToken: Node, tagName: Identifier): JSDocTemplateTag {
|
||||
if (forEach(tags, t => t.kind === SyntaxKind.JSDocTemplateTag)) {
|
||||
parseErrorAtPosition(tagName.pos, pos - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
}
|
||||
|
||||
// Type parameter list looks like '@template T,U,V'
|
||||
const typeParameters = <NodeArray<TypeParameterDeclaration>>[];
|
||||
typeParameters.pos = pos;
|
||||
typeParameters.pos = scanner.getStartPos();
|
||||
|
||||
while (true) {
|
||||
skipWhitespace();
|
||||
|
||||
const startPos = pos;
|
||||
const name = scanIdentifier();
|
||||
const name = parseJSDocIdentifier();
|
||||
if (!name) {
|
||||
parseErrorAtPosition(startPos, 0, Diagnostics.Identifier_expected);
|
||||
parseErrorAtPosition(scanner.getStartPos(), 0, Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const typeParameter = <TypeParameterDeclaration>createNode(SyntaxKind.TypeParameter, name.pos);
|
||||
typeParameter.name = name;
|
||||
finishNode(typeParameter, pos);
|
||||
finishNode(typeParameter);
|
||||
|
||||
typeParameters.push(typeParameter);
|
||||
|
||||
skipWhitespace();
|
||||
if (content.charCodeAt(pos) !== CharacterCodes.comma) {
|
||||
if (token === SyntaxKind.CommaToken) {
|
||||
nextJSDocToken();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
typeParameters.end = pos;
|
||||
|
||||
const result = <JSDocTemplateTag>createNode(SyntaxKind.JSDocTemplateTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeParameters = typeParameters;
|
||||
return finishNode(result, pos);
|
||||
finishNode(result);
|
||||
typeParameters.end = result.end;
|
||||
return result;
|
||||
}
|
||||
|
||||
function scanIdentifier(): Identifier {
|
||||
const startPos = pos;
|
||||
for (; pos < end; pos++) {
|
||||
const ch = content.charCodeAt(pos);
|
||||
if (pos === startPos && isIdentifierStart(ch, ScriptTarget.Latest)) {
|
||||
continue;
|
||||
}
|
||||
else if (pos > startPos && isIdentifierPart(ch, ScriptTarget.Latest)) {
|
||||
continue;
|
||||
}
|
||||
function nextJSDocToken(): SyntaxKind {
|
||||
return token = scanner.scanJSDocToken();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (startPos === pos) {
|
||||
function parseJSDocIdentifier(): Identifier {
|
||||
if (token !== SyntaxKind.Identifier) {
|
||||
parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result = <Identifier>createNode(SyntaxKind.Identifier, startPos);
|
||||
result.text = content.substring(startPos, pos);
|
||||
return finishNode(result, pos);
|
||||
const pos = scanner.getTokenPos();
|
||||
const end = scanner.getTextPos();
|
||||
const result = <Identifier>createNode(SyntaxKind.Identifier, pos);
|
||||
result.text = content.substring(pos, end);
|
||||
finishNode(result, end);
|
||||
|
||||
nextJSDocToken();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ts {
|
||||
|
||||
const emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.8.0";
|
||||
export const version = "1.9.0";
|
||||
|
||||
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string {
|
||||
let fileName = "tsconfig.json";
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace ts {
|
||||
scanJsxIdentifier(): SyntaxKind;
|
||||
reScanJsxToken(): SyntaxKind;
|
||||
scanJsxToken(): SyntaxKind;
|
||||
scanJSDocToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
// Sets the text for the scanner to scan. An optional subrange starting point and length
|
||||
// can be provided to have the scanner only scan a portion of the text.
|
||||
@@ -42,6 +43,10 @@ namespace ts {
|
||||
// is returned from this function.
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
|
||||
// Invokes the callback with the scanner set to scan the specified range. When the callback
|
||||
// returns, the scanner is restored to the state it was in before scanRange was called.
|
||||
scanRange<T>(start: number, length: number, callback: () => T): T;
|
||||
|
||||
// Invokes the provided callback. If the callback returns something falsy, then it restores
|
||||
// the scanner to the state it was in immediately prior to invoking the callback. If the
|
||||
// callback returns something truthy, then the scanner state is not rolled back. The result
|
||||
@@ -750,6 +755,7 @@ namespace ts {
|
||||
scanJsxIdentifier,
|
||||
reScanJsxToken,
|
||||
scanJsxToken,
|
||||
scanJSDocToken,
|
||||
scan,
|
||||
setText,
|
||||
setScriptTarget,
|
||||
@@ -758,6 +764,7 @@ namespace ts {
|
||||
setTextPos,
|
||||
tryScan,
|
||||
lookAhead,
|
||||
scanRange,
|
||||
};
|
||||
|
||||
function error(message: DiagnosticMessage, length?: number): void {
|
||||
@@ -1665,6 +1672,60 @@ namespace ts {
|
||||
return token;
|
||||
}
|
||||
|
||||
function scanJSDocToken(): SyntaxKind {
|
||||
if (pos >= end) {
|
||||
return token = SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
startPos = pos;
|
||||
|
||||
// Eat leading whitespace
|
||||
let ch = text.charCodeAt(pos);
|
||||
while (pos < end) {
|
||||
ch = text.charCodeAt(pos);
|
||||
if (isWhiteSpace(ch)) {
|
||||
pos++;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tokenPos = pos;
|
||||
|
||||
switch (ch) {
|
||||
case CharacterCodes.at:
|
||||
return pos += 1, token = SyntaxKind.AtToken;
|
||||
case CharacterCodes.lineFeed:
|
||||
case CharacterCodes.carriageReturn:
|
||||
return pos += 1, token = SyntaxKind.NewLineTrivia;
|
||||
case CharacterCodes.asterisk:
|
||||
return pos += 1, token = SyntaxKind.AsteriskToken;
|
||||
case CharacterCodes.openBrace:
|
||||
return pos += 1, token = SyntaxKind.OpenBraceToken;
|
||||
case CharacterCodes.closeBrace:
|
||||
return pos += 1, token = SyntaxKind.CloseBraceToken;
|
||||
case CharacterCodes.openBracket:
|
||||
return pos += 1, token = SyntaxKind.OpenBracketToken;
|
||||
case CharacterCodes.closeBracket:
|
||||
return pos += 1, token = SyntaxKind.CloseBracketToken;
|
||||
case CharacterCodes.equals:
|
||||
return pos += 1, token = SyntaxKind.EqualsToken;
|
||||
case CharacterCodes.comma:
|
||||
return pos += 1, token = SyntaxKind.CommaToken;
|
||||
}
|
||||
|
||||
if (isIdentifierStart(ch, ScriptTarget.Latest)) {
|
||||
pos++;
|
||||
while (isIdentifierPart(text.charCodeAt(pos), ScriptTarget.Latest) && pos < end) {
|
||||
pos++;
|
||||
}
|
||||
return token = SyntaxKind.Identifier;
|
||||
}
|
||||
else {
|
||||
return pos += 1, token = SyntaxKind.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
function speculationHelper<T>(callback: () => T, isLookahead: boolean): T {
|
||||
const savePos = pos;
|
||||
const saveStartPos = startPos;
|
||||
@@ -1687,6 +1748,33 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function scanRange<T>(start: number, length: number, callback: () => T): T {
|
||||
const saveEnd = end;
|
||||
const savePos = pos;
|
||||
const saveStartPos = startPos;
|
||||
const saveTokenPos = tokenPos;
|
||||
const saveToken = token;
|
||||
const savePrecedingLineBreak = precedingLineBreak;
|
||||
const saveTokenValue = tokenValue;
|
||||
const saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
||||
const saveTokenIsUnterminated = tokenIsUnterminated;
|
||||
|
||||
setText(text, start, length);
|
||||
const result = callback();
|
||||
|
||||
end = saveEnd;
|
||||
pos = savePos;
|
||||
startPos = saveStartPos;
|
||||
tokenPos = saveTokenPos;
|
||||
token = saveToken;
|
||||
precedingLineBreak = savePrecedingLineBreak;
|
||||
tokenValue = saveTokenValue;
|
||||
hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;
|
||||
tokenIsUnterminated = saveTokenIsUnterminated;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function lookAhead<T>(callback: () => T): T {
|
||||
return speculationHelper(callback, /*isLookahead*/ true);
|
||||
}
|
||||
|
||||
+1
-1
@@ -340,7 +340,7 @@ namespace ts {
|
||||
if (sys.watchDirectory && configFileName) {
|
||||
const directory = ts.getDirectoryPath(configFileName);
|
||||
directoryWatcher = sys.watchDirectory(
|
||||
// When the configFileName is just "tsconfig.json", the watched directory should be
|
||||
// When the configFileName is just "tsconfig.json", the watched directory should be
|
||||
// the current direcotry; if there is a given "project" parameter, then the configFileName
|
||||
// is an absolute file name.
|
||||
directory == "" ? "." : directory,
|
||||
|
||||
+20
-16
@@ -312,11 +312,11 @@ namespace ts {
|
||||
// Top-level nodes
|
||||
SourceFile,
|
||||
|
||||
// JSDoc nodes.
|
||||
// JSDoc nodes
|
||||
JSDocTypeExpression,
|
||||
// The * type.
|
||||
// The * type
|
||||
JSDocAllType,
|
||||
// The ? type.
|
||||
// The ? type
|
||||
JSDocUnknownType,
|
||||
JSDocArrayType,
|
||||
JSDocUnionType,
|
||||
@@ -391,11 +391,17 @@ namespace ts {
|
||||
HasImplicitReturn = 1 << 19, // If function implicitly returns on one of codepaths (initialized by binding)
|
||||
HasExplicitReturn = 1 << 20, // If function has explicit reachable return on one of codepaths (initialized by binding)
|
||||
GlobalAugmentation = 1 << 21, // Set if module declaration is an augmentation for the global scope
|
||||
HasClassExtends = 1 << 22, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
|
||||
HasDecorators = 1 << 23, // If the file has decorators (initialized by binding)
|
||||
HasParamDecorators = 1 << 24, // If the file has parameter decorators (initialized by binding)
|
||||
HasAsyncFunctions = 1 << 25, // If the file has async functions (initialized by binding)
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
BlockScoped = Let | Const,
|
||||
|
||||
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn
|
||||
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn,
|
||||
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -998,7 +1004,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.CallExpression)
|
||||
export interface CallExpression extends LeftHandSideExpression {
|
||||
export interface CallExpression extends LeftHandSideExpression, Declaration {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
@@ -1477,6 +1483,8 @@ namespace ts {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
|
||||
|
||||
// @kind(SyntaxKind.JSDocRecordMember)
|
||||
export interface JSDocRecordMember extends PropertySignature {
|
||||
name: Identifier | LiteralExpression;
|
||||
@@ -2047,22 +2055,18 @@ namespace ts {
|
||||
TypeChecked = 0x00000001, // Node has been type checked
|
||||
LexicalThis = 0x00000002, // Lexical 'this' reference
|
||||
CaptureThis = 0x00000004, // Lexical 'this' used in body
|
||||
EmitExtends = 0x00000008, // Emit __extends
|
||||
EmitDecorate = 0x00000010, // Emit __decorate
|
||||
EmitParam = 0x00000020, // Emit __param helper for decorators
|
||||
EmitAwaiter = 0x00000040, // Emit __awaiter
|
||||
EmitGenerator = 0x00000080, // Emit __generator
|
||||
SuperInstance = 0x00000100, // Instance 'super' reference
|
||||
SuperStatic = 0x00000200, // Static 'super' reference
|
||||
ContextChecked = 0x00000400, // Contextual types have been assigned
|
||||
LexicalArguments = 0x00000800,
|
||||
CaptureArguments = 0x00001000, // Lexical 'arguments' used in body (for async functions)
|
||||
AsyncMethodWithSuper = 0x00000800, // An async method that reads a value from a member of 'super'.
|
||||
AsyncMethodWithSuperBinding = 0x00001000, // An async method that assigns a value to a member of 'super'.
|
||||
CaptureArguments = 0x00002000, // Lexical 'arguments' used in body (for async functions)
|
||||
|
||||
// Values for enum members have been computed, and any errors have been reported for them.
|
||||
EnumValuesComputed = 0x00002000,
|
||||
BlockScopedBindingInLoop = 0x00004000,
|
||||
LexicalModuleMergesWithClass = 0x00008000, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
LoopWithBlockScopedBindingCapturedInFunction = 0x00010000, // Loop that contains block scoped variable captured in closure
|
||||
EnumValuesComputed = 0x00004000,
|
||||
BlockScopedBindingInLoop = 0x00008000,
|
||||
LexicalModuleMergesWithClass = 0x00010000, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
LoopWithBlockScopedBindingCapturedInFunction = 0x00020000, // Loop that contains block scoped variable captured in closure
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
+74
-59
@@ -802,8 +802,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an super call\property node returns a closest node where either
|
||||
* - super call\property is legal in the node and not legal in the parent node the node.
|
||||
* Given an super call\property node returns a closest node where either
|
||||
* - super call\property is legal in the node and not legal in the parent node the node.
|
||||
* i.e. super call is legal in constructor but not legal in the class body.
|
||||
* - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher)
|
||||
* - super call\property is definitely illegal in the node (but might be legal in some subnode)
|
||||
@@ -850,6 +850,16 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a node is a property or element access expression for super.
|
||||
*/
|
||||
export function isSuperPropertyOrElementAccess(node: Node) {
|
||||
return (node.kind === SyntaxKind.PropertyAccessExpression
|
||||
|| node.kind === SyntaxKind.ElementAccessExpression)
|
||||
&& (<PropertyAccessExpression | ElementAccessExpression>node).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
|
||||
export function getEntityNameFromTypeNode(node: TypeNode): EntityName | Expression {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -885,54 +895,28 @@ namespace ts {
|
||||
// property declarations are valid if their parent is a class declaration.
|
||||
return node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
|
||||
return (<FunctionLikeDeclaration>node.parent).body && node.parent.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
// if this method has a body and its parent is a class declaration, this is a valid target.
|
||||
return (<FunctionLikeDeclaration>node).body && node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
return (<FunctionLikeDeclaration>node).body !== undefined
|
||||
&& node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
|
||||
return (<FunctionLikeDeclaration>node.parent).body !== undefined
|
||||
&& (node.parent.kind === SyntaxKind.Constructor
|
||||
|| node.parent.kind === SyntaxKind.MethodDeclaration
|
||||
|| node.parent.kind === SyntaxKind.SetAccessor)
|
||||
&& node.parent.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function nodeIsDecorated(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if (node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
if (node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case SyntaxKind.GetAccessor:
|
||||
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.SetAccessor:
|
||||
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return node.decorators !== undefined
|
||||
&& nodeCanBeDecorated(node);
|
||||
}
|
||||
|
||||
export function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression {
|
||||
@@ -1080,7 +1064,7 @@ namespace ts {
|
||||
|
||||
/**
|
||||
* Returns true if the node is a CallExpression to the identifier 'require' with
|
||||
* exactly one string literal argument.
|
||||
* exactly one argument.
|
||||
* This function does not test if the node is in a JavaScript file or not.
|
||||
*/
|
||||
export function isRequireCall(expression: Node): expression is CallExpression {
|
||||
@@ -1088,8 +1072,7 @@ namespace ts {
|
||||
return expression.kind === SyntaxKind.CallExpression &&
|
||||
(<CallExpression>expression).expression.kind === SyntaxKind.Identifier &&
|
||||
(<Identifier>(<CallExpression>expression).expression).text === "require" &&
|
||||
(<CallExpression>expression).arguments.length === 1 &&
|
||||
(<CallExpression>expression).arguments[0].kind === SyntaxKind.StringLiteral;
|
||||
(<CallExpression>expression).arguments.length === 1;
|
||||
}
|
||||
|
||||
/// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property
|
||||
@@ -1169,26 +1152,56 @@ namespace ts {
|
||||
(<JSDocFunctionType>node).parameters[0].type.kind === SyntaxKind.JSDocConstructorType;
|
||||
}
|
||||
|
||||
function getJSDocTag(node: Node, kind: SyntaxKind): JSDocTag {
|
||||
if (node && node.jsDocComment) {
|
||||
for (const tag of node.jsDocComment.tags) {
|
||||
if (tag.kind === kind) {
|
||||
return tag;
|
||||
}
|
||||
function getJSDocTag(node: Node, kind: SyntaxKind, checkParentVariableStatement: boolean): JSDocTag {
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const jsDocComment = getJSDocComment(node, checkParentVariableStatement);
|
||||
if (!jsDocComment) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
for (const tag of jsDocComment.tags) {
|
||||
if (tag.kind === kind) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getJSDocComment(node: Node, checkParentVariableStatement: boolean): JSDocComment {
|
||||
if (node.jsDocComment) {
|
||||
return node.jsDocComment;
|
||||
}
|
||||
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
|
||||
// /**
|
||||
// * @param {number} name
|
||||
// * @returns {number}
|
||||
// */
|
||||
// var x = function(name) { return name.length; }
|
||||
if (checkParentVariableStatement) {
|
||||
const isInitializerOfVariableDeclarationInStatement =
|
||||
node.parent.kind === SyntaxKind.VariableDeclaration &&
|
||||
(<VariableDeclaration>node.parent).initializer === node &&
|
||||
node.parent.parent.parent.kind === SyntaxKind.VariableStatement;
|
||||
|
||||
const variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined;
|
||||
return variableStatementNode && variableStatementNode.jsDocComment;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getJSDocTypeTag(node: Node): JSDocTypeTag {
|
||||
return <JSDocTypeTag>getJSDocTag(node, SyntaxKind.JSDocTypeTag);
|
||||
return <JSDocTypeTag>getJSDocTag(node, SyntaxKind.JSDocTypeTag, /*checkParentVariableStatement*/ false);
|
||||
}
|
||||
|
||||
export function getJSDocReturnTag(node: Node): JSDocReturnTag {
|
||||
return <JSDocReturnTag>getJSDocTag(node, SyntaxKind.JSDocReturnTag);
|
||||
return <JSDocReturnTag>getJSDocTag(node, SyntaxKind.JSDocReturnTag, /*checkParentVariableStatement*/ true);
|
||||
}
|
||||
|
||||
export function getJSDocTemplateTag(node: Node): JSDocTemplateTag {
|
||||
return <JSDocTemplateTag>getJSDocTag(node, SyntaxKind.JSDocTemplateTag);
|
||||
return <JSDocTemplateTag>getJSDocTag(node, SyntaxKind.JSDocTemplateTag, /*checkParentVariableStatement*/ false);
|
||||
}
|
||||
|
||||
export function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag {
|
||||
@@ -1197,19 +1210,21 @@ namespace ts {
|
||||
// annotation.
|
||||
const parameterName = (<Identifier>parameter.name).text;
|
||||
|
||||
const docComment = parameter.parent.jsDocComment;
|
||||
if (docComment) {
|
||||
return <JSDocParameterTag>forEach(docComment.tags, t => {
|
||||
if (t.kind === SyntaxKind.JSDocParameterTag) {
|
||||
const parameterTag = <JSDocParameterTag>t;
|
||||
const jsDocComment = getJSDocComment(parameter.parent, /*checkParentVariableStatement*/ true);
|
||||
if (jsDocComment) {
|
||||
for (const tag of jsDocComment.tags) {
|
||||
if (tag.kind === SyntaxKind.JSDocParameterTag) {
|
||||
const parameterTag = <JSDocParameterTag>tag;
|
||||
const name = parameterTag.preParameterName || parameterTag.postParameterName;
|
||||
if (name.text === parameterName) {
|
||||
return t;
|
||||
return parameterTag;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function hasRestParameter(s: SignatureDeclaration): boolean {
|
||||
|
||||
@@ -572,6 +572,31 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyCompletionListStartsWithItemsInOrder(items: string[]): void {
|
||||
if (items.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const entries = this.getCompletionListAtCaret().entries;
|
||||
assert.isTrue(items.length <= entries.length, `Amount of expected items in completion list [ ${items.length} ] is greater than actual number of items in list [ ${entries.length} ]`);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
assert.equal(entries[i].name, items[i], `Unexpected item in completion list`);
|
||||
}
|
||||
}
|
||||
|
||||
public noItemsWithSameNameButDifferentKind(): void {
|
||||
const completions = this.getCompletionListAtCaret();
|
||||
const uniqueItems: ts.Map<string> = {};
|
||||
for (const item of completions.entries) {
|
||||
if (!ts.hasProperty(uniqueItems, item.name)) {
|
||||
uniqueItems[item.name] = item.kind;
|
||||
}
|
||||
else {
|
||||
assert.equal(item.kind, uniqueItems[item.name], `Items should have the same kind, got ${item.kind} and ${uniqueItems[item.name]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListIsEmpty(negative: boolean) {
|
||||
const members = this.getMemberListAtCaret();
|
||||
if ((!members || members.entries.length === 0) && negative) {
|
||||
|
||||
Vendored
+32
-13
@@ -1255,7 +1255,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -1514,9 +1514,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -2569,6 +2569,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -2981,6 +2983,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -3770,6 +3773,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -6924,7 +6928,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -7640,7 +7644,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -10369,17 +10373,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -11977,7 +11980,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -12579,6 +12582,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -12633,6 +12644,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -12829,7 +12848,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
-2
@@ -819,7 +819,6 @@ interface MapConstructor {
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
@@ -859,7 +858,6 @@ declare var Set: SetConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): WeakSet<T>;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
[Symbol.toStringTag]: "WeakSet";
|
||||
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
interface Array<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.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArray {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int16Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint16Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int32Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint32Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float64Array {
|
||||
/**
|
||||
* 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: number, fromIndex?: number): boolean;
|
||||
}
|
||||
Vendored
+2
-2
@@ -69,7 +69,7 @@ interface Console {
|
||||
select(element: any): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace ts.server {
|
||||
if (!resolution) {
|
||||
const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName);
|
||||
if (moduleResolutionIsValid(existingResolution)) {
|
||||
// ok, it is safe to use existing module resolution results
|
||||
// ok, it is safe to use existing module resolution results
|
||||
resolution = existingResolution;
|
||||
}
|
||||
else {
|
||||
@@ -145,8 +145,8 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
if (resolution.resolvedModule) {
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace ts.server {
|
||||
openFileRootsConfigured: ScriptInfo[] = [];
|
||||
// a path to directory watcher map that detects added tsconfig files
|
||||
directoryWatchersForTsconfig: ts.Map<FileWatcher> = {};
|
||||
// count of how many projects are using the directory watcher. If the
|
||||
// count of how many projects are using the directory watcher. If the
|
||||
// number becomes 0 for a watcher, then we should close it.
|
||||
directoryWatchersRefCount: ts.Map<number> = {};
|
||||
hostConfiguration: HostConfiguration;
|
||||
@@ -564,11 +564,11 @@ namespace ts.server {
|
||||
// We check if the project file list has changed. If so, we update the project.
|
||||
if (!arrayIsEqualTo(currentRootFiles && currentRootFiles.sort(), newRootFiles && newRootFiles.sort())) {
|
||||
// For configured projects, the change is made outside the tsconfig file, and
|
||||
// it is not likely to affect the project for other files opened by the client. We can
|
||||
// it is not likely to affect the project for other files opened by the client. We can
|
||||
// just update the current project.
|
||||
this.updateConfiguredProject(project);
|
||||
|
||||
// Call updateProjectStructure to clean up inferred projects we may have
|
||||
// Call updateProjectStructure to clean up inferred projects we may have
|
||||
// created for the new files
|
||||
this.updateProjectStructure();
|
||||
}
|
||||
@@ -792,8 +792,8 @@ namespace ts.server {
|
||||
* @param info The file that has been closed or newly configured
|
||||
*/
|
||||
closeOpenFile(info: ScriptInfo) {
|
||||
// Closing file should trigger re-reading the file content from disk. This is
|
||||
// because the user may chose to discard the buffer content before saving
|
||||
// Closing file should trigger re-reading the file content from disk. This is
|
||||
// because the user may chose to discard the buffer content before saving
|
||||
// to the disk, and the server's version of the file can be out of sync.
|
||||
info.svc.reloadFromFile(info.fileName);
|
||||
|
||||
@@ -891,8 +891,8 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to update the project structure for every projects.
|
||||
* It is called on the premise that all the configured projects are
|
||||
* This function is to update the project structure for every projects.
|
||||
* It is called on the premise that all the configured projects are
|
||||
* up to date.
|
||||
*/
|
||||
updateProjectStructure() {
|
||||
@@ -946,7 +946,7 @@ namespace ts.server {
|
||||
|
||||
if (rootFile.defaultProject && rootFile.defaultProject.isConfiguredProject()) {
|
||||
// If the root file has already been added into a configured project,
|
||||
// meaning the original inferred project is gone already.
|
||||
// meaning the original inferred project is gone already.
|
||||
if (!rootedProject.isConfiguredProject()) {
|
||||
this.removeProject(rootedProject);
|
||||
}
|
||||
@@ -1026,10 +1026,16 @@ namespace ts.server {
|
||||
// the newly opened file.
|
||||
findConfigFile(searchPath: string): string {
|
||||
while (true) {
|
||||
const fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (this.host.fileExists(fileName)) {
|
||||
return fileName;
|
||||
const tsconfigFileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (this.host.fileExists(tsconfigFileName)) {
|
||||
return tsconfigFileName;
|
||||
}
|
||||
|
||||
const jsconfigFileName = ts.combinePaths(searchPath, "jsconfig.json");
|
||||
if (this.host.fileExists(jsconfigFileName)) {
|
||||
return jsconfigFileName;
|
||||
}
|
||||
|
||||
const parentPath = ts.getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
@@ -1053,9 +1059,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function tries to search for a tsconfig.json for the given file. If we found it,
|
||||
* This function tries to search for a tsconfig.json for the given file. If we found it,
|
||||
* we first detect if there is already a configured project created for it: if so, we re-read
|
||||
* the tsconfig file content and update the project; otherwise we create a new one.
|
||||
* the tsconfig file content and update the project; otherwise we create a new one.
|
||||
*/
|
||||
openOrUpdateConfiguredProjectForFile(fileName: string) {
|
||||
const searchPath = ts.normalizePath(getDirectoryPath(fileName));
|
||||
@@ -1180,7 +1186,7 @@ namespace ts.server {
|
||||
return { succeeded: false, error: rawConfig.error };
|
||||
}
|
||||
else {
|
||||
const parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath);
|
||||
const parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath, /*existingOptions*/ {}, configFilename);
|
||||
Debug.assert(!!parsedCommandLine.fileNames);
|
||||
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
@@ -1259,7 +1265,7 @@ namespace ts.server {
|
||||
info = this.openFile(fileName, /*openedByClient*/ false);
|
||||
}
|
||||
else {
|
||||
// if the root file was opened by client, it would belong to either
|
||||
// if the root file was opened by client, it would belong to either
|
||||
// openFileRoots or openFileReferenced.
|
||||
if (info.isOpen) {
|
||||
if (this.openFileRoots.indexOf(info) >= 0) {
|
||||
|
||||
@@ -792,7 +792,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private closeClientFile(fileName: string) {
|
||||
if (!fileName) { return; }
|
||||
if (!fileName) {
|
||||
return;
|
||||
}
|
||||
const file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
}
|
||||
|
||||
@@ -7179,8 +7179,7 @@ namespace ts {
|
||||
|
||||
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
|
||||
|
||||
// TODO: call a helper method instead once PR #4133 gets merged in.
|
||||
const newLine = host.getNewLine ? host.getNewLine() : "\r\n";
|
||||
const newLine = getNewLineOrDefaultFromHost(host);
|
||||
|
||||
let docParams = "";
|
||||
for (let i = 0, numParams = parameters.length; i < numParams; i++) {
|
||||
|
||||
@@ -946,7 +946,8 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
const configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
const normalizedFileName = normalizeSlashes(fileName);
|
||||
const configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName);
|
||||
|
||||
return {
|
||||
options: configFile.options,
|
||||
@@ -1056,6 +1057,6 @@ namespace TypeScript.Services {
|
||||
// TODO: it should be moved into a namespace though.
|
||||
|
||||
/* @internal */
|
||||
const toolsVersion = "1.8";
|
||||
const toolsVersion = "1.9";
|
||||
|
||||
/* tslint:enable:no-unused-variable */
|
||||
@@ -11,6 +11,6 @@ class C {
|
||||
class C {
|
||||
method() {
|
||||
function other() { }
|
||||
var fn = () => __awaiter(this, arguments, Promise, function* (_arguments) { return yield other.apply(this, _arguments); });
|
||||
var fn = () => __awaiter(this, arguments, Promise, function* () { return yield other.apply(this, arguments); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,17 +40,12 @@ module M {
|
||||
}
|
||||
|
||||
//// [asyncAwaitIsolatedModules_es6.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function f0() {
|
||||
|
||||
@@ -40,17 +40,12 @@ module M {
|
||||
}
|
||||
|
||||
//// [asyncAwait_es6.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function f0() {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//// [tests/cases/compiler/asyncFunctionsAcrossFiles.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: async () => {
|
||||
await b.f();
|
||||
}
|
||||
};
|
||||
//// [b.ts]
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: async () => {
|
||||
await a.f();
|
||||
}
|
||||
};
|
||||
|
||||
//// [b.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: () => __awaiter(this, void 0, Promise, function* () {
|
||||
yield a.f();
|
||||
})
|
||||
};
|
||||
//// [a.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: () => __awaiter(this, void 0, Promise, function* () {
|
||||
yield b.f();
|
||||
})
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import { b } from './b';
|
||||
>b : Symbol(b, Decl(a.ts, 0, 8))
|
||||
|
||||
export const a = {
|
||||
>a : Symbol(a, Decl(a.ts, 1, 12))
|
||||
|
||||
f: async () => {
|
||||
>f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
|
||||
await b.f();
|
||||
>b.f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
>b : Symbol(b, Decl(a.ts, 0, 8))
|
||||
>f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
}
|
||||
};
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { a } from './a';
|
||||
>a : Symbol(a, Decl(b.ts, 0, 8))
|
||||
|
||||
export const b = {
|
||||
>b : Symbol(b, Decl(b.ts, 1, 12))
|
||||
|
||||
f: async () => {
|
||||
>f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
|
||||
await a.f();
|
||||
>a.f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
>a : Symbol(a, Decl(b.ts, 0, 8))
|
||||
>f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import { b } from './b';
|
||||
>b : { f: () => Promise<void>; }
|
||||
|
||||
export const a = {
|
||||
>a : { f: () => Promise<void>; }
|
||||
>{ f: async () => { await b.f(); }} : { f: () => Promise<void>; }
|
||||
|
||||
f: async () => {
|
||||
>f : () => Promise<void>
|
||||
>async () => { await b.f(); } : () => Promise<void>
|
||||
|
||||
await b.f();
|
||||
>await b.f() : void
|
||||
>b.f() : Promise<void>
|
||||
>b.f : () => Promise<void>
|
||||
>b : { f: () => Promise<void>; }
|
||||
>f : () => Promise<void>
|
||||
}
|
||||
};
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { a } from './a';
|
||||
>a : { f: () => Promise<void>; }
|
||||
|
||||
export const b = {
|
||||
>b : { f: () => Promise<void>; }
|
||||
>{ f: async () => { await a.f(); }} : { f: () => Promise<void>; }
|
||||
|
||||
f: async () => {
|
||||
>f : () => Promise<void>
|
||||
>async () => { await a.f(); } : () => Promise<void>
|
||||
|
||||
await a.f();
|
||||
>await a.f() : void
|
||||
>a.f() : Promise<void>
|
||||
>a.f : () => Promise<void>
|
||||
>a : { f: () => Promise<void>; }
|
||||
>f : () => Promise<void>
|
||||
}
|
||||
};
|
||||
@@ -16,20 +16,15 @@ class Task extends Promise {
|
||||
exports.Task = Task;
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
var task_1 = require("./task");
|
||||
const task_1 = require("./task");
|
||||
class Test {
|
||||
example() {
|
||||
return __awaiter(this, void 0, task_1.Task, function* () { return; });
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
//// [asyncMethodWithSuper_es6.ts]
|
||||
class A {
|
||||
x() {
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
// call with property access
|
||||
super.x();
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
const f = () => {};
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncMethodWithSuper_es6.js]
|
||||
class A {
|
||||
x() {
|
||||
}
|
||||
}
|
||||
class B extends A {
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
simple() {
|
||||
const _super = name => super[name];
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
// call with property access
|
||||
_super("x").call(this);
|
||||
// call with element access
|
||||
_super("x").call(this);
|
||||
// property access (read)
|
||||
const a = _super("x");
|
||||
// element access (read)
|
||||
const b = _super("x");
|
||||
});
|
||||
}
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
advanced() {
|
||||
const _super = (function (geti, seti) {
|
||||
const cache = Object.create(null);
|
||||
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
|
||||
})(name => super[name], (name, value) => super[name] = value);
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
const f = () => { };
|
||||
// call with property access
|
||||
_super("x").value.call(this);
|
||||
// call with element access
|
||||
_super("x").value.call(this);
|
||||
// property access (read)
|
||||
const a = _super("x").value;
|
||||
// element access (read)
|
||||
const b = _super("x").value;
|
||||
// property access (assign)
|
||||
_super("x").value = f;
|
||||
// element access (assign)
|
||||
_super("x").value = f;
|
||||
// destructuring assign with property access
|
||||
({ f: _super("x").value } = { f });
|
||||
// destructuring assign with element access
|
||||
({ f: _super("x").value } = { f });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
=== tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
|
||||
x() {
|
||||
>x : Symbol(x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : Symbol(B, Decl(asyncMethodWithSuper_es6.ts, 3, 1))
|
||||
>A : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
>simple : Symbol(simple, Decl(asyncMethodWithSuper_es6.ts, 5, 19))
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 15, 13))
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : Symbol(b, Decl(asyncMethodWithSuper_es6.ts, 18, 13))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
>advanced : Symbol(advanced, Decl(asyncMethodWithSuper_es6.ts, 19, 5))
|
||||
|
||||
const f = () => {};
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13))
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 32, 13))
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : Symbol(b, Decl(asyncMethodWithSuper_es6.ts, 35, 13))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13))
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13))
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 44, 10))
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 44, 27))
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 47, 10))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 47, 30))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
=== tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
x() {
|
||||
>x : () => void
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
>simple : () => Promise<void>
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x() : void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super["x"]() : void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
>advanced : () => Promise<void>
|
||||
|
||||
const f = () => {};
|
||||
>f : () => void
|
||||
>() => {} : () => void
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x() : void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super["x"]() : void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
>super.x = f : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
>f : () => void
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
>super["x"] = f : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
>f : () => void
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
>({ f: super.x } = { f }) : { f: () => void; }
|
||||
>{ f: super.x } = { f } : { f: () => void; }
|
||||
>{ f: super.x } : { f: () => void; }
|
||||
>f : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
>{ f } : { f: () => void; }
|
||||
>f : () => void
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
>({ f: super["x"] } = { f }) : { f: () => void; }
|
||||
>{ f: super["x"] } = { f } : { f: () => void; }
|
||||
>{ f: super["x"] } : { f: () => void; }
|
||||
>f : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
>{ f } : { f: () => void; }
|
||||
>f : () => void
|
||||
}
|
||||
}
|
||||
@@ -6,17 +6,12 @@ async function f() {}
|
||||
function g() { }
|
||||
|
||||
//// [a.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function f() {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//// [tests/cases/compiler/classExtendsAcrossFiles.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: () => {
|
||||
class A { }
|
||||
class B extends A { }
|
||||
b.f();
|
||||
}
|
||||
};
|
||||
//// [b.ts]
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: () => {
|
||||
class A { }
|
||||
class B extends A { }
|
||||
a.f();
|
||||
}
|
||||
};
|
||||
|
||||
//// [b.js]
|
||||
"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 __());
|
||||
};
|
||||
var a_1 = require('./a');
|
||||
exports.b = {
|
||||
f: function () {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
a_1.a.f();
|
||||
}
|
||||
};
|
||||
//// [a.js]
|
||||
"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 __());
|
||||
};
|
||||
var b_1 = require('./b');
|
||||
exports.a = {
|
||||
f: function () {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
b_1.b.f();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import { b } from './b';
|
||||
>b : Symbol(b, Decl(a.ts, 0, 8))
|
||||
|
||||
export const a = {
|
||||
>a : Symbol(a, Decl(a.ts, 1, 12))
|
||||
|
||||
f: () => {
|
||||
>f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
|
||||
class A { }
|
||||
>A : Symbol(A, Decl(a.ts, 2, 14))
|
||||
|
||||
class B extends A { }
|
||||
>B : Symbol(B, Decl(a.ts, 3, 19))
|
||||
>A : Symbol(A, Decl(a.ts, 2, 14))
|
||||
|
||||
b.f();
|
||||
>b.f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
>b : Symbol(b, Decl(a.ts, 0, 8))
|
||||
>f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
}
|
||||
};
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { a } from './a';
|
||||
>a : Symbol(a, Decl(b.ts, 0, 8))
|
||||
|
||||
export const b = {
|
||||
>b : Symbol(b, Decl(b.ts, 1, 12))
|
||||
|
||||
f: () => {
|
||||
>f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
|
||||
class A { }
|
||||
>A : Symbol(A, Decl(b.ts, 2, 14))
|
||||
|
||||
class B extends A { }
|
||||
>B : Symbol(B, Decl(b.ts, 3, 19))
|
||||
>A : Symbol(A, Decl(b.ts, 2, 14))
|
||||
|
||||
a.f();
|
||||
>a.f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
>a : Symbol(a, Decl(b.ts, 0, 8))
|
||||
>f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import { b } from './b';
|
||||
>b : { f: () => void; }
|
||||
|
||||
export const a = {
|
||||
>a : { f: () => void; }
|
||||
>{ f: () => { class A { } class B extends A { } b.f(); }} : { f: () => void; }
|
||||
|
||||
f: () => {
|
||||
>f : () => void
|
||||
>() => { class A { } class B extends A { } b.f(); } : () => void
|
||||
|
||||
class A { }
|
||||
>A : A
|
||||
|
||||
class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
b.f();
|
||||
>b.f() : void
|
||||
>b.f : () => void
|
||||
>b : { f: () => void; }
|
||||
>f : () => void
|
||||
}
|
||||
};
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { a } from './a';
|
||||
>a : { f: () => void; }
|
||||
|
||||
export const b = {
|
||||
>b : { f: () => void; }
|
||||
>{ f: () => { class A { } class B extends A { } a.f(); }} : { f: () => void; }
|
||||
|
||||
f: () => {
|
||||
>f : () => void
|
||||
>() => { class A { } class B extends A { } a.f(); } : () => void
|
||||
|
||||
class A { }
|
||||
>A : A
|
||||
|
||||
class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
a.f();
|
||||
>a.f() : void
|
||||
>a.f : () => void
|
||||
>a : { f: () => void; }
|
||||
>f : () => void
|
||||
}
|
||||
};
|
||||
@@ -31,16 +31,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = {};
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
|
||||
"use strict";
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_1.a;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_2.a;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.x;
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.a;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_4.x;
|
||||
var es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
const es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
|
||||
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_5.m;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this
|
||||
exports.a = 10;
|
||||
//// [es6ImportNameSpaceImport_1.js]
|
||||
"use strict";
|
||||
var nameSpaceBinding = require("./es6ImportNameSpaceImport_0");
|
||||
const nameSpaceBinding = require("./es6ImportNameSpaceImport_0");
|
||||
var x = nameSpaceBinding.a;
|
||||
|
||||
|
||||
|
||||
@@ -53,26 +53,26 @@ exports.z2 = 10;
|
||||
exports.aaaa = 10;
|
||||
//// [es6ImportNamedImport_1.js]
|
||||
"use strict";
|
||||
var es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_1.a;
|
||||
var es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_2.a;
|
||||
var es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_3.x;
|
||||
var xxxx = es6ImportNamedImport_0_3.a;
|
||||
var es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_4.x;
|
||||
var es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_5.m;
|
||||
var es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_6.a1;
|
||||
var xxxx = es6ImportNamedImport_0_6.x1;
|
||||
var es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0");
|
||||
var xxxx = es6ImportNamedImport_0_7.a1;
|
||||
var xxxx = es6ImportNamedImport_0_7.x1;
|
||||
var es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0");
|
||||
var z111 = es6ImportNamedImport_0_8.z1;
|
||||
var es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0");
|
||||
const es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0");
|
||||
var z2 = es6ImportNamedImport_0_9.z2; // z2 shouldn't give redeclare error
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export = a;
|
||||
exports.a = 10;
|
||||
//// [es6ImportNamedImportInExportAssignment_1.js]
|
||||
"use strict";
|
||||
var es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0");
|
||||
const es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0");
|
||||
module.exports = es6ImportNamedImportInExportAssignment_0_1.a;
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ exports.M = t1_1.M;
|
||||
exports.a = t1_1.a;
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.v = t1_1.v;
|
||||
exports.f = t1_1.f;
|
||||
exports.C = t1_1.C;
|
||||
|
||||
@@ -24,6 +24,6 @@ exports.y = t1_1.x;
|
||||
exports.x = t1_1.y;
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.y = t1_1.x;
|
||||
exports.x = t1_1.y;
|
||||
|
||||
@@ -69,7 +69,7 @@ exports.M = t1_1.M1;
|
||||
exports.a = t1_1.a1;
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.v = t1_1.v1;
|
||||
exports.f = t1_1.f1;
|
||||
exports.C = t1_1.C1;
|
||||
|
||||
@@ -45,24 +45,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = "hello";
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
var a = require("./t1");
|
||||
const a = require("./t1");
|
||||
exports.a = a;
|
||||
a.default;
|
||||
var t1_1 = require("./t1");
|
||||
const t1_1 = require("./t1");
|
||||
exports.b = t1_1.default;
|
||||
t1_1.default;
|
||||
var c = require("./t1");
|
||||
const c = require("./t1");
|
||||
exports.c = c;
|
||||
c.default;
|
||||
var t1_2 = require("./t1");
|
||||
const t1_2 = require("./t1");
|
||||
exports.d = t1_2.default;
|
||||
t1_2.default;
|
||||
var t1_3 = require("./t1"), e2 = t1_3;
|
||||
const t1_3 = require("./t1"), e2 = t1_3;
|
||||
exports.e1 = t1_3.default;
|
||||
exports.e2 = e2;
|
||||
t1_3.default;
|
||||
e2.default;
|
||||
var t1_4 = require("./t1");
|
||||
const t1_4 = require("./t1");
|
||||
exports.f1 = t1_4.default;
|
||||
exports.f2 = t1_4.default;
|
||||
t1_4.default;
|
||||
|
||||
+17
-3
@@ -1,9 +1,10 @@
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(3,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(95,16): error TS2378: A 'get' accessor must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(101,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(106,16): error TS2378: A 'get' accessor must return a value.
|
||||
tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(129,5): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (3 errors) ====
|
||||
==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (4 errors) ====
|
||||
|
||||
|
||||
function f1(): string {
|
||||
@@ -98,6 +99,19 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): e
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
|
||||
function f19(): void | number {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
|
||||
function f20(): any | number {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
|
||||
function f21(): number | string {
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
|
||||
class C {
|
||||
public get m1() {
|
||||
|
||||
@@ -91,6 +91,17 @@ function f18() {
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
|
||||
function f19(): void | number {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
|
||||
function f20(): any | number {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
|
||||
function f21(): number | string {
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
|
||||
class C {
|
||||
public get m1() {
|
||||
@@ -191,6 +202,15 @@ function f17() {
|
||||
function f18() {
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
function f19() {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
function f20() {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
function f21() {
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
tests/cases/compiler/a.js(3,6): error TS1223: 'type' tag already specified.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (0 errors) ====
|
||||
/**
|
||||
* @type {number}
|
||||
* @type {string}
|
||||
~~~~
|
||||
!!! error TS1223: 'type' tag already specified.
|
||||
*/
|
||||
var v;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
tests/cases/compiler/a.js(1,10): error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
tests/cases/compiler/a.js(1,10): error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
tests/cases/compiler/a.js(1,27): error TS1005: '</' expected.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (2 errors) ====
|
||||
var v = <string>undefined;
|
||||
~~~~~~
|
||||
!!! error TS8016: 'type assertion expressions' can only be used in a .ts file.
|
||||
!!! error TS17008: JSX element 'string' has no corresponding closing tag.
|
||||
|
||||
!!! error TS1005: '</' expected.
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/compiler/a.ts(2,10): error TS2661: Cannot re-export name that is not defined in the module.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
|
||||
export { undefined };
|
||||
~~~~~~~~~
|
||||
!!! error TS2661: Cannot re-export name that is not defined in the module.
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [a.ts]
|
||||
|
||||
export { undefined };
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,20 @@
|
||||
//// [tests/cases/compiler/reExportUndefined2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
var undefined;
|
||||
export { undefined };
|
||||
|
||||
//// [b.ts]
|
||||
import { undefined } from "./a";
|
||||
declare function use(a: number);
|
||||
use(undefined);
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var undefined;
|
||||
exports.undefined = undefined;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
var a_1 = require("./a");
|
||||
use(a_1.undefined);
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
var undefined;
|
||||
>undefined : Symbol(undefined, Decl(a.ts, 1, 3))
|
||||
|
||||
export { undefined };
|
||||
>undefined : Symbol(undefined, Decl(a.ts, 2, 8))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { undefined } from "./a";
|
||||
>undefined : Symbol(undefined, Decl(b.ts, 0, 8))
|
||||
|
||||
declare function use(a: number);
|
||||
>use : Symbol(use, Decl(b.ts, 0, 32))
|
||||
>a : Symbol(a, Decl(b.ts, 1, 21))
|
||||
|
||||
use(undefined);
|
||||
>use : Symbol(use, Decl(b.ts, 0, 32))
|
||||
>undefined : Symbol(undefined, Decl(b.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
var undefined;
|
||||
>undefined : any
|
||||
|
||||
export { undefined };
|
||||
>undefined : any
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { undefined } from "./a";
|
||||
>undefined : any
|
||||
|
||||
declare function use(a: number);
|
||||
>use : (a: number) => any
|
||||
>a : number
|
||||
|
||||
use(undefined);
|
||||
>use(undefined) : any
|
||||
>use : (a: number) => any
|
||||
>undefined : any
|
||||
|
||||
@@ -31,17 +31,12 @@ declare function use(s: string): void;
|
||||
let x1 = () => { use("Test"); }
|
||||
|
||||
//// [reachabilityChecks7.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
// async function without return type annotation - error
|
||||
|
||||
@@ -20,8 +20,8 @@ use(foo);
|
||||
exports.x = 1;
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
var existingModule_1 = require('./existingModule');
|
||||
var missingModule_1 = require('./missingModule');
|
||||
const existingModule_1 = require('./existingModule');
|
||||
const missingModule_1 = require('./missingModule');
|
||||
const test = { x: existingModule_1.x, foo: missingModule_1.foo };
|
||||
use(existingModule_1.x);
|
||||
use(missingModule_1.foo);
|
||||
|
||||
@@ -34,7 +34,7 @@ var Bar = (function (_super) {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Bar.prototype[symbol] = function () {
|
||||
return _super.prototype[symbol]();
|
||||
return _super.prototype[symbol].call(this);
|
||||
};
|
||||
return Bar;
|
||||
}(Foo));
|
||||
|
||||
@@ -34,7 +34,7 @@ var Bar = (function (_super) {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Bar[symbol] = function () {
|
||||
return _super[symbol]();
|
||||
return _super[symbol].call(this);
|
||||
};
|
||||
return Bar;
|
||||
}(Foo));
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// @target: es6
|
||||
// @filename: a.ts
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: async () => {
|
||||
await b.f();
|
||||
}
|
||||
};
|
||||
// @filename: b.ts
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: async () => {
|
||||
await a.f();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @filename: a.ts
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: () => {
|
||||
class A { }
|
||||
class B extends A { }
|
||||
b.f();
|
||||
}
|
||||
};
|
||||
// @filename: b.ts
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: () => {
|
||||
class A { }
|
||||
class B extends A { }
|
||||
a.f();
|
||||
}
|
||||
};
|
||||
@@ -92,6 +92,17 @@ function f18() {
|
||||
return "Okay, not type annotated.";
|
||||
}
|
||||
|
||||
function f19(): void | number {
|
||||
// Okay; function return type is union containing void
|
||||
}
|
||||
|
||||
function f20(): any | number {
|
||||
// Okay; function return type is union containing any
|
||||
}
|
||||
|
||||
function f21(): number | string {
|
||||
// Not okay; union does not contain void or any
|
||||
}
|
||||
|
||||
class C {
|
||||
public get m1() {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// @module: commonjs
|
||||
|
||||
// @filename: a.ts
|
||||
export { undefined };
|
||||
@@ -0,0 +1,10 @@
|
||||
// @module: commonjs
|
||||
|
||||
// @filename: a.ts
|
||||
var undefined;
|
||||
export { undefined };
|
||||
|
||||
// @filename: b.ts
|
||||
import { undefined } from "./a";
|
||||
declare function use(a: number);
|
||||
use(undefined);
|
||||
@@ -0,0 +1,52 @@
|
||||
// @target: ES6
|
||||
// @noEmitHelpers: true
|
||||
class A {
|
||||
x() {
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
// call with property access
|
||||
super.x();
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
const f = () => {};
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,8 @@
|
||||
////// @pa/*7*/
|
||||
////var v7;
|
||||
////
|
||||
/////** @param { n/*8*/ } */
|
||||
/////** @return { n/*8*/ } */
|
||||
////var v8;
|
||||
////
|
||||
/////** @return { n/*9*/ } */
|
||||
////var v9;
|
||||
|
||||
goTo.marker('1');
|
||||
verify.completionListContains("constructor");
|
||||
@@ -57,6 +54,3 @@ verify.completionListIsEmpty();
|
||||
goTo.marker('8');
|
||||
verify.completionListContains('number');
|
||||
|
||||
goTo.marker('9');
|
||||
verify.completionListContains('number');
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {number} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,11 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @type {function(this:number)}
|
||||
//// */
|
||||
////function f() { this./**/ }
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,11 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {number|string} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,36 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @param {number} input
|
||||
//// * @param {string} currency
|
||||
//// * @returns {number}
|
||||
//// */
|
||||
////var convert = function(input, currency) {
|
||||
//// switch(currency./*1*/) {
|
||||
//// case "USD":
|
||||
//// input./*2*/;
|
||||
//// case "EUR":
|
||||
//// return "" + rateToUsd.EUR;
|
||||
//// case "CNY":
|
||||
//// return {} + rateToUsd.CNY;
|
||||
//// }
|
||||
////}
|
||||
////convert(1, "")./*3*/
|
||||
/////**
|
||||
//// * @param {number} x
|
||||
//// */
|
||||
////var test1 = function(x) { return x./*4*/ }, test2 = function(a) { return a./*5*/ };
|
||||
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
goTo.marker("5");
|
||||
verify.completionListContains("test1", /*displayText:*/ undefined, /*documentation*/ undefined, "warning");
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @allowNonTsExtensions: true
|
||||
|
||||
// @Filename: file1.js
|
||||
|
||||
////var file1Identifier = 1;
|
||||
////interface Foo { FooProp: number };
|
||||
|
||||
// @Filename: file2.js
|
||||
|
||||
////var file2Identifier1 = 2;
|
||||
////var file2Identifier2 = 2;
|
||||
/////*1*/
|
||||
////file2Identifier2./*2*/
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("file2Identifier1");
|
||||
verify.completionListContains("file2Identifier2");
|
||||
verify.completionListContains("file1Identifier");
|
||||
verify.not.completionListContains("FooProp");
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("file2Identifier1");
|
||||
verify.completionListContains("file2Identifier2");
|
||||
verify.not.completionListContains("file1Identifier")
|
||||
verify.not.completionListContains("FooProp");
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: file1.js
|
||||
/////// <reference no-default-lib="true"/>
|
||||
////interface Number {
|
||||
//// toExponential(fractionDigits?: number): string;
|
||||
////}
|
||||
////var x = 1;
|
||||
////x./*1*/
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: refFile1.ts
|
||||
//// export var V = 1;
|
||||
|
||||
// @Filename: refFile2.ts
|
||||
//// export var V = "123"
|
||||
|
||||
// @Filename: refFile3.ts
|
||||
//// export var V = "123"
|
||||
|
||||
// @Filename: main.js
|
||||
//// import ref1 = require("refFile1");
|
||||
//// var ref2 = require("refFile2");
|
||||
//// ref1.V./*1*/;
|
||||
//// ref2.V./*2*/;
|
||||
//// var v = { x: require("refFile3") };
|
||||
//// v.x./*3*/;
|
||||
//// v.x.V./*4*/;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("toExponential");
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("toLowerCase");
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("V");
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("toLowerCase");
|
||||
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {(number|string)} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("valueOf", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {Array.<number>} */
|
||||
////var v;
|
||||
////v./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("concat", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,10 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @return {number} */
|
||||
////function foo(a,b) { }
|
||||
////foo(1,2)./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,15 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
//// /**
|
||||
//// * @template T
|
||||
//// * @param {T} a
|
||||
//// * @return {T} */
|
||||
//// function foo(a) { }
|
||||
//// let x = /*1*/foo;
|
||||
//// foo(1)./**/
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,13 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @param {...number} a
|
||||
//// */
|
||||
////function foo(a) {
|
||||
//// a./**/
|
||||
////}
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("concat", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,13 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @param {...number} a
|
||||
//// */
|
||||
////function foo(a) {
|
||||
//// a[0]./**/
|
||||
////}
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @type {function(): number}
|
||||
//// */
|
||||
////var v;
|
||||
////v()./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////**
|
||||
//// * @type {function(new:number)}
|
||||
//// */
|
||||
////var v;
|
||||
////new v()./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {function(new:string,number)} */
|
||||
////var /**/v;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('var v: new (p1: number) => string');
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {number} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: number): void');
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {number[]} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: number[]): void');
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {[number,string]} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: [number, string]): void');
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @param {{b:number}} [a] */
|
||||
////function /**/f(a) { }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('function f(a?: {\n b: number;\n}): void');
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
/////** @type {function(this:number)} */
|
||||
////function f() { /**/this }
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('number');
|
||||
@@ -1,16 +0,0 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
//// var v = <string>undefined;
|
||||
|
||||
verify.getSyntacticDiagnostics(`[]`);
|
||||
verify.getSemanticDiagnostics(`[
|
||||
{
|
||||
"message": "'type assertion expressions' can only be used in a .ts file.",
|
||||
"start": 9,
|
||||
"length": 6,
|
||||
"category": "error",
|
||||
"code": 8016
|
||||
}
|
||||
]`);
|
||||
@@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// Error: Having more function parameters than entries in the dependency array
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: Foo.js
|
||||
//// define('mod1', ['a'], /**/function(a, b) {
|
||||
////
|
||||
//// });
|
||||
|
||||
// TODO: what should happen?
|
||||
goTo.marker();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user