Merge branch 'tsserverVS-WIP' into tsserverVS-Types2.0

This commit is contained in:
Jason Ramsay
2016-08-29 16:23:10 -07:00
118 changed files with 18369 additions and 11738 deletions
+1 -1
View File
@@ -551,7 +551,7 @@ function restoreSavedNodeEnv() {
process.env.NODE_ENV = savedNodeEnv;
}
let testTimeout = 20000;
let testTimeout = 40000;
function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
const lintFlag = cmdLineOptions["lint"];
cleanTestDirs((err) => {
+68 -18
View File
@@ -529,8 +529,8 @@ interface NumberConstructor {
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
declare const Number: NumberConstructor;
interface TemplateStringsArray extends Array<string> {
readonly raw: string[];
interface TemplateStringsArray extends ReadonlyArray<string> {
readonly raw: ReadonlyArray<string>
}
interface Math {
@@ -1022,7 +1022,12 @@ interface ReadonlyArray<T> {
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[]): T[];
concat(...items: T[][]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: (T | T[])[]): T[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
@@ -1124,6 +1129,11 @@ interface Array<T> {
* Removes the last element from an array and returns it.
*/
pop(): T | undefined;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[][]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
@@ -4248,6 +4258,7 @@ interface KeyAlgorithm {
}
interface KeyboardEventInit extends EventModifierInit {
code?: string;
key?: string;
location?: number;
repeat?: boolean;
@@ -6410,7 +6421,7 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
/**
* Sets or gets the URL for the current document.
*/
@@ -7473,7 +7484,7 @@ declare var Document: {
new(): Document;
}
interface DocumentFragment extends Node, NodeSelector {
interface DocumentFragment extends Node, NodeSelector, ParentNode {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7542,7 +7553,7 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
readonly clientHeight: number;
@@ -7797,6 +7808,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
closest(selector: string): Element | null;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -8568,7 +8589,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(callback: (result: Blob | null) => void, ... arguments: any[]): void;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
}
declare var HTMLCanvasElement: {
@@ -8743,11 +8764,7 @@ interface HTMLElement extends Element {
click(): void;
dragDrop(): boolean;
focus(): void;
insertAdjacentElement(position: string, insertedElement: Element): Element;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
msGetInputContext(): MSInputMethodContext;
scrollIntoView(top?: boolean): void;
setActive(): void;
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -10012,6 +10029,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
*/
type: string;
import?: Document;
integrity: string;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10300,7 +10318,7 @@ interface HTMLMediaElement extends HTMLElement {
*/
canPlayType(type: string): string;
/**
* Fires immediately after the client loads the object.
* Resets the audio or video object and loads a new media resource.
*/
load(): void;
/**
@@ -10873,6 +10891,7 @@ interface HTMLScriptElement extends HTMLElement {
* Sets or retrieves the MIME type for the associated scripting engine.
*/
type: string;
integrity: string;
}
declare var HTMLScriptElement: {
@@ -11878,6 +11897,7 @@ interface KeyboardEvent extends UIEvent {
readonly repeat: boolean;
readonly shiftKey: boolean;
readonly which: number;
readonly code: string;
getModifierState(keyArg: string): boolean;
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
readonly DOM_KEY_LOCATION_JOYSTICK: number;
@@ -13250,6 +13270,7 @@ interface PerformanceTiming {
readonly responseStart: number;
readonly unloadEventEnd: number;
readonly unloadEventStart: number;
readonly secureConnectionStart: number;
toJSON(): any;
}
@@ -15527,8 +15548,8 @@ declare var StereoPannerNode: {
interface Storage {
readonly length: number;
clear(): void;
getItem(key: string): string;
key(index: number): string;
getItem(key: string): string | null;
key(index: number): string | null;
removeItem(key: string): void;
setItem(key: string, data: string): void;
[key: string]: any;
@@ -17069,7 +17090,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
onunload: (this: this, ev: Event) => any;
onvolumechange: (this: this, ev: Event) => any;
onwaiting: (this: this, ev: Event) => any;
readonly opener: Window;
opener: any;
orientation: string | number;
readonly outerHeight: number;
readonly outerWidth: number;
@@ -17124,6 +17145,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -18151,6 +18175,20 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
interface ScrollOptions {
behavior?: ScrollBehavior;
}
interface ScrollToOptions extends ScrollOptions {
left?: number;
top?: number;
}
interface ScrollIntoViewOptions extends ScrollOptions {
block?: ScrollLogicalPosition;
inline?: ScrollLogicalPosition;
}
interface ClipboardEventInit extends EventInit {
data?: string;
dataType?: string;
@@ -18194,7 +18232,7 @@ interface EcdsaParams extends Algorithm {
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
namedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
@@ -18330,6 +18368,13 @@ interface JsonWebKey {
k?: string;
}
interface ParentNode {
readonly children: HTMLCollection;
readonly firstElementChild: Element;
readonly lastElementChild: Element;
readonly childElementCount: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -18400,7 +18445,7 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msCredentials: MSCredentials;
declare var name: string;
declare const name: never;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
declare var onabort: (this: Window, ev: UIEvent) => any;
@@ -18494,7 +18539,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
declare var onunload: (this: Window, ev: Event) => any;
declare var onvolumechange: (this: Window, ev: Event) => any;
declare var onwaiting: (this: Window, ev: Event) => any;
declare var opener: Window;
declare var opener: any;
declare var orientation: string | number;
declare var outerHeight: number;
declare var outerWidth: number;
@@ -18547,6 +18592,9 @@ declare function webkitCancelAnimationFrame(handle: number): void;
declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
@@ -18702,6 +18750,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
type payloadtype = number;
type ScrollBehavior = "auto" | "instant" | "smooth";
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
+55 -15
View File
@@ -142,6 +142,7 @@ interface KeyAlgorithm {
}
interface KeyboardEventInit extends EventModifierInit {
code?: string;
key?: string;
location?: number;
repeat?: boolean;
@@ -2304,7 +2305,7 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
/**
* Sets or gets the URL for the current document.
*/
@@ -3367,7 +3368,7 @@ declare var Document: {
new(): Document;
}
interface DocumentFragment extends Node, NodeSelector {
interface DocumentFragment extends Node, NodeSelector, ParentNode {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -3436,7 +3437,7 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
readonly clientHeight: number;
@@ -3691,6 +3692,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
closest(selector: string): Element | null;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -4462,7 +4473,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(callback: (result: Blob | null) => void, ... arguments: any[]): void;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
}
declare var HTMLCanvasElement: {
@@ -4637,11 +4648,7 @@ interface HTMLElement extends Element {
click(): void;
dragDrop(): boolean;
focus(): void;
insertAdjacentElement(position: string, insertedElement: Element): Element;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
msGetInputContext(): MSInputMethodContext;
scrollIntoView(top?: boolean): void;
setActive(): void;
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -5906,6 +5913,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
*/
type: string;
import?: Document;
integrity: string;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6194,7 +6202,7 @@ interface HTMLMediaElement extends HTMLElement {
*/
canPlayType(type: string): string;
/**
* Fires immediately after the client loads the object.
* Resets the audio or video object and loads a new media resource.
*/
load(): void;
/**
@@ -6767,6 +6775,7 @@ interface HTMLScriptElement extends HTMLElement {
* Sets or retrieves the MIME type for the associated scripting engine.
*/
type: string;
integrity: string;
}
declare var HTMLScriptElement: {
@@ -7772,6 +7781,7 @@ interface KeyboardEvent extends UIEvent {
readonly repeat: boolean;
readonly shiftKey: boolean;
readonly which: number;
readonly code: string;
getModifierState(keyArg: string): boolean;
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
readonly DOM_KEY_LOCATION_JOYSTICK: number;
@@ -9144,6 +9154,7 @@ interface PerformanceTiming {
readonly responseStart: number;
readonly unloadEventEnd: number;
readonly unloadEventStart: number;
readonly secureConnectionStart: number;
toJSON(): any;
}
@@ -11421,8 +11432,8 @@ declare var StereoPannerNode: {
interface Storage {
readonly length: number;
clear(): void;
getItem(key: string): string;
key(index: number): string;
getItem(key: string): string | null;
key(index: number): string | null;
removeItem(key: string): void;
setItem(key: string, data: string): void;
[key: string]: any;
@@ -12963,7 +12974,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
onunload: (this: this, ev: Event) => any;
onvolumechange: (this: this, ev: Event) => any;
onwaiting: (this: this, ev: Event) => any;
readonly opener: Window;
opener: any;
orientation: string | number;
readonly outerHeight: number;
readonly outerWidth: number;
@@ -13018,6 +13029,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -14045,6 +14059,20 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
interface ScrollOptions {
behavior?: ScrollBehavior;
}
interface ScrollToOptions extends ScrollOptions {
left?: number;
top?: number;
}
interface ScrollIntoViewOptions extends ScrollOptions {
block?: ScrollLogicalPosition;
inline?: ScrollLogicalPosition;
}
interface ClipboardEventInit extends EventInit {
data?: string;
dataType?: string;
@@ -14088,7 +14116,7 @@ interface EcdsaParams extends Algorithm {
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
namedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
@@ -14224,6 +14252,13 @@ interface JsonWebKey {
k?: string;
}
interface ParentNode {
readonly children: HTMLCollection;
readonly firstElementChild: Element;
readonly lastElementChild: Element;
readonly childElementCount: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -14294,7 +14329,7 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msCredentials: MSCredentials;
declare var name: string;
declare const name: never;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
declare var onabort: (this: Window, ev: UIEvent) => any;
@@ -14388,7 +14423,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
declare var onunload: (this: Window, ev: Event) => any;
declare var onvolumechange: (this: Window, ev: Event) => any;
declare var onwaiting: (this: Window, ev: Event) => any;
declare var opener: Window;
declare var opener: any;
declare var orientation: string | number;
declare var outerHeight: number;
declare var outerWidth: number;
@@ -14441,6 +14476,9 @@ declare function webkitCancelAnimationFrame(handle: number): void;
declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
@@ -14596,6 +14634,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
type payloadtype = number;
type ScrollBehavior = "auto" | "instant" | "smooth";
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
+29 -1
View File
@@ -84,6 +84,10 @@ interface ArrayConstructor {
of<T>(...items: T[]): Array<T>;
}
interface DateConstructor {
new (value: Date): Date;
}
interface Function {
/**
* Returns the name of the function. Function names are read-only and can not be changed.
@@ -242,7 +246,7 @@ interface NumberConstructor {
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 1.
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 1.
*/
readonly MAX_SAFE_INTEGER: number;
@@ -359,6 +363,30 @@ interface ObjectConstructor {
defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;
}
interface ReadonlyArray<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
}
interface RegExp {
/**
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
+20
View File
@@ -79,6 +79,26 @@ interface ArrayConstructor {
from<T>(iterable: Iterable<T>): Array<T>;
}
interface ReadonlyArray<T> {
/** Iterator */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, T]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<T>;
}
interface IArguments {
/** Iterator */
[Symbol.iterator](): IterableIterator<any>;
+13 -3
View File
@@ -529,8 +529,8 @@ interface NumberConstructor {
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
declare const Number: NumberConstructor;
interface TemplateStringsArray extends Array<string> {
readonly raw: string[];
interface TemplateStringsArray extends ReadonlyArray<string> {
readonly raw: ReadonlyArray<string>
}
interface Math {
@@ -1022,7 +1022,12 @@ interface ReadonlyArray<T> {
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[]): T[];
concat(...items: T[][]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: (T | T[])[]): T[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
@@ -1124,6 +1129,11 @@ interface Array<T> {
* Removes the last element from an array and returns it.
*/
pop(): T | undefined;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[][]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
+117 -19
View File
@@ -529,8 +529,8 @@ interface NumberConstructor {
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
declare const Number: NumberConstructor;
interface TemplateStringsArray extends Array<string> {
readonly raw: string[];
interface TemplateStringsArray extends ReadonlyArray<string> {
readonly raw: ReadonlyArray<string>
}
interface Math {
@@ -1022,7 +1022,12 @@ interface ReadonlyArray<T> {
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[]): T[];
concat(...items: T[][]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: (T | T[])[]): T[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
@@ -1124,6 +1129,11 @@ interface Array<T> {
* Removes the last element from an array and returns it.
*/
pop(): T | undefined;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat(...items: T[][]): T[];
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
@@ -4190,6 +4200,10 @@ interface ArrayConstructor {
of<T>(...items: T[]): Array<T>;
}
interface DateConstructor {
new (value: Date): Date;
}
interface Function {
/**
* Returns the name of the function. Function names are read-only and can not be changed.
@@ -4348,7 +4362,7 @@ interface NumberConstructor {
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 1.
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 1.
*/
readonly MAX_SAFE_INTEGER: number;
@@ -4465,6 +4479,30 @@ interface ObjectConstructor {
defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;
}
interface ReadonlyArray<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
}
interface RegExp {
/**
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
@@ -4754,6 +4792,26 @@ interface ArrayConstructor {
from<T>(iterable: Iterable<T>): Array<T>;
}
interface ReadonlyArray<T> {
/** Iterator */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, T]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<T>;
}
interface IArguments {
/** Iterator */
[Symbol.iterator](): IterableIterator<any>;
@@ -5808,6 +5866,7 @@ interface KeyAlgorithm {
}
interface KeyboardEventInit extends EventModifierInit {
code?: string;
key?: string;
location?: number;
repeat?: boolean;
@@ -7970,7 +8029,7 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
/**
* Sets or gets the URL for the current document.
*/
@@ -9033,7 +9092,7 @@ declare var Document: {
new(): Document;
}
interface DocumentFragment extends Node, NodeSelector {
interface DocumentFragment extends Node, NodeSelector, ParentNode {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9102,7 +9161,7 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
readonly clientHeight: number;
@@ -9357,6 +9416,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
closest(selector: string): Element | null;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -10128,7 +10197,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(callback: (result: Blob | null) => void, ... arguments: any[]): void;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
}
declare var HTMLCanvasElement: {
@@ -10303,11 +10372,7 @@ interface HTMLElement extends Element {
click(): void;
dragDrop(): boolean;
focus(): void;
insertAdjacentElement(position: string, insertedElement: Element): Element;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
msGetInputContext(): MSInputMethodContext;
scrollIntoView(top?: boolean): void;
setActive(): void;
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -11572,6 +11637,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
*/
type: string;
import?: Document;
integrity: string;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11860,7 +11926,7 @@ interface HTMLMediaElement extends HTMLElement {
*/
canPlayType(type: string): string;
/**
* Fires immediately after the client loads the object.
* Resets the audio or video object and loads a new media resource.
*/
load(): void;
/**
@@ -12433,6 +12499,7 @@ interface HTMLScriptElement extends HTMLElement {
* Sets or retrieves the MIME type for the associated scripting engine.
*/
type: string;
integrity: string;
}
declare var HTMLScriptElement: {
@@ -13438,6 +13505,7 @@ interface KeyboardEvent extends UIEvent {
readonly repeat: boolean;
readonly shiftKey: boolean;
readonly which: number;
readonly code: string;
getModifierState(keyArg: string): boolean;
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
readonly DOM_KEY_LOCATION_JOYSTICK: number;
@@ -14810,6 +14878,7 @@ interface PerformanceTiming {
readonly responseStart: number;
readonly unloadEventEnd: number;
readonly unloadEventStart: number;
readonly secureConnectionStart: number;
toJSON(): any;
}
@@ -17087,8 +17156,8 @@ declare var StereoPannerNode: {
interface Storage {
readonly length: number;
clear(): void;
getItem(key: string): string;
key(index: number): string;
getItem(key: string): string | null;
key(index: number): string | null;
removeItem(key: string): void;
setItem(key: string, data: string): void;
[key: string]: any;
@@ -18629,7 +18698,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
onunload: (this: this, ev: Event) => any;
onvolumechange: (this: this, ev: Event) => any;
onwaiting: (this: this, ev: Event) => any;
readonly opener: Window;
opener: any;
orientation: string | number;
readonly outerHeight: number;
readonly outerWidth: number;
@@ -18684,6 +18753,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -19711,6 +19783,20 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
interface ScrollOptions {
behavior?: ScrollBehavior;
}
interface ScrollToOptions extends ScrollOptions {
left?: number;
top?: number;
}
interface ScrollIntoViewOptions extends ScrollOptions {
block?: ScrollLogicalPosition;
inline?: ScrollLogicalPosition;
}
interface ClipboardEventInit extends EventInit {
data?: string;
dataType?: string;
@@ -19754,7 +19840,7 @@ interface EcdsaParams extends Algorithm {
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
namedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
@@ -19890,6 +19976,13 @@ interface JsonWebKey {
k?: string;
}
interface ParentNode {
readonly children: HTMLCollection;
readonly firstElementChild: Element;
readonly lastElementChild: Element;
readonly childElementCount: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -19960,7 +20053,7 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msCredentials: MSCredentials;
declare var name: string;
declare const name: never;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
declare var onabort: (this: Window, ev: UIEvent) => any;
@@ -20054,7 +20147,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
declare var onunload: (this: Window, ev: Event) => any;
declare var onvolumechange: (this: Window, ev: Event) => any;
declare var onwaiting: (this: Window, ev: Event) => any;
declare var opener: Window;
declare var opener: any;
declare var orientation: string | number;
declare var outerHeight: number;
declare var outerWidth: number;
@@ -20107,6 +20200,9 @@ declare function webkitCancelAnimationFrame(handle: number): void;
declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
@@ -20262,6 +20358,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
type payloadtype = number;
type ScrollBehavior = "auto" | "instant" | "smooth";
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
+1 -1
View File
@@ -1016,7 +1016,7 @@ interface EcdsaParams extends Algorithm {
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
namedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
+2712 -1974
View File
File diff suppressed because it is too large Load Diff
+3133 -2274
View File
File diff suppressed because it is too large Load Diff
+242 -114
View File
@@ -1,8 +1,11 @@
/// <reference path="../../src/server/protocol.d.ts" />
declare namespace ts {
interface Map<T> {
interface MapLike<T> {
[index: string]: T;
}
interface Map<T> extends MapLike<T> {
__mapBrand: any;
}
type Path = string & {
__pathBrand: any;
};
@@ -185,7 +188,7 @@ declare namespace ts {
IntersectionType = 163,
ParenthesizedType = 164,
ThisType = 165,
StringLiteralType = 166,
LiteralType = 166,
ObjectBindingPattern = 167,
ArrayBindingPattern = 168,
BindingElement = 169,
@@ -301,8 +304,12 @@ declare namespace ts {
JSDocTypedefTag = 279,
JSDocPropertyTag = 280,
JSDocTypeLiteral = 281,
SyntaxList = 282,
Count = 283,
JSDocLiteralType = 282,
JSDocNullKeyword = 283,
JSDocUndefinedKeyword = 284,
JSDocNeverKeyword = 285,
SyntaxList = 286,
Count = 287,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
@@ -327,9 +334,9 @@ declare namespace ts {
LastBinaryOperator = 68,
FirstNode = 139,
FirstJSDocNode = 257,
LastJSDocNode = 281,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
LastJSDocTagNode = 281,
LastJSDocTagNode = 285,
}
const enum NodeFlags {
None = 0,
@@ -595,8 +602,9 @@ declare namespace ts {
interface ParenthesizedTypeNode extends TypeNode {
type: TypeNode;
}
interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
interface LiteralTypeNode extends TypeNode {
_stringLiteralTypeBrand: any;
literal: Expression;
}
interface StringLiteral extends LiteralExpression {
_stringLiteralBrand: any;
@@ -705,11 +713,16 @@ declare namespace ts {
properties: NodeArray<ObjectLiteralElement>;
multiLine?: boolean;
}
type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
name: Identifier;
}
type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression;
interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
_propertyAccessExpressionLikeQualifiedNameBrand?: any;
expression: EntityNameExpression;
}
interface ElementAccessExpression extends MemberExpression {
expression: LeftHandSideExpression;
argumentExpression?: Expression;
@@ -1022,6 +1035,9 @@ declare namespace ts {
interface JSDocThisType extends JSDocType {
type: JSDocType;
}
interface JSDocLiteralType extends JSDocType {
literal: LiteralTypeNode;
}
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
interface JSDocRecordMember extends PropertySignature {
name: Identifier | LiteralExpression;
@@ -1100,6 +1116,11 @@ declare namespace ts {
clauseEnd: number;
antecedent: FlowNode;
}
type FlowType = Type | IncompleteType;
interface IncompleteType {
flags: TypeFlags;
type: Type;
}
interface AmdDependency {
path: string;
name: string;
@@ -1297,6 +1318,7 @@ declare namespace ts {
InElementType = 64,
UseFullyQualifiedType = 128,
InFirstTypeArgument = 256,
InTypeAlias = 512,
}
const enum SymbolFormatFlags {
None = 0,
@@ -1364,7 +1386,7 @@ declare namespace ts {
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult;
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
getReferencedValueDeclaration(reference: Identifier): Declaration;
getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind;
@@ -1372,7 +1394,7 @@ declare namespace ts {
moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean;
isArgumentsLocalBinding(node: Identifier): boolean;
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile;
getTypeReferenceDirectivesForEntityName(name: EntityName | PropertyAccessExpression): string[];
getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[];
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[];
}
const enum SymbolFlags {
@@ -1411,18 +1433,18 @@ declare namespace ts {
Enum = 384,
Variable = 3,
Value = 107455,
Type = 793056,
Namespace = 1536,
Type = 793064,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
FunctionScopedVariableExcludes = 107454,
BlockScopedVariableExcludes = 107455,
ParameterExcludes = 107455,
PropertyExcludes = 0,
EnumMemberExcludes = 107455,
EnumMemberExcludes = 900095,
FunctionExcludes = 106927,
ClassExcludes = 899519,
InterfaceExcludes = 792960,
InterfaceExcludes = 792968,
RegularEnumExcludes = 899327,
ConstEnumExcludes = 899967,
ValueModuleExcludes = 106639,
@@ -1430,8 +1452,8 @@ declare namespace ts {
MethodExcludes = 99263,
GetAccessorExcludes = 41919,
SetAccessorExcludes = 74687,
TypeParameterExcludes = 530912,
TypeAliasExcludes = 793056,
TypeParameterExcludes = 530920,
TypeAliasExcludes = 793064,
AliasExcludes = 8388608,
ModuleMember = 8914931,
ExportHasLocal = 944,
@@ -1458,6 +1480,8 @@ declare namespace ts {
exportSymbol?: Symbol;
constEnumOnlyModule?: boolean;
isReferenced?: boolean;
isReplaceableByMethod?: boolean;
isAssigned?: boolean;
}
interface SymbolLinks {
target?: Symbol;
@@ -1469,6 +1493,8 @@ declare namespace ts {
mapper?: TypeMapper;
referenced?: boolean;
containingType?: UnionOrIntersectionType;
hasCommonType?: boolean;
isDiscriminantProperty?: boolean;
resolvedExports?: SymbolTable;
exportsChecked?: boolean;
isDeclarationWithCollidingName?: boolean;
@@ -1477,9 +1503,7 @@ declare namespace ts {
}
interface TransientSymbol extends Symbol, SymbolLinks {
}
interface SymbolTable {
[index: string]: Symbol;
}
type SymbolTable = Map<Symbol>;
interface Pattern {
prefix: string;
suffix: string;
@@ -1506,13 +1530,14 @@ declare namespace ts {
ClassWithBodyScopedClassBinding = 524288,
BodyScopedClassBinding = 1048576,
NeedsLoopOutParameter = 2097152,
AssignmentsMarked = 4194304,
}
interface NodeLinks {
flags?: NodeCheckFlags;
resolvedType?: Type;
resolvedSignature?: Signature;
resolvedSymbol?: Symbol;
resolvedIndexInfo?: IndexInfo;
flags?: NodeCheckFlags;
enumMemberValue?: number;
isVisible?: boolean;
hasReportedStatementInAmbientContext?: boolean;
@@ -1527,42 +1552,50 @@ declare namespace ts {
String = 2,
Number = 4,
Boolean = 8,
Void = 16,
Undefined = 32,
Null = 64,
Enum = 128,
StringLiteral = 256,
TypeParameter = 512,
Class = 1024,
Interface = 2048,
Reference = 4096,
Tuple = 8192,
Union = 16384,
Intersection = 32768,
Anonymous = 65536,
Instantiated = 131072,
FromSignature = 262144,
ObjectLiteral = 524288,
FreshObjectLiteral = 1048576,
ContainsWideningType = 2097152,
ContainsObjectLiteral = 4194304,
ContainsAnyFunctionType = 8388608,
ESSymbol = 16777216,
ThisType = 33554432,
ObjectLiteralPatternWithComputedProperties = 67108864,
Never = 134217728,
Nullable = 96,
Falsy = 112,
Intrinsic = 150995071,
Primitive = 16777726,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
UnionOrIntersection = 49152,
StructuredType = 130048,
Narrowable = 16908175,
RequiresWidening = 6291456,
PropagatingFlags = 14680064,
Enum = 16,
StringLiteral = 32,
NumberLiteral = 64,
BooleanLiteral = 128,
EnumLiteral = 256,
ESSymbol = 512,
Void = 1024,
Undefined = 2048,
Null = 4096,
Never = 8192,
TypeParameter = 16384,
Class = 32768,
Interface = 65536,
Reference = 131072,
Tuple = 262144,
Union = 524288,
Intersection = 1048576,
Anonymous = 2097152,
Instantiated = 4194304,
ObjectLiteral = 8388608,
FreshObjectLiteral = 16777216,
ContainsWideningType = 33554432,
ContainsObjectLiteral = 67108864,
ContainsAnyFunctionType = 134217728,
ThisType = 268435456,
ObjectLiteralPatternWithComputedProperties = 536870912,
Nullable = 6144,
Literal = 480,
DefinitelyFalsy = 7392,
PossiblyFalsy = 7406,
Intrinsic = 16015,
Primitive = 8190,
StringLike = 34,
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
ObjectType = 2588672,
UnionOrIntersection = 1572864,
StructuredType = 4161536,
StructuredOrTypeParameter = 4177920,
Narrowable = 4178943,
NotUnionOrUnit = 2589191,
RequiresWidening = 100663296,
PropagatingFlags = 234881024,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@@ -1570,13 +1603,21 @@ declare namespace ts {
id: number;
symbol?: Symbol;
pattern?: DestructuringPattern;
aliasSymbol?: Symbol;
aliasTypeArguments?: Type[];
}
interface IntrinsicType extends Type {
intrinsicName: string;
}
interface StringLiteralType extends Type {
interface LiteralType extends Type {
text: string;
}
interface EnumType extends Type {
memberTypes: Map<EnumLiteralType>;
}
interface EnumLiteralType extends LiteralType {
baseType: EnumType & UnionType;
}
interface ObjectType extends Type {
}
interface InterfaceType extends ObjectType {
@@ -1601,13 +1642,10 @@ declare namespace ts {
interface GenericType extends InterfaceType, TypeReference {
instantiations: Map<TypeReference>;
}
interface TupleType extends ObjectType {
elementTypes: Type[];
}
interface UnionOrIntersectionType extends Type {
types: Type[];
reducedType: Type;
resolvedProperties: SymbolTable;
couldContainTypeParameters: boolean;
}
interface UnionType extends UnionOrIntersectionType {
}
@@ -1650,7 +1688,7 @@ declare namespace ts {
resolvedReturnType: Type;
minArgumentCount: number;
hasRestParameter: boolean;
hasStringLiterals: boolean;
hasLiteralTypes: boolean;
target?: Signature;
mapper?: TypeMapper;
unionSignatures?: Signature[];
@@ -1670,6 +1708,7 @@ declare namespace ts {
interface TypeMapper {
(t: TypeParameter): Type;
mappedTypes?: Type[];
targetTypes?: Type[];
instantiations?: Type[];
context?: InferenceContext;
}
@@ -1723,7 +1762,7 @@ declare namespace ts {
NodeJs = 2,
}
type RootPaths = string[];
type PathSubstitutions = Map<string[]>;
type PathSubstitutions = MapLike<string[]>;
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions;
interface CompilerOptions {
@@ -1738,6 +1777,7 @@ declare namespace ts {
declaration?: boolean;
declarationDir?: string;
diagnostics?: boolean;
extendedDiagnostics?: boolean;
disableSizeLimit?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
@@ -1863,7 +1903,7 @@ declare namespace ts {
fileNames: string[];
raw?: any;
errors: Diagnostic[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
wildcardDirectories?: MapLike<WatchDirectoryFlags>;
}
const enum WatchDirectoryFlags {
None = 0,
@@ -1871,7 +1911,7 @@ declare namespace ts {
}
interface ExpandResult {
fileNames: string[];
wildcardDirectories: Map<WatchDirectoryFlags>;
wildcardDirectories: MapLike<WatchDirectoryFlags>;
}
interface CommandLineOptionBase {
name: string;
@@ -2030,6 +2070,7 @@ declare namespace ts {
directoryExists?(directoryName: string): boolean;
realpath?(path: string): string;
getCurrentDirectory?(): string;
getDirectories?(path: string): string[];
}
interface ResolvedModule {
resolvedFileName: string;
@@ -2081,12 +2122,25 @@ declare namespace ts {
_children: Node[];
}
}
declare namespace ts {
const timestamp: () => number;
}
declare namespace ts.performance {
function mark(markName: string): void;
function measure(measureName: string, startMarkName?: string, endMarkName?: string): void;
function getCount(markName: string): number;
function getDuration(measureName: string): number;
function forEachMeasure(cb: (measureName: string, duration: number) => void): void;
function enable(): void;
function disable(): void;
}
declare namespace ts {
const enum Ternary {
False = 0,
Maybe = 1,
True = -1,
}
function createMap<T>(template?: MapLike<T>): Map<T>;
function createFileMap<T>(keyMapper?: (key: string) => string): FileMap<T>;
function toPath(fileName: string, basePath: string, getCanonicalFileName: (path: string) => string): Path;
const enum Comparison {
@@ -2094,12 +2148,15 @@ declare namespace ts {
EqualTo = 0,
GreaterThan = 1,
}
function forEach<T, U>(array: T[], callback: (element: T, index: number) => U): U;
function contains<T>(array: T[], value: T, areEqual?: (a: T, b: T) => boolean): boolean;
function forEach<T, U>(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
function find<T>(array: T[], predicate: (element: T, index: number) => boolean): T | undefined;
function findMap<T, U>(array: T[], callback: (element: T, index: number) => U | undefined): U;
function contains<T>(array: T[], value: T): boolean;
function indexOf<T>(array: T[], value: T): number;
function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number;
function countWhere<T>(array: T[], predicate: (x: T) => boolean): number;
function filter<T>(array: T[], f: (x: T) => boolean): T[];
function removeWhere<T>(array: T[], f: (x: T) => boolean): boolean;
function filterMutate<T>(array: T[], f: (x: T) => boolean): void;
function map<T, U>(array: T[], f: (x: T) => U): U[];
function concatenate<T>(array1: T[], array2: T[]): T[];
@@ -2113,18 +2170,20 @@ declare namespace ts {
function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
function hasProperty<T>(map: Map<T>, key: string): boolean;
function getKeys<T>(map: Map<T>): string[];
function getProperty<T>(map: Map<T>, key: string): T;
function isEmpty<T>(map: Map<T>): boolean;
function clone<T>(object: T): T;
function extend<T1 extends Map<{}>, T2 extends Map<{}>>(first: T1, second: T2): T1 & T2;
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
function lookUp<T>(map: Map<T>, key: string): T;
function copyMap<T>(source: Map<T>, target: Map<T>): void;
function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
function hasProperty<T>(map: MapLike<T>, key: string): boolean;
function getProperty<T>(map: MapLike<T>, key: string): T | undefined;
function getOwnKeys<T>(map: MapLike<T>): string[];
function forEachProperty<T, U>(map: Map<T>, callback: (value: T, key: string) => U): U;
function someProperties<T>(map: Map<T>, predicate?: (value: T, key: string) => boolean): boolean;
function copyProperties<T>(source: Map<T>, target: MapLike<T>): void;
function reduceProperties<T, U>(map: Map<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U;
function reduceOwnProperties<T, U>(map: MapLike<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U;
function equalOwnProperties<T>(left: MapLike<T>, right: MapLike<T>, equalityComparer?: (left: T, right: T) => boolean): boolean;
function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
function arrayToMap<T, U>(array: T[], makeKey: (value: T) => string, makeValue: (value: T) => U): Map<U>;
function cloneMap<T>(map: Map<T>): Map<T>;
function clone<T>(object: T): T;
function extend<T1, T2>(first: T1, second: T2): T1 & T2;
function isArray(value: any): value is any[];
function memoize<T>(callback: () => T): () => T;
let localizedDiagnosticMessages: Map<string>;
@@ -2178,6 +2237,7 @@ declare namespace ts {
function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind;
function getScriptKindFromFileName(fileName: string): ScriptKind;
const supportedTypeScriptExtensions: string[];
const supportedTypescriptExtensionsForExtractExtension: string[];
const supportedJavascriptExtensions: string[];
function getSupportedExtensions(options?: CompilerOptions): string[];
function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions): boolean;
@@ -2192,7 +2252,8 @@ declare namespace ts {
function adjustExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority;
function getNextLowestExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority;
function removeFileExtension(path: string): string;
function tryRemoveExtension(path: string, extension: string): string;
function tryRemoveExtension(path: string, extension: string): string | undefined;
function removeExtension(path: string, extension: string): string;
function isJsxOrTsxExtension(ext: string): boolean;
function changeExtension<T extends string | Path>(path: T, newExtension: string): T;
interface ObjectAllocator {
@@ -4896,6 +4957,12 @@ declare namespace ts {
key: string;
message: string;
};
Enum_type_0_has_members_with_initializers_that_are_not_literals: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
JSX_element_attributes_type_0_may_not_be_a_union_type: {
code: number;
category: DiagnosticCategory;
@@ -5178,6 +5245,24 @@ declare namespace ts {
key: string;
message: string;
};
A_class_must_be_declared_after_its_base_class: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Import_declaration_0_is_using_private_name_1: {
code: number;
category: DiagnosticCategory;
@@ -5598,7 +5683,7 @@ declare namespace ts {
key: string;
message: string;
};
Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: {
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: {
code: number;
category: DiagnosticCategory;
key: string;
@@ -5766,6 +5851,12 @@ declare namespace ts {
key: string;
message: string;
};
Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Concatenate_and_emit_output_to_single_file: {
code: number;
category: DiagnosticCategory;
@@ -6486,6 +6577,12 @@ declare namespace ts {
key: string;
message: string;
};
Property_0_is_declared_but_never_used: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Variable_0_implicitly_has_an_1_type: {
code: number;
category: DiagnosticCategory;
@@ -6862,9 +6959,10 @@ declare namespace ts {
optionNameMap: Map<CommandLineOption>;
shortOptionNames: Map<string>;
}
const defaultInitCompilerOptions: CompilerOptions;
function getOptionNameMap(): OptionNameMap;
function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic;
function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): number | string;
function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): string | number;
function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[] | undefined;
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
function readConfigFile(fileName: string, readFile: (path: string) => string): {
@@ -6875,6 +6973,9 @@ declare namespace ts {
config?: any;
error?: Diagnostic;
};
function generateTSConfig(options: CompilerOptions, fileNames: string[]): {
compilerOptions: Map<CompilerOptionsValue>;
};
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine;
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
options: CompilerOptions;
@@ -6913,7 +7014,6 @@ declare namespace ts {
function getSingleLineStringWriter(): StringSymbolWriter;
function releaseStringWriter(writer: StringSymbolWriter): void;
function getFullWidth(node: Node): number;
function mapIsEqualTo<T>(map1: Map<T>, map2: Map<T>): boolean;
function arrayIsEqualTo<T>(array1: T[], array2: T[], equaler?: (a: T, b: T) => boolean): boolean;
function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean;
function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule;
@@ -6933,6 +7033,7 @@ declare namespace ts {
function nodeIsPresent(node: Node): boolean;
function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
function isJSDocNode(node: Node): boolean;
function isJSDocTag(node: Node): boolean;
function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number;
function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia?: boolean): string;
function getTextOfNodeFromSourceText(sourceText: string, node: Node): string;
@@ -6988,7 +7089,7 @@ declare namespace ts {
function getSuperContainer(node: Node, stopOnFunctions: boolean): Node;
function getImmediatelyInvokedFunctionExpression(func: Node): CallExpression;
function isSuperPropertyOrElementAccess(node: Node): boolean;
function getEntityNameFromTypeNode(node: TypeNode): EntityName | Expression;
function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression;
function getInvokedExpression(node: CallLikeExpression): Expression;
function nodeCanBeDecorated(node: Node): boolean;
function nodeIsDecorated(node: Node): boolean;
@@ -7032,6 +7133,7 @@ declare namespace ts {
function isLiteralComputedPropertyDeclarationName(node: Node): boolean;
function isIdentifierName(node: Identifier): boolean;
function isAliasSymbolDeclaration(node: Node): boolean;
function exportAssignmentIsAlias(node: ExportAssignment): boolean;
function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration | InterfaceDeclaration): ExpressionWithTypeArguments;
function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration): NodeArray<ExpressionWithTypeArguments>;
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<ExpressionWithTypeArguments>;
@@ -7115,12 +7217,13 @@ declare namespace ts {
function isLeftHandSideExpression(expr: Expression): boolean;
function isAssignmentOperator(token: SyntaxKind): boolean;
function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean;
function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean;
function isEntityNameExpression(node: Expression): node is EntityNameExpression;
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean;
function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean;
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
function hasJavaScriptFileExtension(fileName: string): boolean;
function hasTypeScriptFileExtension(fileName: string): boolean;
function tryExtractTypeScriptExtension(fileName: string): string | undefined;
const stringify: (value: any) => string;
function convertToBase64(input: string): string;
function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string;
@@ -7151,7 +7254,6 @@ declare namespace ts {
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
}
declare namespace ts {
let parseTime: number;
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
@@ -7167,7 +7269,6 @@ declare namespace ts {
};
}
declare namespace ts {
let bindTime: number;
const enum ModuleInstanceState {
NonInstantiated = 0,
Instantiated = 1,
@@ -7178,7 +7279,6 @@ declare namespace ts {
}
declare namespace ts {
function getNodeId(node: Node): number;
let checkTime: number;
function getSymbolId(symbol: Symbol): number;
function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker;
}
@@ -7208,10 +7308,6 @@ declare namespace ts {
function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult;
}
declare namespace ts {
let programTime: number;
let emitTime: number;
let ioReadTime: number;
let ioWriteTime: number;
const version: string;
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
@@ -7226,7 +7322,6 @@ declare namespace ts {
directoryExists?: (directoryName: string) => boolean;
}): boolean;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
const defaultInitCompilerOptions: CompilerOptions;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
interface FormatDiagnosticsHost {
@@ -7236,7 +7331,7 @@ declare namespace ts {
}
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts.BreakpointResolver {
@@ -7353,6 +7448,10 @@ declare namespace ts {
function stripQuotes(name: string): string;
function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean;
function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind;
function parseAndReEmitConfigJSONFile(content: string): {
configJsonObject: any;
diagnostics: Diagnostic[];
};
}
declare namespace ts.JsTyping {
interface TypingResolutionHost {
@@ -7586,6 +7685,11 @@ declare namespace ts.formatting {
SpaceAfterOpenBraceInJsxExpression: Rule;
NoSpaceBeforeCloseBraceInJsxExpression: Rule;
SpaceBeforeCloseBraceInJsxExpression: Rule;
SpaceBeforeJsxAttribute: Rule;
SpaceBeforeSlashInJsxOpeningElement: Rule;
NoSpaceBeforeGreaterThanTokenInJsxOpeningElement: Rule;
NoSpaceBeforeEqualInJsxAttribute: Rule;
NoSpaceAfterEqualInJsxAttribute: Rule;
constructor();
static IsForContext(context: FormattingContext): boolean;
static IsNotForContext(context: FormattingContext): boolean;
@@ -7613,8 +7717,11 @@ declare namespace ts.formatting {
static IsNextTokenNotCloseBracket(context: FormattingContext): boolean;
static IsArrowFunctionContext(context: FormattingContext): boolean;
static IsNonJsxSameLineTokenContext(context: FormattingContext): boolean;
static isNonJsxElementContext(context: FormattingContext): boolean;
static isJsxExpressionContext(context: FormattingContext): boolean;
static IsNonJsxElementContext(context: FormattingContext): boolean;
static IsJsxExpressionContext(context: FormattingContext): boolean;
static IsNextTokenParentJsxAttribute(context: FormattingContext): boolean;
static IsJsxAttributeContext(context: FormattingContext): boolean;
static IsJsxSelfClosingElementContext(context: FormattingContext): boolean;
static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean;
static IsEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean;
static NodeIsInDecoratorContext(node: Node): boolean;
@@ -7819,7 +7926,7 @@ declare namespace ts {
interface IScriptSnapshot {
getText(start: number, end: number): string;
getLength(): number;
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
dispose?(): void;
}
namespace ScriptSnapshot {
@@ -8164,6 +8271,7 @@ declare namespace ts {
const interfaceElement: string;
const typeElement: string;
const enumElement: string;
const enumMemberElement: string;
const variableElement: string;
const localVariableElement: string;
const functionElement: string;
@@ -8255,7 +8363,7 @@ declare namespace ts {
fileName?: string;
reportDiagnostics?: boolean;
moduleName?: string;
renamedDependencies?: Map<string>;
renamedDependencies?: MapLike<string>;
}
interface TranspileOutput {
outputText: string;
@@ -8328,7 +8436,7 @@ declare namespace ts.server {
private immediateId;
private changeSeq;
constructor(host: ServerHost, byteLength: (buf: string, encoding?: string) => number, hrtime: (start?: number[]) => number[], logger: Logger);
private handleEvent(eventName, project, fileName);
private handleEvent(event);
logError(err: Error, cmd: string): void;
private sendLineToClient(line);
send(msg: protocol.Message): void;
@@ -8460,12 +8568,12 @@ declare namespace ts.server {
}
interface ProjectOptions {
files?: string[];
wildcardDirectories?: ts.Map<ts.WatchDirectoryFlags>;
wildcardDirectories?: ts.MapLike<ts.WatchDirectoryFlags>;
compilerOptions?: ts.CompilerOptions;
}
class Project {
projectService: ProjectService;
projectOptions?: ProjectOptions;
projectOptions: ProjectOptions;
languageServiceDiabled: boolean;
compilerService: CompilerService;
projectFilename: string;
@@ -8474,7 +8582,7 @@ declare namespace ts.server {
directoriesWatchedForWildcards: Map<FileWatcher>;
directoriesWatchedForTsconfig: string[];
program: ts.Program;
filenameToSourceFile: ts.Map<ts.SourceFile>;
filenameToSourceFile: Map<SourceFile>;
updateGraphSeq: number;
openRefCount: number;
constructor(projectService: ProjectService, projectOptions?: ProjectOptions, languageServiceDiabled?: boolean);
@@ -8504,8 +8612,22 @@ declare namespace ts.server {
project?: Project;
}
function combineProjectOutput<T>(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean): T[];
type ProjectServiceEvent = {
eventName: "context";
data: {
project: Project;
fileName: string;
};
} | {
eventName: "configFileDiag";
data: {
triggerFile?: string;
configFileName: string;
diagnostics: Diagnostic[];
};
};
interface ProjectServiceEventHandler {
(eventName: string, project: Project, fileName: string): void;
(event: ProjectServiceEvent): void;
}
interface HostConfiguration {
formatCodeOptions: ts.FormatCodeOptions;
@@ -8514,15 +8636,15 @@ declare namespace ts.server {
class ProjectService {
host: ServerHost;
psLogger: Logger;
eventHandler?: ProjectServiceEventHandler;
filenameToScriptInfo: ts.Map<ScriptInfo>;
eventHandler: ProjectServiceEventHandler;
filenameToScriptInfo: Map<ScriptInfo>;
openFileRoots: ScriptInfo[];
inferredProjects: Project[];
configuredProjects: Project[];
openFilesReferenced: ScriptInfo[];
openFileRootsConfigured: ScriptInfo[];
directoryWatchersForTsconfig: ts.Map<FileWatcher>;
directoryWatchersRefCount: ts.Map<number>;
directoryWatchersForTsconfig: Map<FileWatcher>;
directoryWatchersRefCount: Map<number>;
hostConfiguration: HostConfiguration;
timerForDetectingProjectFileListChanges: Map<any>;
constructor(host: ServerHost, psLogger: Logger, eventHandler?: ProjectServiceEventHandler);
@@ -8532,6 +8654,7 @@ declare namespace ts.server {
directoryWatchedForSourceFilesChanged(project: Project, fileName: string): void;
startTimerForDetectingProjectFileListChanges(project: Project): void;
handleProjectFileListChanges(project: Project): void;
reportConfigFileDiagnostics(configFileName: string, diagnostics: Diagnostic[], triggerFile?: string): void;
directoryWatchedForTsconfigChanged(fileName: string): void;
getCanonicalFileName(fileName: string): string;
watchedProjectConfigFileChanged(project: Project): void;
@@ -8566,15 +8689,13 @@ declare namespace ts.server {
configProjectIsActive(fileName: string): boolean;
findConfiguredProjectByConfigFile(configFileName: string): Project;
configFileToProjectOptions(configFilename: string): {
succeeded: boolean;
projectOptions?: ProjectOptions;
errors?: Diagnostic[];
errors: Diagnostic[];
};
private exceedTotalNonTsFileSizeLimit(fileNames);
openConfigFile(configFilename: string, clientFileName?: string): {
success: boolean;
project?: Project;
errors?: Diagnostic[];
errors: Diagnostic[];
};
updateConfiguredProject(project: Project): Diagnostic[];
createProject(projectFilename: string, projectOptions?: ProjectOptions, languageServiceDisabled?: boolean): Project;
@@ -8621,7 +8742,7 @@ declare namespace ts.server {
class TextChange {
pos: number;
deleteLen: number;
insertedText?: string;
insertedText: string;
constructor(pos: number, deleteLen: number, insertedText?: string);
getTextChangeRange(): TextChangeRange;
}
@@ -8747,11 +8868,16 @@ declare namespace ts {
getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string;
directoryExists(directoryName: string): boolean;
}
interface CoreServicesShimHost extends Logger, ModuleResolutionHost {
readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string;
useCaseSensitiveFileNames?(): boolean;
interface CoreServicesShimHost extends Logger {
directoryExists(directoryName: string): boolean;
fileExists(fileName: string): boolean;
getCurrentDirectory(): string;
getDirectories(path: string): string;
readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string;
readFile(fileName: string): string;
realpath?(path: string): string;
trace(s: string): void;
useCaseSensitiveFileNames?(): boolean;
}
interface IFileReference {
path: string;
@@ -8810,6 +8936,7 @@ declare namespace ts {
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string;
}
interface CoreServicesShim extends Shim {
getAutomaticTypeDirectiveNames(compilerOptionsJson: string): string;
getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string;
getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string;
getDefaultCompilationSettings(): string;
@@ -8850,6 +8977,7 @@ declare namespace ts {
fileExists(fileName: string): boolean;
readFile(fileName: string): string;
private readDirectoryFallback(rootDir, extension, exclude);
getDirectories(path: string): string[];
}
function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): {
message: string;
+3130 -2271
View File
File diff suppressed because it is too large Load Diff
+89 -53
View File
@@ -14,9 +14,12 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
interface Map<T> {
interface MapLike<T> {
[index: string]: T;
}
interface Map<T> extends MapLike<T> {
__mapBrand: any;
}
type Path = string & {
__pathBrand: any;
};
@@ -199,7 +202,7 @@ declare namespace ts {
IntersectionType = 163,
ParenthesizedType = 164,
ThisType = 165,
StringLiteralType = 166,
LiteralType = 166,
ObjectBindingPattern = 167,
ArrayBindingPattern = 168,
BindingElement = 169,
@@ -315,8 +318,12 @@ declare namespace ts {
JSDocTypedefTag = 279,
JSDocPropertyTag = 280,
JSDocTypeLiteral = 281,
SyntaxList = 282,
Count = 283,
JSDocLiteralType = 282,
JSDocNullKeyword = 283,
JSDocUndefinedKeyword = 284,
JSDocNeverKeyword = 285,
SyntaxList = 286,
Count = 287,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
@@ -341,9 +348,9 @@ declare namespace ts {
LastBinaryOperator = 68,
FirstNode = 139,
FirstJSDocNode = 257,
LastJSDocNode = 281,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
LastJSDocTagNode = 281,
LastJSDocTagNode = 285,
}
enum NodeFlags {
None = 0,
@@ -607,8 +614,9 @@ declare namespace ts {
interface ParenthesizedTypeNode extends TypeNode {
type: TypeNode;
}
interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
interface LiteralTypeNode extends TypeNode {
_stringLiteralTypeBrand: any;
literal: Expression;
}
interface StringLiteral extends LiteralExpression {
_stringLiteralBrand: any;
@@ -714,11 +722,17 @@ declare namespace ts {
interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
properties: NodeArray<ObjectLiteralElement>;
}
type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
name: Identifier;
}
type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression;
/** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */
interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
_propertyAccessExpressionLikeQualifiedNameBrand?: any;
expression: EntityNameExpression;
}
interface ElementAccessExpression extends MemberExpression {
expression: LeftHandSideExpression;
argumentExpression?: Expression;
@@ -1031,6 +1045,9 @@ declare namespace ts {
interface JSDocThisType extends JSDocType {
type: JSDocType;
}
interface JSDocLiteralType extends JSDocType {
literal: LiteralTypeNode;
}
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
interface JSDocRecordMember extends PropertySignature {
name: Identifier | LiteralExpression;
@@ -1109,6 +1126,11 @@ declare namespace ts {
clauseEnd: number;
antecedent: FlowNode;
}
type FlowType = Type | IncompleteType;
interface IncompleteType {
flags: TypeFlags;
type: Type;
}
interface AmdDependency {
path: string;
name: string;
@@ -1305,6 +1327,7 @@ declare namespace ts {
InElementType = 64,
UseFullyQualifiedType = 128,
InFirstTypeArgument = 256,
InTypeAlias = 512,
}
enum SymbolFormatFlags {
None = 0,
@@ -1363,18 +1386,18 @@ declare namespace ts {
Enum = 384,
Variable = 3,
Value = 107455,
Type = 793056,
Namespace = 1536,
Type = 793064,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
FunctionScopedVariableExcludes = 107454,
BlockScopedVariableExcludes = 107455,
ParameterExcludes = 107455,
PropertyExcludes = 0,
EnumMemberExcludes = 107455,
EnumMemberExcludes = 900095,
FunctionExcludes = 106927,
ClassExcludes = 899519,
InterfaceExcludes = 792960,
InterfaceExcludes = 792968,
RegularEnumExcludes = 899327,
ConstEnumExcludes = 899967,
ValueModuleExcludes = 106639,
@@ -1382,8 +1405,8 @@ declare namespace ts {
MethodExcludes = 99263,
GetAccessorExcludes = 41919,
SetAccessorExcludes = 74687,
TypeParameterExcludes = 530912,
TypeAliasExcludes = 793056,
TypeParameterExcludes = 530920,
TypeAliasExcludes = 793064,
AliasExcludes = 8388608,
ModuleMember = 8914931,
ExportHasLocal = 944,
@@ -1403,49 +1426,63 @@ declare namespace ts {
exports?: SymbolTable;
globalExports?: SymbolTable;
}
interface SymbolTable {
[index: string]: Symbol;
}
type SymbolTable = Map<Symbol>;
enum TypeFlags {
Any = 1,
String = 2,
Number = 4,
Boolean = 8,
Void = 16,
Undefined = 32,
Null = 64,
Enum = 128,
StringLiteral = 256,
TypeParameter = 512,
Class = 1024,
Interface = 2048,
Reference = 4096,
Tuple = 8192,
Union = 16384,
Intersection = 32768,
Anonymous = 65536,
Instantiated = 131072,
ObjectLiteral = 524288,
ESSymbol = 16777216,
ThisType = 33554432,
ObjectLiteralPatternWithComputedProperties = 67108864,
Never = 134217728,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
UnionOrIntersection = 49152,
StructuredType = 130048,
Narrowable = 16908175,
Enum = 16,
StringLiteral = 32,
NumberLiteral = 64,
BooleanLiteral = 128,
EnumLiteral = 256,
ESSymbol = 512,
Void = 1024,
Undefined = 2048,
Null = 4096,
Never = 8192,
TypeParameter = 16384,
Class = 32768,
Interface = 65536,
Reference = 131072,
Tuple = 262144,
Union = 524288,
Intersection = 1048576,
Anonymous = 2097152,
Instantiated = 4194304,
ThisType = 268435456,
ObjectLiteralPatternWithComputedProperties = 536870912,
Literal = 480,
PossiblyFalsy = 7406,
StringLike = 34,
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
ObjectType = 2588672,
UnionOrIntersection = 1572864,
StructuredType = 4161536,
StructuredOrTypeParameter = 4177920,
Narrowable = 4178943,
NotUnionOrUnit = 2589191,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
flags: TypeFlags;
symbol?: Symbol;
pattern?: DestructuringPattern;
aliasSymbol?: Symbol;
aliasTypeArguments?: Type[];
}
interface StringLiteralType extends Type {
interface LiteralType extends Type {
text: string;
}
interface EnumType extends Type {
memberTypes: Map<EnumLiteralType>;
}
interface EnumLiteralType extends LiteralType {
baseType: EnumType & UnionType;
}
interface ObjectType extends Type {
}
interface InterfaceType extends ObjectType {
@@ -1467,9 +1504,6 @@ declare namespace ts {
}
interface GenericType extends InterfaceType, TypeReference {
}
interface TupleType extends ObjectType {
elementTypes: Type[];
}
interface UnionOrIntersectionType extends Type {
types: Type[];
}
@@ -1534,7 +1568,7 @@ declare namespace ts {
NodeJs = 2,
}
type RootPaths = string[];
type PathSubstitutions = Map<string[]>;
type PathSubstitutions = MapLike<string[]>;
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions;
interface CompilerOptions {
@@ -1659,7 +1693,7 @@ declare namespace ts {
fileNames: string[];
raw?: any;
errors: Diagnostic[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
wildcardDirectories?: MapLike<WatchDirectoryFlags>;
}
enum WatchDirectoryFlags {
None = 0,
@@ -1667,7 +1701,7 @@ declare namespace ts {
}
interface ExpandResult {
fileNames: string[];
wildcardDirectories: Map<WatchDirectoryFlags>;
wildcardDirectories: MapLike<WatchDirectoryFlags>;
}
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
@@ -1676,6 +1710,7 @@ declare namespace ts {
directoryExists?(directoryName: string): boolean;
realpath?(path: string): string;
getCurrentDirectory?(): string;
getDirectories?(path: string): string[];
}
interface ResolvedModule {
resolvedFileName: string;
@@ -1876,14 +1911,14 @@ declare namespace ts {
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
/**
* Given a set of options and a set of root files, returns the set of type directive names
* Given a set of options, returns the set of type directive names
* that should be included for this program automatically.
* This list could either come from the config file,
* or from enumerating the types root + initial secondary types lookup location.
* More type directives might appear in the program later as a result of loading actual source files;
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts {
@@ -1989,7 +2024,7 @@ declare namespace ts {
* change range cannot be determined. However, in that case, incremental parsing will
* not happen and the entire document will be re - parsed.
*/
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
/** Releases all resources held by this script snapshot */
dispose?(): void;
}
@@ -2437,6 +2472,7 @@ declare namespace ts {
const typeElement: string;
/** enum E */
const enumElement: string;
const enumMemberElement: string;
/**
* Inside module and script only
* const v = ..
@@ -2549,7 +2585,7 @@ declare namespace ts {
fileName?: string;
reportDiagnostics?: boolean;
moduleName?: string;
renamedDependencies?: Map<string>;
renamedDependencies?: MapLike<string>;
}
interface TranspileOutput {
outputText: string;
+3401 -2257
View File
File diff suppressed because it is too large Load Diff
+89 -53
View File
@@ -14,9 +14,12 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
interface Map<T> {
interface MapLike<T> {
[index: string]: T;
}
interface Map<T> extends MapLike<T> {
__mapBrand: any;
}
type Path = string & {
__pathBrand: any;
};
@@ -199,7 +202,7 @@ declare namespace ts {
IntersectionType = 163,
ParenthesizedType = 164,
ThisType = 165,
StringLiteralType = 166,
LiteralType = 166,
ObjectBindingPattern = 167,
ArrayBindingPattern = 168,
BindingElement = 169,
@@ -315,8 +318,12 @@ declare namespace ts {
JSDocTypedefTag = 279,
JSDocPropertyTag = 280,
JSDocTypeLiteral = 281,
SyntaxList = 282,
Count = 283,
JSDocLiteralType = 282,
JSDocNullKeyword = 283,
JSDocUndefinedKeyword = 284,
JSDocNeverKeyword = 285,
SyntaxList = 286,
Count = 287,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
@@ -341,9 +348,9 @@ declare namespace ts {
LastBinaryOperator = 68,
FirstNode = 139,
FirstJSDocNode = 257,
LastJSDocNode = 281,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
LastJSDocTagNode = 281,
LastJSDocTagNode = 285,
}
enum NodeFlags {
None = 0,
@@ -607,8 +614,9 @@ declare namespace ts {
interface ParenthesizedTypeNode extends TypeNode {
type: TypeNode;
}
interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
interface LiteralTypeNode extends TypeNode {
_stringLiteralTypeBrand: any;
literal: Expression;
}
interface StringLiteral extends LiteralExpression {
_stringLiteralBrand: any;
@@ -714,11 +722,17 @@ declare namespace ts {
interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
properties: NodeArray<ObjectLiteralElement>;
}
type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
name: Identifier;
}
type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression;
/** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */
interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
_propertyAccessExpressionLikeQualifiedNameBrand?: any;
expression: EntityNameExpression;
}
interface ElementAccessExpression extends MemberExpression {
expression: LeftHandSideExpression;
argumentExpression?: Expression;
@@ -1031,6 +1045,9 @@ declare namespace ts {
interface JSDocThisType extends JSDocType {
type: JSDocType;
}
interface JSDocLiteralType extends JSDocType {
literal: LiteralTypeNode;
}
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
interface JSDocRecordMember extends PropertySignature {
name: Identifier | LiteralExpression;
@@ -1109,6 +1126,11 @@ declare namespace ts {
clauseEnd: number;
antecedent: FlowNode;
}
type FlowType = Type | IncompleteType;
interface IncompleteType {
flags: TypeFlags;
type: Type;
}
interface AmdDependency {
path: string;
name: string;
@@ -1305,6 +1327,7 @@ declare namespace ts {
InElementType = 64,
UseFullyQualifiedType = 128,
InFirstTypeArgument = 256,
InTypeAlias = 512,
}
enum SymbolFormatFlags {
None = 0,
@@ -1363,18 +1386,18 @@ declare namespace ts {
Enum = 384,
Variable = 3,
Value = 107455,
Type = 793056,
Namespace = 1536,
Type = 793064,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
FunctionScopedVariableExcludes = 107454,
BlockScopedVariableExcludes = 107455,
ParameterExcludes = 107455,
PropertyExcludes = 0,
EnumMemberExcludes = 107455,
EnumMemberExcludes = 900095,
FunctionExcludes = 106927,
ClassExcludes = 899519,
InterfaceExcludes = 792960,
InterfaceExcludes = 792968,
RegularEnumExcludes = 899327,
ConstEnumExcludes = 899967,
ValueModuleExcludes = 106639,
@@ -1382,8 +1405,8 @@ declare namespace ts {
MethodExcludes = 99263,
GetAccessorExcludes = 41919,
SetAccessorExcludes = 74687,
TypeParameterExcludes = 530912,
TypeAliasExcludes = 793056,
TypeParameterExcludes = 530920,
TypeAliasExcludes = 793064,
AliasExcludes = 8388608,
ModuleMember = 8914931,
ExportHasLocal = 944,
@@ -1403,49 +1426,63 @@ declare namespace ts {
exports?: SymbolTable;
globalExports?: SymbolTable;
}
interface SymbolTable {
[index: string]: Symbol;
}
type SymbolTable = Map<Symbol>;
enum TypeFlags {
Any = 1,
String = 2,
Number = 4,
Boolean = 8,
Void = 16,
Undefined = 32,
Null = 64,
Enum = 128,
StringLiteral = 256,
TypeParameter = 512,
Class = 1024,
Interface = 2048,
Reference = 4096,
Tuple = 8192,
Union = 16384,
Intersection = 32768,
Anonymous = 65536,
Instantiated = 131072,
ObjectLiteral = 524288,
ESSymbol = 16777216,
ThisType = 33554432,
ObjectLiteralPatternWithComputedProperties = 67108864,
Never = 134217728,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
UnionOrIntersection = 49152,
StructuredType = 130048,
Narrowable = 16908175,
Enum = 16,
StringLiteral = 32,
NumberLiteral = 64,
BooleanLiteral = 128,
EnumLiteral = 256,
ESSymbol = 512,
Void = 1024,
Undefined = 2048,
Null = 4096,
Never = 8192,
TypeParameter = 16384,
Class = 32768,
Interface = 65536,
Reference = 131072,
Tuple = 262144,
Union = 524288,
Intersection = 1048576,
Anonymous = 2097152,
Instantiated = 4194304,
ThisType = 268435456,
ObjectLiteralPatternWithComputedProperties = 536870912,
Literal = 480,
PossiblyFalsy = 7406,
StringLike = 34,
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
ObjectType = 2588672,
UnionOrIntersection = 1572864,
StructuredType = 4161536,
StructuredOrTypeParameter = 4177920,
Narrowable = 4178943,
NotUnionOrUnit = 2589191,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
flags: TypeFlags;
symbol?: Symbol;
pattern?: DestructuringPattern;
aliasSymbol?: Symbol;
aliasTypeArguments?: Type[];
}
interface StringLiteralType extends Type {
interface LiteralType extends Type {
text: string;
}
interface EnumType extends Type {
memberTypes: Map<EnumLiteralType>;
}
interface EnumLiteralType extends LiteralType {
baseType: EnumType & UnionType;
}
interface ObjectType extends Type {
}
interface InterfaceType extends ObjectType {
@@ -1467,9 +1504,6 @@ declare namespace ts {
}
interface GenericType extends InterfaceType, TypeReference {
}
interface TupleType extends ObjectType {
elementTypes: Type[];
}
interface UnionOrIntersectionType extends Type {
types: Type[];
}
@@ -1534,7 +1568,7 @@ declare namespace ts {
NodeJs = 2,
}
type RootPaths = string[];
type PathSubstitutions = Map<string[]>;
type PathSubstitutions = MapLike<string[]>;
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions;
interface CompilerOptions {
@@ -1659,7 +1693,7 @@ declare namespace ts {
fileNames: string[];
raw?: any;
errors: Diagnostic[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
wildcardDirectories?: MapLike<WatchDirectoryFlags>;
}
enum WatchDirectoryFlags {
None = 0,
@@ -1667,7 +1701,7 @@ declare namespace ts {
}
interface ExpandResult {
fileNames: string[];
wildcardDirectories: Map<WatchDirectoryFlags>;
wildcardDirectories: MapLike<WatchDirectoryFlags>;
}
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
@@ -1676,6 +1710,7 @@ declare namespace ts {
directoryExists?(directoryName: string): boolean;
realpath?(path: string): string;
getCurrentDirectory?(): string;
getDirectories?(path: string): string[];
}
interface ResolvedModule {
resolvedFileName: string;
@@ -1876,14 +1911,14 @@ declare namespace ts {
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
/**
* Given a set of options and a set of root files, returns the set of type directive names
* Given a set of options, returns the set of type directive names
* that should be included for this program automatically.
* This list could either come from the config file,
* or from enumerating the types root + initial secondary types lookup location.
* More type directives might appear in the program later as a result of loading actual source files;
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts {
@@ -1989,7 +2024,7 @@ declare namespace ts {
* change range cannot be determined. However, in that case, incremental parsing will
* not happen and the entire document will be re - parsed.
*/
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
/** Releases all resources held by this script snapshot */
dispose?(): void;
}
@@ -2437,6 +2472,7 @@ declare namespace ts {
const typeElement: string;
/** enum E */
const enumElement: string;
const enumMemberElement: string;
/**
* Inside module and script only
* const v = ..
@@ -2549,7 +2585,7 @@ declare namespace ts {
fileName?: string;
reportDiagnostics?: boolean;
moduleName?: string;
renamedDependencies?: Map<string>;
renamedDependencies?: MapLike<string>;
}
interface TranspileOutput {
outputText: string;
+3401 -2257
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "2.1.0",
"version": "2.0.2",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+148 -110
View File
@@ -106,7 +106,7 @@ namespace ts {
isOptionalParameter
};
const tupleTypes = createMap<TupleType>();
const tupleTypes: GenericType[] = [];
const unionTypes = createMap<UnionType>();
const intersectionTypes = createMap<IntersectionType>();
const stringLiteralTypes = createMap<LiteralType>();
@@ -1023,8 +1023,8 @@ namespace ts {
}
}
function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration {
return findMap(symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined);
function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration | undefined {
return forEach(symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined);
}
function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol {
@@ -1126,13 +1126,13 @@ namespace ts {
else {
symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text);
}
// If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default
if (!symbolFromVariable && allowSyntheticDefaultImports && name.text === "default") {
symbolFromVariable = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
// if symbolFromVariable is export - get its final target
symbolFromVariable = resolveSymbol(symbolFromVariable);
const symbolFromModule = getExportOfModule(targetSymbol, name.text);
let symbolFromModule = getExportOfModule(targetSymbol, name.text);
// If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default
if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
const symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
@@ -1191,6 +1191,7 @@ namespace ts {
if (!links.target) {
links.target = resolvingSymbol;
const node = getDeclarationOfAliasSymbol(symbol);
Debug.assert(!!node);
const target = getTargetOfAliasDeclaration(node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
@@ -1226,6 +1227,7 @@ namespace ts {
if (!links.referenced) {
links.referenced = true;
const node = getDeclarationOfAliasSymbol(symbol);
Debug.assert(!!node);
if (node.kind === SyntaxKind.ExportAssignment) {
// export default <symbol>
checkExpressionCached((<ExportAssignment>node).expression);
@@ -2145,9 +2147,6 @@ namespace ts {
// The specified symbol flags need to be reinterpreted as type flags
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, nextFlags);
}
else if (type.flags & TypeFlags.Tuple) {
writeTupleType(<TupleType>type);
}
else if (!(flags & TypeFormatFlags.InTypeAlias) && type.flags & (TypeFlags.Anonymous | TypeFlags.UnionOrIntersection) && type.aliasSymbol) {
const typeArguments = type.aliasTypeArguments;
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
@@ -2214,6 +2213,11 @@ namespace ts {
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writePunctuation(writer, SyntaxKind.CloseBracketToken);
}
else if (type.target.flags & TypeFlags.Tuple) {
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), SyntaxKind.CommaToken);
writePunctuation(writer, SyntaxKind.CloseBracketToken);
}
else {
// Write the type reference in the format f<A>.g<B>.C<X, Y> where A and B are type arguments
// for outer type parameters, and f and g are the respective declaring containers of those
@@ -2242,12 +2246,6 @@ namespace ts {
}
}
function writeTupleType(type: TupleType) {
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writeTypeList(type.elementTypes, SyntaxKind.CommaToken);
writePunctuation(writer, SyntaxKind.CloseBracketToken);
}
function writeUnionOrIntersectionType(type: UnionOrIntersectionType, flags: TypeFormatFlags) {
if (flags & TypeFormatFlags.InElementType) {
writePunctuation(writer, SyntaxKind.OpenParenToken);
@@ -2958,7 +2956,7 @@ namespace ts {
: elementType;
if (!type) {
if (isTupleType(parentType)) {
error(declaration, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), (<TupleType>parentType).elementTypes.length, pattern.elements.length);
error(declaration, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), getTypeReferenceArity(<TypeReference>parentType), pattern.elements.length);
}
else {
error(declaration, Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName);
@@ -3070,9 +3068,14 @@ namespace ts {
}
}
// Use contextual parameter type if one is available
const type = declaration.symbol.name === "this"
? getContextuallyTypedThisType(func)
: getContextuallyTypedParameterType(<ParameterDeclaration>declaration);
let type: Type;
if (declaration.symbol.name === "this") {
const thisParameter = getContextualThisParameter(func);
type = thisParameter ? getTypeOfSymbol(thisParameter) : undefined;
}
else {
type = getContextuallyTypedParameterType(<ParameterDeclaration>declaration);
}
if (type) {
return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);
}
@@ -3150,12 +3153,13 @@ namespace ts {
}
// If the pattern has at least one element, and no rest element, then it should imply a tuple type.
const elementTypes = map(elements, e => e.kind === SyntaxKind.OmittedExpression ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors));
let result = createTupleType(elementTypes);
if (includePatternInType) {
const result = createNewTupleType(elementTypes);
result = cloneTypeReference(result);
result.pattern = pattern;
return result;
}
return createTupleType(elementTypes);
return result;
}
// Return the type implied by a binding pattern. This is the type implied purely by the binding pattern itself
@@ -3564,18 +3568,21 @@ namespace ts {
}
function getBaseTypes(type: InterfaceType): ObjectType[] {
const isClass = type.symbol.flags & SymbolFlags.Class;
const isInterface = type.symbol.flags & SymbolFlags.Interface;
if (!type.resolvedBaseTypes) {
if (!isClass && !isInterface) {
if (type.flags & TypeFlags.Tuple) {
type.resolvedBaseTypes = [createArrayType(getUnionType(type.typeParameters))];
}
else if (type.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
if (type.symbol.flags & SymbolFlags.Class) {
resolveBaseTypesOfClass(type);
}
if (type.symbol.flags & SymbolFlags.Interface) {
resolveBaseTypesOfInterface(type);
}
}
else {
Debug.fail("type must be class or interface");
}
if (isClass) {
resolveBaseTypesOfClass(type);
}
if (isInterface) {
resolveBaseTypesOfInterface(type);
}
}
return type.resolvedBaseTypes;
}
@@ -4001,20 +4008,25 @@ namespace ts {
return createTypeReference((<TypeReference>type).target,
concatenate((<TypeReference>type).typeArguments, [thisArgument || (<TypeReference>type).target.thisType]));
}
if (type.flags & TypeFlags.Tuple) {
return createTupleType((type as TupleType).elementTypes, thisArgument);
}
return type;
}
function resolveObjectTypeMembers(type: ObjectType, source: InterfaceTypeWithDeclaredMembers, typeParameters: TypeParameter[], typeArguments: Type[]) {
let mapper = identityMapper;
let members = source.symbol.members;
let callSignatures = source.declaredCallSignatures;
let constructSignatures = source.declaredConstructSignatures;
let stringIndexInfo = source.declaredStringIndexInfo;
let numberIndexInfo = source.declaredNumberIndexInfo;
if (!rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {
let mapper: TypeMapper;
let members: SymbolTable;
let callSignatures: Signature[];
let constructSignatures: Signature[];
let stringIndexInfo: IndexInfo;
let numberIndexInfo: IndexInfo;
if (rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {
mapper = identityMapper;
members = source.symbol ? source.symbol.members : createSymbolTable(source.declaredProperties);
callSignatures = source.declaredCallSignatures;
constructSignatures = source.declaredConstructSignatures;
stringIndexInfo = source.declaredStringIndexInfo;
numberIndexInfo = source.declaredNumberIndexInfo;
}
else {
mapper = createTypeMapper(typeParameters, typeArguments);
members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1);
callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature);
@@ -4024,7 +4036,7 @@ namespace ts {
}
const baseTypes = getBaseTypes(source);
if (baseTypes.length) {
if (members === source.symbol.members) {
if (source.symbol && members === source.symbol.members) {
members = createSymbolTable(source.declaredProperties);
}
const thisArgument = lastOrUndefined(typeArguments);
@@ -4094,26 +4106,6 @@ namespace ts {
return result;
}
function createTupleTypeMemberSymbols(memberTypes: Type[]): SymbolTable {
const members = createMap<Symbol>();
for (let i = 0; i < memberTypes.length; i++) {
const symbol = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "" + i);
symbol.type = memberTypes[i];
members[i] = symbol;
}
return members;
}
function resolveTupleTypeMembers(type: TupleType) {
const arrayElementType = getUnionType(type.elementTypes);
// Make the tuple type itself the 'this' type by including an extra type argument
// (Unless it's provided in the case that the tuple is a type parameter constraint)
const arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type.thisType || type]));
const members = createTupleTypeMemberSymbols(type.elementTypes);
addInheritedMembers(members, arrayType.properties);
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo);
}
function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreThisTypes: boolean, ignoreReturnTypes: boolean): Signature {
for (const s of signatureList) {
if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) {
@@ -4292,9 +4284,6 @@ namespace ts {
else if (type.flags & TypeFlags.Anonymous) {
resolveAnonymousTypeMembers(<AnonymousType>type);
}
else if (type.flags & TypeFlags.Tuple) {
resolveTupleTypeMembers(<TupleType>type);
}
else if (type.flags & TypeFlags.Union) {
resolveUnionTypeMembers(<UnionType>type);
}
@@ -4694,6 +4683,9 @@ namespace ts {
if (isJSConstructSignature) {
minArgumentCount--;
}
if (!thisParameter && isObjectLiteralMethod(declaration)) {
thisParameter = getContextualThisParameter(declaration);
}
const classType = declaration.kind === SyntaxKind.Constructor ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol((<ClassDeclaration>declaration.parent).symbol))
@@ -4992,6 +4984,17 @@ namespace ts {
return type;
}
function cloneTypeReference(source: TypeReference): TypeReference {
const type = <TypeReference>createObjectType(source.flags, source.symbol);
type.target = source.target;
type.typeArguments = source.typeArguments;
return type;
}
function getTypeReferenceArity(type: TypeReference): number {
return type.target.typeParameters ? type.target.typeParameters.length : 0;
}
// Get type from reference to class or interface
function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
const type = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(symbol));
@@ -5234,17 +5237,47 @@ namespace ts {
return links.resolvedType;
}
function createTupleType(elementTypes: Type[], thisType?: Type) {
const id = getTypeListId(elementTypes) + "," + (thisType ? thisType.id : 0);
return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes, thisType));
// We represent tuple types as type references to synthesized generic interface types created by
// this function. The types are of the form:
//
// interface Tuple<T0, T1, T2, ...> extends Array<T0 | T1 | T2 | ...> { 0: T0, 1: T1, 2: T2, ... }
//
// Note that the generic type created by this function has no symbol associated with it. The same
// is true for each of the synthesized type parameters.
function createTupleTypeOfArity(arity: number): GenericType {
const typeParameters: TypeParameter[] = [];
const properties: Symbol[] = [];
for (let i = 0; i < arity; i++) {
const typeParameter = <TypeParameter>createType(TypeFlags.TypeParameter);
typeParameters.push(typeParameter);
const property = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "" + i);
property.type = typeParameter;
properties.push(property);
}
const type = <GenericType & InterfaceTypeWithDeclaredMembers>createObjectType(TypeFlags.Tuple | TypeFlags.Reference);
type.typeParameters = typeParameters;
type.outerTypeParameters = undefined;
type.localTypeParameters = typeParameters;
type.instantiations = createMap<TypeReference>();
type.instantiations[getTypeListId(type.typeParameters)] = <GenericType>type;
type.target = <GenericType>type;
type.typeArguments = type.typeParameters;
type.thisType = <TypeParameter>createType(TypeFlags.TypeParameter | TypeFlags.ThisType);
type.thisType.constraint = type;
type.declaredProperties = properties;
type.declaredCallSignatures = emptyArray;
type.declaredConstructSignatures = emptyArray;
type.declaredStringIndexInfo = undefined;
type.declaredNumberIndexInfo = undefined;
return type;
}
function createNewTupleType(elementTypes: Type[], thisType?: Type) {
const propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, /*excludeKinds*/ 0);
const type = <TupleType>createObjectType(TypeFlags.Tuple | propagatedFlags);
type.elementTypes = elementTypes;
type.thisType = thisType;
return type;
function getTupleTypeOfArity(arity: number): GenericType {
return tupleTypes[arity] || (tupleTypes[arity] = createTupleTypeOfArity(arity));
}
function createTupleType(elementTypes: Type[]) {
return createTypeReference(getTupleTypeOfArity(elementTypes.length), elementTypes);
}
function getTypeFromTupleTypeNode(node: TupleTypeNode): Type {
@@ -5552,6 +5585,12 @@ namespace ts {
return nullType;
case SyntaxKind.NeverKeyword:
return neverType;
case SyntaxKind.JSDocNullKeyword:
return nullType;
case SyntaxKind.JSDocUndefinedKeyword:
return undefinedType;
case SyntaxKind.JSDocNeverKeyword:
return neverType;
case SyntaxKind.ThisType:
case SyntaxKind.ThisKeyword:
return getTypeFromThisTypeNode(node);
@@ -5845,9 +5884,6 @@ namespace ts {
if (type.flags & TypeFlags.Reference) {
return createTypeReference((<TypeReference>type).target, instantiateList((<TypeReference>type).typeArguments, mapper, instantiateType));
}
if (type.flags & TypeFlags.Tuple) {
return createTupleType(instantiateList((<TupleType>type).elementTypes, mapper, instantiateType));
}
if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Primitive)) {
return getUnionType(instantiateList((<UnionType>type).types, mapper, instantiateType), /*subtypeReduction*/ false, type.aliasSymbol, mapper.targetTypes);
}
@@ -6267,6 +6303,18 @@ namespace ts {
reportError(message, sourceType, targetType);
}
function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) {
const sourceType = typeToString(source);
const targetType = typeToString(target);
if ((globalStringType === source && stringType === target) ||
(globalNumberType === source && numberType === target) ||
(globalBooleanType === source && booleanType === target) ||
(getGlobalESSymbolType() === source && esSymbolType === target)) {
reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
// Compare two types and return
// Ternary.True if they are related with no assumptions,
// Ternary.Maybe if they are related with assumptions of other relationships, or
@@ -6390,6 +6438,9 @@ namespace ts {
}
if (reportErrors) {
if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.Primitive) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return Ternary.False;
@@ -7168,8 +7219,8 @@ namespace ts {
* Check if a Type was written as a tuple type literal.
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
*/
function isTupleType(type: Type): type is TupleType {
return !!(type.flags & TypeFlags.Tuple);
function isTupleType(type: Type): boolean {
return !!(type.flags & TypeFlags.Reference && (<TypeReference>type).target.flags & TypeFlags.Tuple);
}
function getFalsyFlagsOfTypes(types: Type[]): TypeFlags {
@@ -7301,11 +7352,8 @@ namespace ts {
if (type.flags & TypeFlags.Union) {
return getUnionType(map((<UnionType>type).types, getWidenedConstituentType));
}
if (isArrayType(type)) {
return createArrayType(getWidenedType((<TypeReference>type).typeArguments[0]));
}
if (isTupleType(type)) {
return createTupleType(map(type.elementTypes, getWidenedType));
if (isArrayType(type) || isTupleType(type)) {
return createTypeReference((<TypeReference>type).target, map((<TypeReference>type).typeArguments, getWidenedType));
}
}
return type;
@@ -7331,11 +7379,8 @@ namespace ts {
}
}
}
if (isArrayType(type)) {
return reportWideningErrorsInType((<TypeReference>type).typeArguments[0]);
}
if (isTupleType(type)) {
for (const t of type.elementTypes) {
if (isArrayType(type) || isTupleType(type)) {
for (const t of (<TypeReference>type).typeArguments) {
if (reportWideningErrorsInType(t)) {
errorReported = true;
}
@@ -7445,7 +7490,6 @@ namespace ts {
function couldContainTypeParameters(type: Type): boolean {
return !!(type.flags & TypeFlags.TypeParameter ||
type.flags & TypeFlags.Reference && forEach((<TypeReference>type).typeArguments, couldContainTypeParameters) ||
type.flags & TypeFlags.Tuple && forEach((<TupleType>type).elementTypes, couldContainTypeParameters) ||
type.flags & TypeFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class) ||
type.flags & TypeFlags.UnionOrIntersection && couldUnionOrIntersectionContainTypeParameters(<UnionOrIntersectionType>type));
}
@@ -7548,14 +7592,6 @@ namespace ts {
inferFromTypes(sourceTypes[i], targetTypes[i]);
}
}
else if (source.flags & TypeFlags.Tuple && target.flags & TypeFlags.Tuple && (<TupleType>source).elementTypes.length === (<TupleType>target).elementTypes.length) {
// If source and target are tuples of the same size, infer from element types
const sourceTypes = (<TupleType>source).elementTypes;
const targetTypes = (<TupleType>target).elementTypes;
for (let i = 0; i < sourceTypes.length; i++) {
inferFromTypes(sourceTypes[i], targetTypes[i]);
}
}
else if (target.flags & TypeFlags.UnionOrIntersection) {
const targetTypes = (<UnionOrIntersectionType>target).types;
let typeParameterCount = 0;
@@ -9100,10 +9136,6 @@ namespace ts {
return getInferredClassType(classSymbol);
}
}
const type = getContextuallyTypedThisType(container);
if (type) {
return type;
}
const thisType = getThisTypeOfDeclaration(container);
if (thisType) {
@@ -9344,11 +9376,11 @@ namespace ts {
}
}
function getContextuallyTypedThisType(func: FunctionLikeDeclaration): Type {
function getContextualThisParameter(func: FunctionLikeDeclaration): Symbol {
if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== SyntaxKind.ArrowFunction) {
const contextualSignature = getContextualSignature(func);
if (contextualSignature) {
return getThisTypeOfSignature(contextualSignature);
return contextualSignature.thisParameter;
}
}
@@ -9913,7 +9945,7 @@ namespace ts {
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
if (inDestructuringPattern && elementTypes.length) {
const type = createNewTupleType(elementTypes);
const type = cloneTypeReference(createTupleType(elementTypes));
type.pattern = node;
return type;
}
@@ -9927,7 +9959,7 @@ namespace ts {
for (let i = elementTypes.length; i < patternElements.length; i++) {
const patternElement = patternElements[i];
if (hasDefaultValue(patternElement)) {
elementTypes.push((<TupleType>contextualType).elementTypes[i]);
elementTypes.push((<TypeReference>contextualType).typeArguments[i]);
}
else {
if (patternElement.kind !== SyntaxKind.OmittedExpression) {
@@ -12291,6 +12323,12 @@ namespace ts {
function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) {
const len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);
if (context.thisParameter) {
if (!signature.thisParameter) {
signature.thisParameter = createTransientSymbol(context.thisParameter, undefined);
}
assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper);
}
for (let i = 0; i < len; i++) {
const parameter = signature.parameters[i];
const contextualParameterType = getTypeAtPosition(context, i);
@@ -13038,7 +13076,7 @@ namespace ts {
// such as NodeCheckFlags.LexicalThis on "this"expression.
checkExpression(element);
if (isTupleType(sourceType)) {
error(element, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (<TupleType>sourceType).elementTypes.length, elements.length);
error(element, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), getTypeReferenceArity(<TypeReference>sourceType), elements.length);
}
else {
error(element, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName);
@@ -18515,7 +18553,7 @@ namespace ts {
else if (isTypeOfKind(type, TypeFlags.StringLike)) {
return TypeReferenceSerializationKind.StringLikeType;
}
else if (isTypeOfKind(type, TypeFlags.Tuple)) {
else if (isTupleType(type)) {
return TypeReferenceSerializationKind.ArrayLikeType;
}
else if (isTypeOfKind(type, TypeFlags.ESSymbol)) {
+4 -4
View File
@@ -672,10 +672,10 @@ namespace ts {
* @param fileName The path to the config file
* @param jsonText The text of the config file
*/
export function parseConfigFileTextToJson(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } {
export function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments = true): { config?: any; error?: Diagnostic } {
try {
const jsonTextWithoutComments = removeComments(jsonText);
return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} };
const jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText;
return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} };
}
catch (e) {
return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };
@@ -901,7 +901,7 @@ namespace ts {
function convertCompilerOptionsFromJsonWorker(jsonOptions: any,
basePath: string, errors: Diagnostic[], configFileName?: string): CompilerOptions {
const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {};
const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
+4 -2
View File
@@ -2091,8 +2091,10 @@ namespace ts {
const typesFile = tryReadTypesSection(packageJsonPath, candidate, state);
if (typesFile) {
const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(typesFile), state.host);
// The package.json "typings" property must specify the file with extension, so just try that exact filename.
const result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures, state);
// A package.json "typings" may specify an exact filename, or may choose to omit an extension.
const result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures, state) ||
tryAddingExtensions(typesFile, extensions, failedLookupLocation, onlyRecordFailures, state);
if (result) {
return result;
}
+4 -2
View File
@@ -1132,8 +1132,10 @@ namespace ts {
// it if it's not a well known symbol. In that case, the text of the name will be exactly
// what we want, namely the name expression enclosed in brackets.
writeTextOfNode(currentText, node.name);
// If optional property emit ?
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature || node.kind === SyntaxKind.Parameter) && hasQuestionToken(node)) {
// If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor
// we don't want to emit property declaration with "?"
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature ||
(node.kind === SyntaxKind.Parameter && !isParameterPropertyDeclaration(node))) && hasQuestionToken(node)) {
write("?");
}
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) {
+4
View File
@@ -1955,6 +1955,10 @@
"category": "Error",
"code": 2691
},
"'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.": {
"category": "Error",
"code": 2692
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
+4
View File
@@ -1817,6 +1817,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
else if (node.parent.kind === SyntaxKind.ConditionalExpression && (<ConditionalExpression>node.parent).condition === node) {
return true;
}
else if (node.parent.kind === SyntaxKind.PrefixUnaryExpression || node.parent.kind === SyntaxKind.DeleteExpression ||
node.parent.kind === SyntaxKind.TypeOfExpression || node.parent.kind === SyntaxKind.VoidExpression) {
return true;
}
return false;
}
+39 -17
View File
@@ -913,7 +913,7 @@ namespace ts {
// Note: it is not actually necessary to save/restore the context flags here. That's
// because the saving/restoring of these flags happens naturally through the recursive
// descent nature of our parser. However, we still store this here just so we can
// assert that that invariant holds.
// assert that invariant holds.
const saveContextFlags = contextFlags;
// If we're only looking ahead, then tell the scanner to only lookahead as well.
@@ -2766,7 +2766,7 @@ namespace ts {
// Note: for ease of implementation we treat productions '2' and '3' as the same thing.
// (i.e. they're both BinaryExpressions with an assignment operator in it).
// First, do the simple check if we have a YieldExpression (production '5').
// First, do the simple check if we have a YieldExpression (production '6').
if (isYieldExpression()) {
return parseYieldExpression();
}
@@ -3374,24 +3374,40 @@ namespace ts {
}
/**
* Parse ES7 unary expression and await expression
* Parse ES7 exponential expression and await expression
*
* ES7 ExponentiationExpression:
* 1) UnaryExpression[?Yield]
* 2) UpdateExpression[?Yield] ** ExponentiationExpression[?Yield]
*
* ES7 UnaryExpression:
* 1) SimpleUnaryExpression[?yield]
* 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
*/
function parseUnaryExpressionOrHigher(): UnaryExpression | BinaryExpression {
if (isAwaitExpression()) {
return parseAwaitExpression();
}
if (isIncrementExpression()) {
/**
* ES7 UpdateExpression:
* 1) LeftHandSideExpression[?Yield]
* 2) LeftHandSideExpression[?Yield][no LineTerminator here]++
* 3) LeftHandSideExpression[?Yield][no LineTerminator here]--
* 4) ++UnaryExpression[?Yield]
* 5) --UnaryExpression[?Yield]
*/
if (isUpdateExpression()) {
const incrementExpression = parseIncrementExpression();
return token() === SyntaxKind.AsteriskAsteriskToken ?
<BinaryExpression>parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :
incrementExpression;
}
/**
* ES7 UnaryExpression:
* 1) UpdateExpression[?yield]
* 2) delete UpdateExpression[?yield]
* 3) void UpdateExpression[?yield]
* 4) typeof UpdateExpression[?yield]
* 5) + UpdateExpression[?yield]
* 6) - UpdateExpression[?yield]
* 7) ~ UpdateExpression[?yield]
* 8) ! UpdateExpression[?yield]
*/
const unaryOperator = token();
const simpleUnaryExpression = parseSimpleUnaryExpression();
if (token() === SyntaxKind.AsteriskAsteriskToken) {
@@ -3409,8 +3425,8 @@ namespace ts {
/**
* Parse ES7 simple-unary expression or higher:
*
* ES7 SimpleUnaryExpression:
* 1) IncrementExpression[?yield]
* ES7 UnaryExpression:
* 1) UpdateExpression[?yield]
* 2) delete UnaryExpression[?yield]
* 3) void UnaryExpression[?yield]
* 4) typeof UnaryExpression[?yield]
@@ -3433,13 +3449,15 @@ namespace ts {
return parseTypeOfExpression();
case SyntaxKind.VoidKeyword:
return parseVoidExpression();
case SyntaxKind.AwaitKeyword:
return parseAwaitExpression();
case SyntaxKind.LessThanToken:
// This is modified UnaryExpression grammar in TypeScript
// UnaryExpression (modified):
// < type > UnaryExpression
return parseTypeAssertion();
case SyntaxKind.AwaitKeyword:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
default:
return parseIncrementExpression();
}
@@ -3448,14 +3466,14 @@ namespace ts {
/**
* Check if the current token can possibly be an ES7 increment expression.
*
* ES7 IncrementExpression:
* ES7 UpdateExpression:
* LeftHandSideExpression[?Yield]
* LeftHandSideExpression[?Yield][no LineTerminator here]++
* LeftHandSideExpression[?Yield][no LineTerminator here]--
* ++LeftHandSideExpression[?Yield]
* --LeftHandSideExpression[?Yield]
*/
function isIncrementExpression(): boolean {
function isUpdateExpression(): boolean {
// This function is called inside parseUnaryExpression to decide
// whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly
switch (token()) {
@@ -3466,6 +3484,7 @@ namespace ts {
case SyntaxKind.DeleteKeyword:
case SyntaxKind.TypeOfKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.AwaitKeyword:
return false;
case SyntaxKind.LessThanToken:
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
@@ -5894,6 +5913,9 @@ namespace ts {
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.UndefinedKeyword:
case SyntaxKind.NeverKeyword:
return parseTokenNode<JSDocType>();
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
+3 -2
View File
@@ -4,7 +4,8 @@
namespace ts {
/** The version of the TypeScript compiler release */
export const version = "2.1.0";
export const version = "2.0.2";
const emptyArray: any[] = [];
@@ -465,7 +466,7 @@ namespace ts {
// - This calls resolveModuleNames, and then calls findSourceFile for each resolved module.
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
const maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
const maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
let currentNodeModulesDepth = 0;
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
+5 -7
View File
@@ -352,6 +352,9 @@ namespace ts {
JSDocPropertyTag,
JSDocTypeLiteral,
JSDocLiteralType,
JSDocNullKeyword,
JSDocUndefinedKeyword,
JSDocNeverKeyword,
// Synthesized list
SyntaxList,
@@ -384,7 +387,7 @@ namespace ts {
FirstJSDocNode = JSDocTypeExpression,
LastJSDocNode = JSDocLiteralType,
FirstJSDocTagNode = JSDocComment,
LastJSDocTagNode = JSDocLiteralType
LastJSDocTagNode = JSDocNeverKeyword
}
export const enum NodeFlags {
@@ -2265,7 +2268,7 @@ namespace ts {
Class = 1 << 15, // Class
Interface = 1 << 16, // Interface
Reference = 1 << 17, // Generic type reference
Tuple = 1 << 18, // Tuple
Tuple = 1 << 18, // Synthesized generic tuple type
Union = 1 << 19, // Union (T | U)
Intersection = 1 << 20, // Intersection (T & U)
Anonymous = 1 << 21, // Anonymous
@@ -2387,11 +2390,6 @@ namespace ts {
instantiations: Map<TypeReference>; // Generic instantiation cache
}
export interface TupleType extends ObjectType {
elementTypes: Type[]; // Element types
thisType?: Type; // This-type of tuple (only needed for tuples that are constraints of type parameters)
}
export interface UnionOrIntersectionType extends Type {
types: Type[]; // Constituent types
/* @internal */
+4
View File
@@ -301,6 +301,10 @@ namespace ts {
return node.kind >= SyntaxKind.FirstJSDocNode && node.kind <= SyntaxKind.LastJSDocNode;
}
export function isJSDocTag(node: Node) {
return node.kind >= SyntaxKind.FirstJSDocTagNode && node.kind <= SyntaxKind.LastJSDocTagNode;
}
export function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number {
if (nodeIsMissing(node) || !node.decorators) {
return getTokenPosOfNode(node, sourceFile);
+6 -6
View File
@@ -158,13 +158,13 @@ namespace RWC {
it("has the expected emitted code", () => {
Harness.Baseline.runBaseline(baseName + ".output.js", () => {
Harness.Baseline.runBaseline(`${baseName}.output.js`, () => {
return Harness.Compiler.collateOutputs(compilerResult.files);
}, baselineOpts);
});
it("has the expected declaration file content", () => {
Harness.Baseline.runBaseline(baseName + ".d.ts", () => {
Harness.Baseline.runBaseline(`${baseName}.d.ts`, () => {
if (!compilerResult.declFilesCode.length) {
return null;
}
@@ -174,7 +174,7 @@ namespace RWC {
});
it("has the expected source maps", () => {
Harness.Baseline.runBaseline(baseName + ".map", () => {
Harness.Baseline.runBaseline(`${baseName}.map`, () => {
if (!compilerResult.sourceMaps.length) {
return null;
}
@@ -192,7 +192,7 @@ namespace RWC {
});*/
it("has the expected errors", () => {
Harness.Baseline.runBaseline(baseName + ".errors.txt", () => {
Harness.Baseline.runBaseline(`${baseName}.errors.txt`, () => {
if (compilerResult.errors.length === 0) {
return null;
}
@@ -207,7 +207,7 @@ namespace RWC {
// declaration file errors as part of the baseline.
it("has the expected errors in generated declaration files", () => {
if (compilerOptions.declaration && !compilerResult.errors.length) {
Harness.Baseline.runBaseline(baseName + ".dts.errors.txt", () => {
Harness.Baseline.runBaseline(`${baseName}.dts.errors.txt`, () => {
const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles(
inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory);
@@ -223,7 +223,7 @@ namespace RWC {
});
it("has the expected types", () => {
Harness.Compiler.doTypeAndSymbolBaseline(baseName, compilerResult, inputFiles
Harness.Compiler.doTypeAndSymbolBaseline(`${baseName}.types`, compilerResult, inputFiles
.concat(otherFiles)
.filter(file => !!compilerResult.program.getSourceFile(file.unitName))
.filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts);
@@ -403,6 +403,7 @@ namespace ts {
{
compilerOptions: <CompilerOptions>{
allowJs: true,
maxNodeModuleJsDepth: 2,
module: ModuleKind.CommonJS,
target: ScriptTarget.ES5,
noImplicitAny: false,
@@ -429,6 +430,7 @@ namespace ts {
{
compilerOptions: <CompilerOptions>{
allowJs: false,
maxNodeModuleJsDepth: 2,
module: ModuleKind.CommonJS,
target: ScriptTarget.ES5,
noImplicitAny: false,
@@ -450,7 +452,8 @@ namespace ts {
{
compilerOptions:
{
allowJs: true
allowJs: true,
maxNodeModuleJsDepth: 2
},
errors: [{
file: undefined,
@@ -469,7 +472,8 @@ namespace ts {
{
compilerOptions:
{
allowJs: true
allowJs: true,
maxNodeModuleJsDepth: 2
},
errors: <Diagnostic[]>[]
}
+5 -19
View File
@@ -767,16 +767,9 @@ namespace ts {
parsesCorrectly(
"{null}",
`{
"kind": "JSDocTypeReference",
"kind": "NullKeyword",
"pos": 1,
"end": 5,
"name": {
"kind": "Identifier",
"pos": 1,
"end": 5,
"originalKeywordKind": "NullKeyword",
"text": "null"
}
"end": 5
}`);
});
@@ -784,16 +777,9 @@ namespace ts {
parsesCorrectly(
"{undefined}",
`{
"kind": "JSDocTypeReference",
"kind": "UndefinedKeyword",
"pos": 1,
"end": 10,
"name": {
"kind": "Identifier",
"pos": 1,
"end": 10,
"originalKeywordKind": "UndefinedKeyword",
"text": "undefined"
}
"end": 10
}`);
});
@@ -2379,4 +2365,4 @@ namespace ts {
});
});
});
}
}
+21
View File
@@ -181,5 +181,26 @@ namespace ts {
["/d.ts", "/folder/e.ts"]
);
});
it("parse and re-emit tsconfig.json file with diagnostics", () => {
const content = `{
"compilerOptions": {
"allowJs": true
// Some comments
"outDir": "bin"
}
"files": ["file1.ts"]
}`;
const { configJsonObject, diagnostics } = sanitizeConfigFile("config.json", content);
const expectedResult = {
compilerOptions: {
allowJs: true,
outDir: "bin"
},
files: ["file1.ts"]
};
assert.isTrue(diagnostics.length === 2);
assert.equal(JSON.stringify(configJsonObject), JSON.stringify(expectedResult));
});
});
}
+58 -21
View File
@@ -832,6 +832,23 @@ namespace ts {
checkNumberOfConfiguredProjects(projectService, 1);
checkNumberOfInferredProjects(projectService, 0);
});
it("should tolerate config file errors and still try to build a project", () => {
const configFile: FileOrFolder = {
path: "/a/b/tsconfig.json",
content: `{
"compilerOptions": {
"target": "es6",
"allowAnything": true
},
"someOtherProperty": {}
}`
};
const host = createServerHost([commonFile1, commonFile2, libFile, configFile]);
const projectService = createProjectService(host);
projectService.openClientFile(commonFile1.path);
checkNumberOfConfiguredProjects(projectService, 1);
checkProjectRootFiles(projectService.configuredProjects[0], [commonFile1.path, commonFile2.path]);
});
it("should use only one inferred project if 'useOneInferredProject' is set", () => {
const file1 = {
@@ -2166,7 +2183,7 @@ namespace ts {
for (let i = 0; i < errors.length; i++) {
const actualMessage = flattenDiagnosticMessageText(errors[i].messageText, "\n");
const expectedMessage = expectedErrors[i];
assert.equal(actualMessage, expectedMessage, "error message does not match");
assert.isTrue(actualMessage.indexOf(expectedMessage) === 0, `error message does not match, expected ${actualMessage} to start with ${expectedMessage}`);
}
}
}
@@ -2273,10 +2290,15 @@ namespace ts {
projectService.openClientFile(file1.path);
{
projectService.checkNumberOfProjects({ inferredProjects: 1, configuredProjects: 1 });
projectService.checkNumberOfProjects({ configuredProjects: 1 });
const configuredProject = forEach(projectService.synchronizeProjectList([]), f => f.info.projectName === corruptedConfig.path && f);
assert.isTrue(configuredProject !== undefined, "should find configured project");
checkProjectErrors(configuredProject, [`Failed to parse file \'/a/b/tsconfig.json\': Unexpected token : in JSON at position 7.`]);
checkProjectErrors(configuredProject, [
"')' expected.",
"Declaration or statement expected.",
"Declaration or statement expected.",
"Failed to parse file '/a/b/tsconfig.json'"
]);
}
// fix config and trigger watcher
host.reloadFS([file1, file2, correctConfig]);
@@ -2316,14 +2338,19 @@ namespace ts {
assert.isTrue(configuredProject !== undefined, "should find configured project");
checkProjectErrors(configuredProject, []);
}
// fix config and trigger watcher
// break config and trigger watcher
host.reloadFS([file1, file2, corruptedConfig]);
host.triggerFileWatcherCallback(corruptedConfig.path, /*false*/);
{
projectService.checkNumberOfProjects({ inferredProjects: 1, configuredProjects: 1 });
projectService.checkNumberOfProjects({ configuredProjects: 1 });
const configuredProject = forEach(projectService.synchronizeProjectList([]), f => f.info.projectName === corruptedConfig.path && f);
assert.isTrue(configuredProject !== undefined, "should find configured project");
checkProjectErrors(configuredProject, [`Failed to parse file \'/a/b/tsconfig.json\': Unexpected token : in JSON at position 7.`]);
checkProjectErrors(configuredProject, [
"')' expected.",
"Declaration or statement expected.",
"Declaration or statement expected.",
"Failed to parse file '/a/b/tsconfig.json'"
]);
}
});
});
@@ -2342,23 +2369,33 @@ namespace ts {
const projectService = createProjectService(host);
projectService.openClientFile(file1.path);
projectService.checkNumberOfProjects({ inferredProjects: 1, configuredProjects: 1 });
projectService.checkNumberOfProjects({ configuredProjects: 1 });
const project = projectService.findProject(corruptedConfig.path);
let expectedMessage: string;
try {
server.Errors.ThrowProjectDoesNotContainDocument(file1.path, project);
assert(false, "should not get there");
}
catch (e) {
expectedMessage = (<Error>e).message;
}
try {
project.getScriptInfo(file1.path);
}
catch (e) {
assert.equal((<Error>e).message, expectedMessage, "Unexpected error");
}
checkProjectRootFiles(project, [file1.path]);
});
});
describe("autoDiscovery", () => {
it("does not depend on extension", () => {
const file1 = {
path: "/a/b/app.html",
content: ""
};
const file2 = {
path: "/a/b/app.d.ts",
content: ""
};
const host = createServerHost([file1, file2]);
const projectService = createProjectService(host);
projectService.openExternalProject({
projectFileName: "/a/b/proj.csproj",
rootFiles: [toExternalFile(file2.path), { fileName: file1.path, hasMixedContent: true, scriptKind: ScriptKind.JS }],
options: {}
});
projectService.checkNumberOfProjects({ externalProjects: 1 });
const typingOptions = projectService.externalProjects[0].getTypingOptions();
assert.isTrue(typingOptions.enableAutoDiscovery, "Typing autodiscovery should be enabled");
});
});
}
+55 -15
View File
@@ -126,6 +126,7 @@ interface KeyAlgorithm {
}
interface KeyboardEventInit extends EventModifierInit {
code?: string;
key?: string;
location?: number;
repeat?: boolean;
@@ -2288,7 +2289,7 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
/**
* Sets or gets the URL for the current document.
*/
@@ -3351,7 +3352,7 @@ declare var Document: {
new(): Document;
}
interface DocumentFragment extends Node, NodeSelector {
interface DocumentFragment extends Node, NodeSelector, ParentNode {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -3420,7 +3421,7 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
readonly clientHeight: number;
@@ -3675,6 +3676,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
closest(selector: string): Element | null;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -4446,7 +4457,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(callback: (result: Blob | null) => void, ... arguments: any[]): void;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
}
declare var HTMLCanvasElement: {
@@ -4621,11 +4632,7 @@ interface HTMLElement extends Element {
click(): void;
dragDrop(): boolean;
focus(): void;
insertAdjacentElement(position: string, insertedElement: Element): Element;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
msGetInputContext(): MSInputMethodContext;
scrollIntoView(top?: boolean): void;
setActive(): void;
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -5890,6 +5897,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
*/
type: string;
import?: Document;
integrity: string;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6178,7 +6186,7 @@ interface HTMLMediaElement extends HTMLElement {
*/
canPlayType(type: string): string;
/**
* Fires immediately after the client loads the object.
* Resets the audio or video object and loads a new media resource.
*/
load(): void;
/**
@@ -6751,6 +6759,7 @@ interface HTMLScriptElement extends HTMLElement {
* Sets or retrieves the MIME type for the associated scripting engine.
*/
type: string;
integrity: string;
}
declare var HTMLScriptElement: {
@@ -7756,6 +7765,7 @@ interface KeyboardEvent extends UIEvent {
readonly repeat: boolean;
readonly shiftKey: boolean;
readonly which: number;
readonly code: string;
getModifierState(keyArg: string): boolean;
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
readonly DOM_KEY_LOCATION_JOYSTICK: number;
@@ -9128,6 +9138,7 @@ interface PerformanceTiming {
readonly responseStart: number;
readonly unloadEventEnd: number;
readonly unloadEventStart: number;
readonly secureConnectionStart: number;
toJSON(): any;
}
@@ -11405,8 +11416,8 @@ declare var StereoPannerNode: {
interface Storage {
readonly length: number;
clear(): void;
getItem(key: string): string;
key(index: number): string;
getItem(key: string): string | null;
key(index: number): string | null;
removeItem(key: string): void;
setItem(key: string, data: string): void;
[key: string]: any;
@@ -12947,7 +12958,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
onunload: (this: this, ev: Event) => any;
onvolumechange: (this: this, ev: Event) => any;
onwaiting: (this: this, ev: Event) => any;
readonly opener: Window;
opener: any;
orientation: string | number;
readonly outerHeight: number;
readonly outerWidth: number;
@@ -13002,6 +13013,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -14029,6 +14043,20 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
interface ScrollOptions {
behavior?: ScrollBehavior;
}
interface ScrollToOptions extends ScrollOptions {
left?: number;
top?: number;
}
interface ScrollIntoViewOptions extends ScrollOptions {
block?: ScrollLogicalPosition;
inline?: ScrollLogicalPosition;
}
interface ClipboardEventInit extends EventInit {
data?: string;
dataType?: string;
@@ -14072,7 +14100,7 @@ interface EcdsaParams extends Algorithm {
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
namedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
@@ -14208,6 +14236,13 @@ interface JsonWebKey {
k?: string;
}
interface ParentNode {
readonly children: HTMLCollection;
readonly firstElementChild: Element;
readonly lastElementChild: Element;
readonly childElementCount: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -14278,7 +14313,7 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msCredentials: MSCredentials;
declare var name: string;
declare const name: never;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
declare var onabort: (this: Window, ev: UIEvent) => any;
@@ -14372,7 +14407,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
declare var onunload: (this: Window, ev: Event) => any;
declare var onvolumechange: (this: Window, ev: Event) => any;
declare var onwaiting: (this: Window, ev: Event) => any;
declare var opener: Window;
declare var opener: any;
declare var orientation: string | number;
declare var outerHeight: number;
declare var outerWidth: number;
@@ -14425,6 +14460,9 @@ declare function webkitCancelAnimationFrame(handle: number): void;
declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
@@ -14580,6 +14618,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
type payloadtype = number;
type ScrollBehavior = "auto" | "instant" | "smooth";
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
+1 -1
View File
@@ -1000,7 +1000,7 @@ interface EcdsaParams extends Algorithm {
}
interface EcKeyGenParams extends Algorithm {
typedCurve: string;
namedCurve: string;
}
interface EcKeyAlgorithm extends KeyAlgorithm {
+56 -31
View File
@@ -11,6 +11,13 @@
namespace ts.server {
export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
export type ProjectServiceEvent =
{ eventName: "context", data: { project: Project, fileName: NormalizedPath } } | { eventName: "configFileDiag", data: { triggerFile?: string, configFileName: string, diagnostics: Diagnostic[] } }
export interface ProjectServiceEventHandler {
(event: ProjectServiceEvent): void;
}
/**
* This helper function processes a list of projects and return the concatenated, sortd and deduplicated output of processing each project.
*/
@@ -19,10 +26,6 @@ namespace ts.server {
return projects.length > 1 ? deduplicate(result, areEqual) : result;
}
export interface ProjectServiceEventHandler {
(eventName: string, project: Project, fileName: NormalizedPath): void;
}
export interface HostConfiguration {
formatCodeOptions: FormatCodeSettings;
hostInfo: string;
@@ -349,7 +352,7 @@ namespace ts.server {
}
for (const openFile of this.openFiles) {
this.eventHandler("context", openFile.getDefaultProject(), openFile.fileName);
this.eventHandler({ eventName: "context", data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } });
}
}
@@ -377,7 +380,8 @@ namespace ts.server {
}
private handleChangeInSourceFileForConfiguredProject(project: ConfiguredProject) {
const { projectOptions } = this.convertConfigFileContentToProjectOptions(project.configFileName);
const { projectOptions, configFileErrors } = this.convertConfigFileContentToProjectOptions(project.configFileName);
this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors);
const newRootFiles = projectOptions.files.map((f => this.getCanonicalFileName(f)));
const currentRootFiles = project.getRootFiles().map((f => this.getCanonicalFileName(f)));
@@ -411,6 +415,9 @@ namespace ts.server {
return;
}
const { configFileErrors } = this.convertConfigFileContentToProjectOptions(fileName);
this.reportConfigFileDiagnostics(fileName, configFileErrors);
this.logger.info(`Detected newly added tsconfig file: ${fileName}`);
this.reloadProjects();
}
@@ -658,38 +665,46 @@ namespace ts.server {
private convertConfigFileContentToProjectOptions(configFilename: string): ConfigFileConversionResult {
configFilename = normalizePath(configFilename);
const configObj = parseConfigFileTextToJson(configFilename, this.host.readFile(configFilename));
if (configObj.error) {
return { success: false, configFileErrors: [configObj.error] };
const configFileContent = this.host.readFile(configFilename);
let errors: Diagnostic[];
const result = parseConfigFileTextToJson(configFilename, configFileContent);
let config = result.config;
if (result.error) {
// try to reparse config file
const { configJsonObject: sanitizedConfig, diagnostics } = sanitizeConfigFile(configFilename, configFileContent);
config = sanitizedConfig;
errors = diagnostics.length ? diagnostics : [result.error];
}
const parsedCommandLine = parseJsonConfigFileContent(
configObj.config,
config,
this.host,
getDirectoryPath(configFilename),
/*existingOptions*/ {},
configFilename);
Debug.assert(!!parsedCommandLine.fileNames);
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
return { success: false, configFileErrors: parsedCommandLine.errors };
if (parsedCommandLine.errors.length) {
errors = concatenate(errors, parsedCommandLine.errors);
}
Debug.assert(!!parsedCommandLine.fileNames);
if (parsedCommandLine.fileNames.length === 0) {
const error = createCompilerDiagnostic(Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename);
return { success: false, configFileErrors: [error] };
errors.push(createCompilerDiagnostic(Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
return { success: false, configFileErrors: errors };
}
const projectOptions: ProjectOptions = {
files: parsedCommandLine.fileNames,
compilerOptions: parsedCommandLine.options,
configHasFilesProperty: configObj.config["files"] !== undefined,
configHasFilesProperty: config["files"] !== undefined,
wildcardDirectories: createMap(parsedCommandLine.wildcardDirectories),
typingOptions: parsedCommandLine.typingOptions,
compileOnSave: parsedCommandLine.compileOnSave
};
return { success: true, projectOptions };
return { success: true, projectOptions, configFileErrors: errors };
}
private exceededTotalSizeLimitForNonTsFiles<T>(options: CompilerOptions, fileNames: T[], propertyReader: FilePropertyReader<T>) {
@@ -719,12 +734,21 @@ namespace ts.server {
/*languageServiceEnabled*/ !this.exceededTotalSizeLimitForNonTsFiles(options, files, externalFilePropertyReader),
options.compileOnSave === undefined ? true : options.compileOnSave);
this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, /*clientFileName*/ undefined, typingOptions);
this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, /*clientFileName*/ undefined, typingOptions, /*configFileErrors*/ undefined);
this.externalProjects.push(project);
return project;
}
private createAndAddConfiguredProject(configFileName: NormalizedPath, projectOptions: ProjectOptions, clientFileName?: string) {
private reportConfigFileDiagnostics(configFileName: string, diagnostics: Diagnostic[], triggerFile?: string) {
if (diagnostics && diagnostics.length > 0) {
this.eventHandler({
eventName: "configFileDiag",
data: { configFileName, diagnostics, triggerFile }
});
}
}
private createAndAddConfiguredProject(configFileName: NormalizedPath, projectOptions: ProjectOptions, configFileErrors: Diagnostic[], clientFileName?: string) {
const sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader);
const project = new ConfiguredProject(
configFileName,
@@ -736,7 +760,7 @@ namespace ts.server {
/*languageServiceEnabled*/ !sizeLimitExceeded,
projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions);
this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors);
project.watchConfigFile(project => this.onConfigChangedForConfiguredProject(project));
if (!sizeLimitExceeded) {
@@ -754,7 +778,7 @@ namespace ts.server {
}
}
private addFilesToProjectAndUpdateGraph<T>(project: ConfiguredProject | ExternalProject, files: T[], propertyReader: FilePropertyReader<T>, clientFileName: string, typingOptions: TypingOptions): void {
private addFilesToProjectAndUpdateGraph<T>(project: ConfiguredProject | ExternalProject, files: T[], propertyReader: FilePropertyReader<T>, clientFileName: string, typingOptions: TypingOptions, configFileErrors: Diagnostic[]): void {
let errors: Diagnostic[];
for (const f of files) {
const rootFilename = propertyReader.getFileName(f);
@@ -768,21 +792,22 @@ namespace ts.server {
(errors || (errors = [])).push(createFileNotFoundDiagnostic(rootFilename));
}
}
project.setProjectErrors(errors);
project.setProjectErrors(concatenate(configFileErrors, errors));
project.setTypingOptions(typingOptions);
project.updateGraph();
}
private openConfigFile(configFileName: NormalizedPath, clientFileName?: string): OpenConfigFileResult {
const conversionResult = this.convertConfigFileContentToProjectOptions(configFileName);
if (!conversionResult.success) {
// open project with no files and set errors on the project
const project = this.createAndAddConfiguredProject(configFileName, { files: [], compilerOptions: {} }, clientFileName);
project.setProjectErrors(conversionResult.configFileErrors);
return { success: false, errors: conversionResult.configFileErrors };
}
const project = this.createAndAddConfiguredProject(configFileName, conversionResult.projectOptions, clientFileName);
return { success: true, project, errors: project.getProjectErrors() };
const projectOptions = conversionResult.success
? conversionResult.projectOptions
: { files: [], compilerOptions: {} };
const project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName);
return {
success: conversionResult.success,
project,
errors: project.getProjectErrors()
};
}
private updateNonInferredProject<T>(project: ExternalProject | ConfiguredProject, newUncheckedFiles: T[], propertyReader: FilePropertyReader<T>, newOptions: CompilerOptions, newTypingOptions: TypingOptions, compileOnSave: boolean, configFileErrors: Diagnostic[]) {
+3 -3
View File
@@ -20,10 +20,10 @@ namespace ts.server {
}
}
const jsOrDts = [".js", ".d.ts"];
export function allRootFilesAreJsOrDts(project: Project): boolean {
return project.getRootScriptInfos().every(f => fileExtensionIsAny(f.fileName, jsOrDts));
return project.getRootScriptInfos().every(f => {
return f.scriptKind === ScriptKind.JS || f.scriptKind == ScriptKind.JSX || fileExtensionIs(f.fileName, ".d.ts");
});
}
export interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles {
+12 -6
View File
@@ -164,18 +164,24 @@ namespace ts.server {
protected readonly canUseEvents: boolean) {
const eventHandler: ProjectServiceEventHandler = canUseEvents
? (eventName, project, fileName) => this.handleEvent(eventName, project, fileName)
? event => this.handleEvent(event)
: undefined;
this.projectService = new ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler);
this.gcTimer = new GcTimer(host, /*delay*/ 15000, logger);
}
private handleEvent(eventName: string, project: Project, fileName: NormalizedPath) {
if (eventName == "context") {
this.logger.info("got context event, updating diagnostics for" + fileName);
this.updateErrorCheck([{ fileName, project }], this.changeSeq,
(n) => n === this.changeSeq, 100);
private handleEvent(event: ProjectServiceEvent) {
switch (event.eventName) {
case "context":
const { project, fileName } = event.data;
this.projectService.logger.info(`got context event, updating diagnostics for ${fileName}`);
this.updateErrorCheck([{ fileName, project }], this.changeSeq,
(n) => n === this.changeSeq, 100);
break;
case "configFileDiag":
const { triggerFile, configFileName, diagnostics } = event.data;
this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics);
}
}
+9 -2
View File
@@ -296,11 +296,14 @@ namespace ts {
let pos = this.pos;
const useJSDocScanner = this.kind >= SyntaxKind.FirstJSDocTagNode && this.kind <= SyntaxKind.LastJSDocTagNode;
const processNode = (node: Node) => {
if (pos < node.pos) {
const isJSDocTagNode = isJSDocTag(node);
if (!isJSDocTagNode && pos < node.pos) {
pos = this.addSyntheticNodes(children, pos, node.pos, useJSDocScanner);
}
children.push(node);
pos = node.end;
if (!isJSDocTagNode) {
pos = node.end;
}
};
const processNodes = (nodes: NodeArray<Node>) => {
if (pos < nodes.pos) {
@@ -7683,6 +7686,10 @@ namespace ts {
* False will mean that node is not classified and traverse routine should recurse into node contents.
*/
function tryClassifyNode(node: Node): boolean {
if (isJSDocTag(node)) {
return true;
}
if (nodeIsMissing(node)) {
return true;
}
+1 -1
View File
@@ -1188,6 +1188,6 @@ namespace TypeScript.Services {
// TODO: it should be moved into a namespace though.
/* @internal */
const toolsVersion = "2.1";
const toolsVersion = "2.0";
/* tslint:enable:no-unused-variable */
+24
View File
@@ -925,4 +925,28 @@ namespace ts {
}
return ensureScriptKind(fileName, scriptKind);
}
export function sanitizeConfigFile(configFileName: string, content: string) {
const options: TranspileOptions = {
fileName: "config.js",
compilerOptions: {
target: ScriptTarget.ES6,
removeComments: true
},
reportDiagnostics: true
};
const { outputText, diagnostics } = ts.transpileModule("(" + content + ")", options);
// Becasue the content was wrapped in "()", the start position of diagnostics needs to be subtract by 1
// also, the emitted result will have "(" in the beginning and ");" in the end. We need to strip these
// as well
const trimmedOutput = outputText.trim();
for (const diagnostic of diagnostics) {
diagnostic.start = diagnostic.start - 1;
}
const {config, error} = parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), /*stripComments*/ false);
return {
configJsonObject: config || {},
diagnostics: error ? concatenate(diagnostics, [error]) : diagnostics
};
}
}
@@ -1,6 +1,7 @@
tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtyping.ts(9,7): error TS2415: Class 'Derived<U>' incorrectly extends base class 'Base<string>'.
Types of property 'x' are incompatible.
Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
==== tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtyping.ts (1 errors) ====
@@ -17,6 +18,7 @@ tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtypi
!!! error TS2415: Class 'Derived<U>' incorrectly extends base class 'Base<string>'.
!!! error TS2415: Types of property 'x' are incompatible.
!!! error TS2415: Type 'String' is not assignable to type 'string'.
!!! error TS2415: 'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
x: String;
}
@@ -2,6 +2,7 @@ tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSuperty
Types of property 'x' are incompatible.
Type 'U' is not assignable to type 'string'.
Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
==== tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSupertype.ts (1 errors) ====
@@ -19,5 +20,6 @@ tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSuperty
!!! error TS2415: Types of property 'x' are incompatible.
!!! error TS2415: Type 'U' is not assignable to type 'string'.
!!! error TS2415: Type 'String' is not assignable to type 'string'.
!!! error TS2415: 'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
x: U;
}
@@ -39,8 +39,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'.
Property 'length' is missing in type '{ 0: string; 1: number; }'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
@@ -136,8 +135,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error
var n1: [number, string] = x;
~~
!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
var n2: [number, string] = y;
~~
!!! error TS2322: Type 'StrNum' is not assignable to type '[number, string]'.
@@ -1,8 +1,7 @@
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2322: Type 'undefined[]' is not assignable to type '[any, any, any]'.
Property '0' is missing in type 'undefined[]'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error TS2322: Type '[string, number, boolean]' is not assignable to type '[boolean, string, number]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
Types of property 'pop' are incompatible.
Type '() => string | number | boolean' is not assignable to type '() => number'.
@@ -18,6 +17,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
Types of parameters 'items' and 'items' are incompatible.
Type 'Number' is not assignable to type 'string | number'.
Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ====
@@ -37,8 +37,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
var a1: [boolean, string, number] = ["string", 1, true]; // Error
~~
!!! error TS2322: Type '[string, number, boolean]' is not assignable to type '[boolean, string, number]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
// The resulting type an array literal expression is determined as follows:
// - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1),
@@ -81,4 +80,5 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
!!! error TS2322: Type 'Number' is not assignable to type 'string | number'.
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
!!! error TS2322: 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
@@ -1,4 +1,5 @@
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface.ts(3,1): error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
==== tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface.ts (1 errors) ====
@@ -7,4 +8,5 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface.ts(3
x = a;
~
!!! error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
!!! error TS2322: 'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
a = x;
@@ -3,6 +3,7 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(
Type '() => Object' is not assignable to type '() => boolean'.
Type 'Object' is not assignable to type 'boolean'.
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(19,1): error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(20,1): error TS2322: Type 'NotBoolean' is not assignable to type 'boolean'.
@@ -33,6 +34,7 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(
x = a; // expected error
~
!!! error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
!!! error TS2322: 'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
x = b; // expected error
~
!!! error TS2322: Type 'NotBoolean' is not assignable to type 'boolean'.
@@ -1,4 +1,5 @@
tests/cases/conformance/types/primitives/number/assignFromNumberInterface.ts(3,1): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
==== tests/cases/conformance/types/primitives/number/assignFromNumberInterface.ts (1 errors) ====
@@ -7,4 +8,5 @@ tests/cases/conformance/types/primitives/number/assignFromNumberInterface.ts(3,1
x = a;
~
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
!!! error TS2322: 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
a = x;
@@ -1,4 +1,5 @@
tests/cases/conformance/types/primitives/number/assignFromNumberInterface2.ts(24,1): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
tests/cases/conformance/types/primitives/number/assignFromNumberInterface2.ts(25,1): error TS2322: Type 'NotNumber' is not assignable to type 'number'.
@@ -29,6 +30,7 @@ tests/cases/conformance/types/primitives/number/assignFromNumberInterface2.ts(25
x = a; // expected error
~
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
!!! error TS2322: 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
x = b; // expected error
~
!!! error TS2322: Type 'NotNumber' is not assignable to type 'number'.
@@ -1,4 +1,5 @@
tests/cases/conformance/types/primitives/string/assignFromStringInterface.ts(3,1): error TS2322: Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
==== tests/cases/conformance/types/primitives/string/assignFromStringInterface.ts (1 errors) ====
@@ -7,4 +8,5 @@ tests/cases/conformance/types/primitives/string/assignFromStringInterface.ts(3,1
x = a;
~
!!! error TS2322: Type 'String' is not assignable to type 'string'.
!!! error TS2322: 'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
a = x;
@@ -1,4 +1,5 @@
tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts(47,1): error TS2322: Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts(48,1): error TS2322: Type 'NotString' is not assignable to type 'string'.
@@ -52,6 +53,7 @@ tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts(48
x = a; // expected error
~
!!! error TS2322: Type 'String' is not assignable to type 'string'.
!!! error TS2322: 'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
x = b; // expected error
~
!!! error TS2322: Type 'NotString' is not assignable to type 'string'.
@@ -0,0 +1,47 @@
//// [await_unaryExpression_es6.ts]
async function bar() {
!await 42; // OK
}
async function bar1() {
+await 42; // OK
}
async function bar3() {
-await 42; // OK
}
async function bar4() {
~await 42; // OK
}
//// [await_unaryExpression_es6.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(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 bar() {
return __awaiter(this, void 0, void 0, function* () {
!(yield 42); // OK
});
}
function bar1() {
return __awaiter(this, void 0, void 0, function* () {
+(yield 42); // OK
});
}
function bar3() {
return __awaiter(this, void 0, void 0, function* () {
-(yield 42); // OK
});
}
function bar4() {
return __awaiter(this, void 0, void 0, function* () {
~(yield 42); // OK
});
}
@@ -0,0 +1,25 @@
=== tests/cases/conformance/async/es6/await_unaryExpression_es6.ts ===
async function bar() {
>bar : Symbol(bar, Decl(await_unaryExpression_es6.ts, 0, 0))
!await 42; // OK
}
async function bar1() {
>bar1 : Symbol(bar1, Decl(await_unaryExpression_es6.ts, 3, 1))
+await 42; // OK
}
async function bar3() {
>bar3 : Symbol(bar3, Decl(await_unaryExpression_es6.ts, 7, 1))
-await 42; // OK
}
async function bar4() {
>bar4 : Symbol(bar4, Decl(await_unaryExpression_es6.ts, 11, 1))
~await 42; // OK
}
@@ -0,0 +1,37 @@
=== tests/cases/conformance/async/es6/await_unaryExpression_es6.ts ===
async function bar() {
>bar : () => Promise<void>
!await 42; // OK
>!await 42 : boolean
>await 42 : number
>42 : number
}
async function bar1() {
>bar1 : () => Promise<void>
+await 42; // OK
>+await 42 : number
>await 42 : number
>42 : number
}
async function bar3() {
>bar3 : () => Promise<void>
-await 42; // OK
>-await 42 : number
>await 42 : number
>42 : number
}
async function bar4() {
>bar4 : () => Promise<void>
~await 42; // OK
>~await 42 : number
>await 42 : number
>42 : number
}
@@ -0,0 +1,56 @@
//// [await_unaryExpression_es6_1.ts]
async function bar() {
!await 42; // OK
}
async function bar1() {
delete await 42; // OK
}
async function bar2() {
delete await 42; // OK
}
async function bar3() {
void await 42;
}
async function bar4() {
+await 42;
}
//// [await_unaryExpression_es6_1.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(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 bar() {
return __awaiter(this, void 0, void 0, function* () {
!(yield 42); // OK
});
}
function bar1() {
return __awaiter(this, void 0, void 0, function* () {
delete (yield 42); // OK
});
}
function bar2() {
return __awaiter(this, void 0, void 0, function* () {
delete (yield 42); // OK
});
}
function bar3() {
return __awaiter(this, void 0, void 0, function* () {
void (yield 42);
});
}
function bar4() {
return __awaiter(this, void 0, void 0, function* () {
+(yield 42);
});
}
@@ -0,0 +1,31 @@
=== tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts ===
async function bar() {
>bar : Symbol(bar, Decl(await_unaryExpression_es6_1.ts, 0, 0))
!await 42; // OK
}
async function bar1() {
>bar1 : Symbol(bar1, Decl(await_unaryExpression_es6_1.ts, 3, 1))
delete await 42; // OK
}
async function bar2() {
>bar2 : Symbol(bar2, Decl(await_unaryExpression_es6_1.ts, 7, 1))
delete await 42; // OK
}
async function bar3() {
>bar3 : Symbol(bar3, Decl(await_unaryExpression_es6_1.ts, 11, 1))
void await 42;
}
async function bar4() {
>bar4 : Symbol(bar4, Decl(await_unaryExpression_es6_1.ts, 15, 1))
+await 42;
}
@@ -0,0 +1,46 @@
=== tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts ===
async function bar() {
>bar : () => Promise<void>
!await 42; // OK
>!await 42 : boolean
>await 42 : number
>42 : number
}
async function bar1() {
>bar1 : () => Promise<void>
delete await 42; // OK
>delete await 42 : boolean
>await 42 : number
>42 : number
}
async function bar2() {
>bar2 : () => Promise<void>
delete await 42; // OK
>delete await 42 : boolean
>await 42 : number
>42 : number
}
async function bar3() {
>bar3 : () => Promise<void>
void await 42;
>void await 42 : undefined
>await 42 : number
>42 : number
}
async function bar4() {
>bar4 : () => Promise<void>
+await 42;
>+await 42 : number
>await 42 : number
>42 : number
}
@@ -0,0 +1,38 @@
//// [await_unaryExpression_es6_2.ts]
async function bar1() {
delete await 42;
}
async function bar2() {
delete await 42;
}
async function bar3() {
void await 42;
}
//// [await_unaryExpression_es6_2.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(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 bar1() {
return __awaiter(this, void 0, void 0, function* () {
delete (yield 42);
});
}
function bar2() {
return __awaiter(this, void 0, void 0, function* () {
delete (yield 42);
});
}
function bar3() {
return __awaiter(this, void 0, void 0, function* () {
void (yield 42);
});
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts ===
async function bar1() {
>bar1 : Symbol(bar1, Decl(await_unaryExpression_es6_2.ts, 0, 0))
delete await 42;
}
async function bar2() {
>bar2 : Symbol(bar2, Decl(await_unaryExpression_es6_2.ts, 3, 1))
delete await 42;
}
async function bar3() {
>bar3 : Symbol(bar3, Decl(await_unaryExpression_es6_2.ts, 7, 1))
void await 42;
}
@@ -0,0 +1,28 @@
=== tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts ===
async function bar1() {
>bar1 : () => Promise<void>
delete await 42;
>delete await 42 : boolean
>await 42 : number
>42 : number
}
async function bar2() {
>bar2 : () => Promise<void>
delete await 42;
>delete await 42 : boolean
>await 42 : number
>42 : number
}
async function bar3() {
>bar3 : () => Promise<void>
void await 42;
>void await 42 : undefined
>await 42 : number
>42 : number
}
@@ -0,0 +1,27 @@
tests/cases/conformance/async/es6/await_unaryExpression_es6_3.ts(3,7): error TS1109: Expression expected.
tests/cases/conformance/async/es6/await_unaryExpression_es6_3.ts(7,7): error TS1109: Expression expected.
==== tests/cases/conformance/async/es6/await_unaryExpression_es6_3.ts (2 errors) ====
async function bar1() {
++await 42; // Error
~~~~~
!!! error TS1109: Expression expected.
}
async function bar2() {
--await 42; // Error
~~~~~
!!! error TS1109: Expression expected.
}
async function bar3() {
var x = 42;
await x++; // OK but shouldn't need parenthesis
}
async function bar4() {
var x = 42;
await x--; // OK but shouldn't need parenthesis
}
@@ -0,0 +1,53 @@
//// [await_unaryExpression_es6_3.ts]
async function bar1() {
++await 42; // Error
}
async function bar2() {
--await 42; // Error
}
async function bar3() {
var x = 42;
await x++; // OK but shouldn't need parenthesis
}
async function bar4() {
var x = 42;
await x--; // OK but shouldn't need parenthesis
}
//// [await_unaryExpression_es6_3.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(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 bar1() {
return __awaiter(this, void 0, void 0, function* () {
++;
yield 42; // Error
});
}
function bar2() {
return __awaiter(this, void 0, void 0, function* () {
--;
yield 42; // Error
});
}
function bar3() {
return __awaiter(this, void 0, void 0, function* () {
var x = 42;
yield x++; // OK but shouldn't need parenthesis
});
}
function bar4() {
return __awaiter(this, void 0, void 0, function* () {
var x = 42;
yield x--; // OK but shouldn't need parenthesis
});
}
+3 -3
View File
@@ -20,9 +20,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
function f() {
return __awaiter(this, void 0, void 0, function* () {
yield 0;
typeof yield 0;
void yield 0;
yield void typeof void yield 0;
typeof (yield 0);
void (yield 0);
yield void typeof void (yield 0);
yield yield 0;
});
}
@@ -1,10 +1,8 @@
tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Type '[number, string]' cannot be converted to type '[number, number]'.
Types of property '1' are incompatible.
Type 'string' is not comparable to type 'number'.
Type 'string' is not comparable to type 'number'.
tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'.
Types of property '0' are incompatible.
Type 'C' is not comparable to type 'A'.
Property 'a' is missing in type 'C'.
Type 'C' is not comparable to type 'A'.
Property 'a' is missing in type 'C'.
tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'.
@@ -40,14 +38,12 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot
var t3 = <[number, number]>numStrTuple;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Type '[number, string]' cannot be converted to type '[number, number]'.
!!! error TS2352: Types of property '1' are incompatible.
!!! error TS2352: Type 'string' is not comparable to type 'number'.
!!! error TS2352: Type 'string' is not comparable to type 'number'.
var t9 = <[A, I]>classCDTuple;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'.
!!! error TS2352: Types of property '0' are incompatible.
!!! error TS2352: Type 'C' is not comparable to type 'A'.
!!! error TS2352: Property 'a' is missing in type 'C'.
!!! error TS2352: Type 'C' is not comparable to type 'A'.
!!! error TS2352: Property 'a' is missing in type 'C'.
var array1 = <number[]>numStrTuple;
~~~~~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
@@ -5,9 +5,8 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS232
Type 'true' is not assignable to type 'string | number'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
Types of property '0' are incompatible.
Type '{}' is not assignable to type '{ a: string; }'.
Property 'a' is missing in type '{}'.
Type '{}' is not assignable to type '{ a: string; }'.
Property 'a' is missing in type '{}'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(19,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]'.
Property '2' is missing in type '[number, string]'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(20,5): error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]'.
@@ -18,9 +17,8 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(20,5): error TS23
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(24,1): error TS2322: Type '[C, string | number]' is not assignable to type '[C, string | number, D]'.
Property '2' is missing in type '[C, string | number]'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS2322: Type '[number, string | number]' is not assignable to type '[number, string]'.
Types of property '1' are incompatible.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (7 errors) ====
@@ -52,9 +50,8 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23
objNumTuple = [ {}, 5];
~~~~~~~~~~~
!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }'.
!!! error TS2322: Property 'a' is missing in type '{}'.
!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }'.
!!! error TS2322: Property 'a' is missing in type '{}'.
numStrBoolTuple = numStrTuple;
~~~~~~~~~~~~~~~
!!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]'.
@@ -76,6 +73,5 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23
numStrTuple = unionTuple3;
~~~~~~~~~~~
!!! error TS2322: Type '[number, string | number]' is not assignable to type '[number, string]'.
!!! error TS2322: Types of property '1' are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
@@ -11,8 +11,7 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(16,23): error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,14): error TS2322: Type '[number, number]' is not assignable to type '[string, number]'.
Types of property '0' are incompatible.
Type 'number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(26,14): error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'.
@@ -57,8 +56,7 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp
function g({ prop = [101, 1234] }: Tuples) {}
~~~~
!!! error TS2322: Type '[number, number]' is not assignable to type '[string, number]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
interface StringUnion {
prop: "foo" | "bar";
@@ -247,7 +247,7 @@ export declare class ConstructorWithPrivateParameterProperty {
constructor(x: string);
}
export declare class ConstructorWithOptionalParameterProperty {
x?: string;
x: string;
constructor(x?: string);
}
export declare class ConstructorWithParameterInitializer {
@@ -281,7 +281,7 @@ declare class GlobalConstructorWithPrivateParameterProperty {
constructor(x: string);
}
declare class GlobalConstructorWithOptionalParameterProperty {
x?: string;
x: string;
constructor(x?: string);
}
declare class GlobalConstructorWithParameterInitializer {
@@ -18,11 +18,9 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14):
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,14): error TS2459: Type 'undefined[]' has no property 'b' and no string index signature.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(106,5): error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
Types of property '1' are incompatible.
Type '[string, { y: boolean; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
Types of property '1' are incompatible.
Type '{ y: boolean; }' is not assignable to type '{ x: any; y?: boolean; }'.
Property 'x' is missing in type '{ y: boolean; }'.
Type '[string, { y: boolean; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
Type '{ y: boolean; }' is not assignable to type '{ x: any; y?: boolean; }'.
Property 'x' is missing in type '{ y: boolean; }'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,6): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'.
@@ -174,11 +172,9 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
f14([2, ["abc", { y: false }]]); // Error, no x
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
!!! error TS2345: Types of property '1' are incompatible.
!!! error TS2345: Type '[string, { y: boolean; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
!!! error TS2345: Types of property '1' are incompatible.
!!! error TS2345: Type '{ y: boolean; }' is not assignable to type '{ x: any; y?: boolean; }'.
!!! error TS2345: Property 'x' is missing in type '{ y: boolean; }'.
!!! error TS2345: Type '[string, { y: boolean; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
!!! error TS2345: Type '{ y: boolean; }' is not assignable to type '{ x: any; y?: boolean; }'.
!!! error TS2345: Property 'x' is missing in type '{ y: boolean; }'.
module M {
export var [a, b] = [1, 2];
@@ -2,8 +2,7 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
Types of property '1' are incompatible.
Type 'number' is not assignable to type 'boolean'.
Type 'number' is not assignable to type 'boolean'.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(17,6): error TS2322: Type 'string' is not assignable to type 'Number'.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2322: Type 'number[]' is not assignable to type '[number, number]'.
Property '0' is missing in type 'number[]'.
@@ -30,8 +29,7 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
var [b0, b1, b2]: [number, boolean, string] = [1, 2, "string"]; // Error
~~~~~~~~~~~~
!!! error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
!!! error TS2322: Types of property '1' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
interface J extends Array<Number> {
2: number;
}
@@ -1,6 +1,5 @@
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(7,4): error TS2345: Argument of type '[number, string, string[][]]' is not assignable to parameter of type '[number, number, string[][]]'.
Types of property '1' are incompatible.
Type 'string' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(7,29): error TS1005: ',' expected.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(8,4): error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'.
Types of property 'pop' are incompatible.
@@ -32,12 +31,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
Types of property '2' are incompatible.
Type 'boolean' is not assignable to type '[[any]]'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(40,4): error TS2345: Argument of type '[number, number, [[string]]]' is not assignable to parameter of type '[any, any, [[number]]]'.
Types of property '2' are incompatible.
Type '[[string]]' is not assignable to type '[[number]]'.
Types of property '0' are incompatible.
Type '[string]' is not assignable to type '[number]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
Type '[[string]]' is not assignable to type '[[number]]'.
Type '[string]' is not assignable to type '[number]'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(46,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(47,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(55,7): error TS2420: Class 'C4' incorrectly implements interface 'F2'.
@@ -62,8 +58,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
a0([1, "string", [["world"]]); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[number, string, string[][]]' is not assignable to parameter of type '[number, number, string[][]]'.
!!! error TS2345: Types of property '1' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
~
!!! error TS1005: ',' expected.
a0([1, 2, [["world"]], "string"]); // Error
@@ -142,12 +137,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
c6([1, 2, [["string"]]]); // Error, implied type is [any, any, [[number]]] // Use initializer
~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[number, number, [[string]]]' is not assignable to parameter of type '[any, any, [[number]]]'.
!!! error TS2345: Types of property '2' are incompatible.
!!! error TS2345: Type '[[string]]' is not assignable to type '[[number]]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type '[string]' is not assignable to type '[number]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
!!! error TS2345: Type '[[string]]' is not assignable to type '[[number]]'.
!!! error TS2345: Type '[string]' is not assignable to type '[number]'.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
// A parameter can be marked optional by following its name or binding pattern with a question mark (?)
// or by including an initializer. Initializers (including binding property or element initializers) are
@@ -6,8 +6,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(9
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(13,21): error TS2339: Property 'b' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(17,21): error TS2339: Property 'c' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(21,27): error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'.
Types of property '2' are incompatible.
Type 'string' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts (8 errors) ====
@@ -48,8 +47,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(2
var x = new C1(undefined, [0, undefined, ""]);
~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'.
!!! error TS2345: Types of property '2' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'boolean'.
!!! error TS2345: Type 'string' is not assignable to type 'boolean'.
var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
var y = new C1(10, [0, "", true]);
@@ -8,9 +8,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,62): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,72): error TS2339: Property 'z' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,19): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
Types of property '0' are incompatible.
Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'.
Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (10 errors) ====
@@ -45,7 +44,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
~~~~~~
!!! error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
!!! error TS2345: Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'.
!!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
!!! error TS2345: Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'.
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
@@ -2,12 +2,9 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3
Types of property 'a1' are incompatible.
Type 'boolean' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,5): error TS2322: Type '[number, [[boolean]], boolean]' is not assignable to type '[number, [[string]], boolean]'.
Types of property '1' are incompatible.
Type '[[boolean]]' is not assignable to type '[[string]]'.
Types of property '0' are incompatible.
Type '[boolean]' is not assignable to type '[string]'.
Types of property '0' are incompatible.
Type 'boolean' is not assignable to type 'string'.
Type '[[boolean]]' is not assignable to type '[[string]]'.
Type '[boolean]' is not assignable to type '[string]'.
Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(9,25): error TS2322: Type '{ t1: boolean; t2: string; }' is not assignable to type '{ t1: boolean; t2: number; }'.
Types of property 't2' are incompatible.
Type 'string' is not assignable to type 'number'.
@@ -28,12 +25,9 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(1
var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], true]; // Error
~~~~~~~~~~~~~~~~
!!! error TS2322: Type '[number, [[boolean]], boolean]' is not assignable to type '[number, [[string]], boolean]'.
!!! error TS2322: Types of property '1' are incompatible.
!!! error TS2322: Type '[[boolean]]' is not assignable to type '[[string]]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type '[boolean]' is not assignable to type '[string]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
!!! error TS2322: Type '[[boolean]]' is not assignable to type '[[string]]'.
!!! error TS2322: Type '[boolean]' is not assignable to type '[string]'.
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
// The type T associated with a destructuring variable declaration is determined as follows:
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
@@ -0,0 +1,9 @@
tests/cases/compiler/errorForConflictingExportEqualsValue.ts(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
==== tests/cases/compiler/errorForConflictingExportEqualsValue.ts (1 errors) ====
export var x;
export = {};
~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
@@ -0,0 +1,8 @@
//// [errorForConflictingExportEqualsValue.ts]
export var x;
export = {};
//// [errorForConflictingExportEqualsValue.js]
"use strict";
module.exports = {};
@@ -6,11 +6,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number'.
Type '{ a: string; }' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]'.
Types of property '0' are incompatible.
Type 'number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'.
Types of property '0' are incompatible.
Type '{}' is not assignable to type 'string'.
Type '{}' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'.
Property '1' is missing in type '[{}]'.
@@ -49,13 +47,11 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
i1.tuple1 = [5, "foo"];
~~~~~~~~~
!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
i1.tuple1 = [{}, {}];
~~~~~~~~~
!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type '{}' is not assignable to type 'string'.
!!! error TS2322: Type '{}' is not assignable to type 'string'.
i2.tuple1 = [{}];
~~~~~~~~~
!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'.
@@ -0,0 +1,20 @@
//// [instantiateContextuallyTypedGenericThis.ts]
interface JQuery {
each<T>(
collection: T[], callback: (this: T, dit: T) => T
): T[];
}
let $: JQuery;
let lines: string[];
$.each(lines, function(dit) {
return dit.charAt(0) + this.charAt(1);
});
//// [instantiateContextuallyTypedGenericThis.js]
var $;
var lines;
$.each(lines, function (dit) {
return dit.charAt(0) + this.charAt(1);
});
@@ -0,0 +1,46 @@
=== tests/cases/compiler/instantiateContextuallyTypedGenericThis.ts ===
interface JQuery {
>JQuery : Symbol(JQuery, Decl(instantiateContextuallyTypedGenericThis.ts, 0, 0))
each<T>(
>each : Symbol(JQuery.each, Decl(instantiateContextuallyTypedGenericThis.ts, 0, 18))
>T : Symbol(T, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 9))
collection: T[], callback: (this: T, dit: T) => T
>collection : Symbol(collection, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 12))
>T : Symbol(T, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 9))
>callback : Symbol(callback, Decl(instantiateContextuallyTypedGenericThis.ts, 2, 24))
>this : Symbol(this, Decl(instantiateContextuallyTypedGenericThis.ts, 2, 36))
>T : Symbol(T, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 9))
>dit : Symbol(dit, Decl(instantiateContextuallyTypedGenericThis.ts, 2, 44))
>T : Symbol(T, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 9))
>T : Symbol(T, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 9))
): T[];
>T : Symbol(T, Decl(instantiateContextuallyTypedGenericThis.ts, 1, 9))
}
let $: JQuery;
>$ : Symbol($, Decl(instantiateContextuallyTypedGenericThis.ts, 6, 3))
>JQuery : Symbol(JQuery, Decl(instantiateContextuallyTypedGenericThis.ts, 0, 0))
let lines: string[];
>lines : Symbol(lines, Decl(instantiateContextuallyTypedGenericThis.ts, 7, 3))
$.each(lines, function(dit) {
>$.each : Symbol(JQuery.each, Decl(instantiateContextuallyTypedGenericThis.ts, 0, 18))
>$ : Symbol($, Decl(instantiateContextuallyTypedGenericThis.ts, 6, 3))
>each : Symbol(JQuery.each, Decl(instantiateContextuallyTypedGenericThis.ts, 0, 18))
>lines : Symbol(lines, Decl(instantiateContextuallyTypedGenericThis.ts, 7, 3))
>dit : Symbol(dit, Decl(instantiateContextuallyTypedGenericThis.ts, 8, 23))
return dit.charAt(0) + this.charAt(1);
>dit.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>dit : Symbol(dit, Decl(instantiateContextuallyTypedGenericThis.ts, 8, 23))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>this.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>this : Symbol(this, Decl(instantiateContextuallyTypedGenericThis.ts, 2, 36))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
});
@@ -0,0 +1,53 @@
=== tests/cases/compiler/instantiateContextuallyTypedGenericThis.ts ===
interface JQuery {
>JQuery : JQuery
each<T>(
>each : <T>(collection: T[], callback: (this: T, dit: T) => T) => T[]
>T : T
collection: T[], callback: (this: T, dit: T) => T
>collection : T[]
>T : T
>callback : (this: T, dit: T) => T
>this : T
>T : T
>dit : T
>T : T
>T : T
): T[];
>T : T
}
let $: JQuery;
>$ : JQuery
>JQuery : JQuery
let lines: string[];
>lines : string[]
$.each(lines, function(dit) {
>$.each(lines, function(dit) { return dit.charAt(0) + this.charAt(1);}) : string[]
>$.each : <T>(collection: T[], callback: (this: T, dit: T) => T) => T[]
>$ : JQuery
>each : <T>(collection: T[], callback: (this: T, dit: T) => T) => T[]
>lines : string[]
>function(dit) { return dit.charAt(0) + this.charAt(1);} : (this: string, dit: string) => string
>dit : string
return dit.charAt(0) + this.charAt(1);
>dit.charAt(0) + this.charAt(1) : string
>dit.charAt(0) : string
>dit.charAt : (pos: number) => string
>dit : string
>charAt : (pos: number) => string
>0 : number
>this.charAt(1) : string
>this.charAt : (pos: number) => string
>this : string
>charAt : (pos: number) => string
>1 : number
});
@@ -1,7 +1,6 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern29.ts(1,33): error TS2501: A rest element cannot contain a binding pattern.
tests/cases/conformance/es6/destructuring/iterableArrayPattern29.ts(2,21): error TS2345: Argument of type '[string, boolean]' is not assignable to parameter of type '[string, number]'.
Types of property '1' are incompatible.
Type 'boolean' is not assignable to type 'number'.
Type 'boolean' is not assignable to type 'number'.
==== tests/cases/conformance/es6/destructuring/iterableArrayPattern29.ts (2 errors) ====
@@ -11,5 +10,4 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern29.ts(2,21): error
takeFirstTwoEntries(...new Map([["", true], ["hello", true]]));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[string, boolean]' is not assignable to parameter of type '[string, number]'.
!!! error TS2345: Types of property '1' are incompatible.
!!! error TS2345: Type 'boolean' is not assignable to type 'number'.
!!! error TS2345: Type 'boolean' is not assignable to type 'number'.
@@ -0,0 +1,20 @@
//// [in.js]
/**
* @param {never} p1
* @param {undefined} p2
* @param {null} p3
* @returns {void} nothing
*/
function f(p1, p2, p3) {
}
//// [out.js]
/**
* @param {never} p1
* @param {undefined} p2
* @param {null} p3
* @returns {void} nothing
*/
function f(p1, p2, p3) {
}
@@ -0,0 +1,14 @@
=== tests/cases/conformance/jsdoc/in.js ===
/**
* @param {never} p1
* @param {undefined} p2
* @param {null} p3
* @returns {void} nothing
*/
function f(p1, p2, p3) {
>f : Symbol(f, Decl(in.js, 0, 0))
>p1 : Symbol(p1, Decl(in.js, 6, 11))
>p2 : Symbol(p2, Decl(in.js, 6, 14))
>p3 : Symbol(p3, Decl(in.js, 6, 18))
}
@@ -0,0 +1,14 @@
=== tests/cases/conformance/jsdoc/in.js ===
/**
* @param {never} p1
* @param {undefined} p2
* @param {null} p3
* @returns {void} nothing
*/
function f(p1, p2, p3) {
>f : (p1: never, p2: undefined, p3: null) => void
>p1 : never
>p2 : undefined
>p3 : null
}
@@ -0,0 +1,26 @@
/index.ts(4,5): error TS2339: Property 'y' does not exist on type 'typeof "shortid"'.
==== /index.ts (1 errors) ====
/// <reference path="/typings/index.d.ts" />
import * as foo from "shortid";
foo.x // found in index.d.ts
foo.y // ignored from shortid/index.js
~
!!! error TS2339: Property 'y' does not exist on type 'typeof "shortid"'.
==== /node_modules/shortid/node_modules/z/index.js (0 errors) ====
// z will not be found because maxNodeModulesJsDepth: 0
module.exports = { z: 'no' };
==== /node_modules/shortid/index.js (0 errors) ====
var z = require('z');
var y = { y: 'foo' };
module.exports = y;
==== /typings/index.d.ts (0 errors) ====
declare module "shortid" {
export var x: number;
}
@@ -0,0 +1,28 @@
[
"======== Resolving module 'shortid' from '/index.ts'. ========",
"Explicitly specified module resolution kind: 'NodeJs'.",
"Loading module 'shortid' from 'node_modules' folder.",
"File '/node_modules/shortid.ts' does not exist.",
"File '/node_modules/shortid.tsx' does not exist.",
"File '/node_modules/shortid.d.ts' does not exist.",
"File '/node_modules/shortid.js' does not exist.",
"File '/node_modules/shortid.jsx' does not exist.",
"File '/node_modules/shortid/package.json' does not exist.",
"File '/node_modules/shortid/index.ts' does not exist.",
"File '/node_modules/shortid/index.tsx' does not exist.",
"File '/node_modules/shortid/index.d.ts' does not exist.",
"File '/node_modules/shortid/index.js' exist - use it as a name resolution result.",
"File '/node_modules/@types/shortid.ts' does not exist.",
"File '/node_modules/@types/shortid.tsx' does not exist.",
"File '/node_modules/@types/shortid.d.ts' does not exist.",
"File '/node_modules/@types/shortid.js' does not exist.",
"File '/node_modules/@types/shortid.jsx' does not exist.",
"File '/node_modules/@types/shortid/package.json' does not exist.",
"File '/node_modules/@types/shortid/index.ts' does not exist.",
"File '/node_modules/@types/shortid/index.tsx' does not exist.",
"File '/node_modules/@types/shortid/index.d.ts' does not exist.",
"File '/node_modules/@types/shortid/index.js' does not exist.",
"File '/node_modules/@types/shortid/index.jsx' does not exist.",
"Resolving real path for '/node_modules/shortid/index.js', result '/node_modules/shortid/index.js'",
"======== Module name 'shortid' was successfully resolved to '/node_modules/shortid/index.js'. ========"
]
@@ -0,0 +1,36 @@
tests/cases/compiler/nativeToBoxedTypes.ts(3,1): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
tests/cases/compiler/nativeToBoxedTypes.ts(7,1): error TS2322: Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
tests/cases/compiler/nativeToBoxedTypes.ts(11,1): error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
tests/cases/compiler/nativeToBoxedTypes.ts(14,10): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/compiler/nativeToBoxedTypes.ts (4 errors) ====
var N = new Number();
var n = 100;
n = N;
~
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
!!! error TS2322: 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
var S = new String();
var s = "foge";
s = S;
~
!!! error TS2322: Type 'String' is not assignable to type 'string'.
!!! error TS2322: 'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
var B = new Boolean();
var b = true;
b = B;
~
!!! error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
!!! error TS2322: 'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
var sym: symbol;
var Sym: Symbol;
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
sym = Sym;
@@ -0,0 +1,30 @@
//// [nativeToBoxedTypes.ts]
var N = new Number();
var n = 100;
n = N;
var S = new String();
var s = "foge";
s = S;
var B = new Boolean();
var b = true;
b = B;
var sym: symbol;
var Sym: Symbol;
sym = Sym;
//// [nativeToBoxedTypes.js]
var N = new Number();
var n = 100;
n = N;
var S = new String();
var s = "foge";
s = S;
var B = new Boolean();
var b = true;
b = B;
var sym;
var Sym;
sym = Sym;
@@ -1,7 +1,6 @@
tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(2,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
Types of property '0' are incompatible.
Type 'boolean' is not assignable to type 'string'.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts (2 errors) ====
@@ -17,5 +16,4 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): er
foo([false, 0, ""]);
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.
@@ -1,6 +1,5 @@
tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(9,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
Types of property '0' are incompatible.
Type 'boolean' is not assignable to type 'string'.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts (1 errors) ====
@@ -15,5 +14,4 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.
foo([false, 0, ""]);
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.
+1 -1
View File
@@ -126,7 +126,7 @@ interface Foo {
}
declare function test1(x: Foo): void;
declare class Bar {
d?: number;
d: number;
e: number;
a: number;
b?: number;
@@ -1,5 +1,6 @@
tests/cases/compiler/primitiveMembers.ts(5,3): error TS2339: Property 'toBAZ' does not exist on type 'number'.
tests/cases/compiler/primitiveMembers.ts(11,1): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
==== tests/cases/compiler/primitiveMembers.ts (2 errors) ====
@@ -18,6 +19,7 @@ tests/cases/compiler/primitiveMembers.ts(11,1): error TS2322: Type 'Number' is n
n = N; // should not work, as 'number' has a different brand
~
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
!!! error TS2322: 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
N = n; // should work
var o: Object = {}
@@ -1,4 +1,5 @@
tests/cases/conformance/es6/Symbols/symbolType15.ts(5,1): error TS2322: Type 'Symbol' is not assignable to type 'symbol'.
'symbol' is a primitive, but 'Symbol' is a wrapper object. Prefer using 'symbol' when possible.
==== tests/cases/conformance/es6/Symbols/symbolType15.ts (1 errors) ====
@@ -8,4 +9,5 @@ tests/cases/conformance/es6/Symbols/symbolType15.ts(5,1): error TS2322: Type 'Sy
symObj = sym;
sym = symObj;
~~~
!!! error TS2322: Type 'Symbol' is not assignable to type 'symbol'.
!!! error TS2322: Type 'Symbol' is not assignable to type 'symbol'.
!!! error TS2322: 'symbol' is a primitive, but 'Symbol' is a wrapper object. Prefer using 'symbol' when possible.
@@ -135,7 +135,7 @@ let impl: I = {
return this.a;
>this.a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 24, 28))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 24, 23))
>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30))
},
@@ -144,7 +144,7 @@ let impl: I = {
return this.a;
>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 25, 22))
>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
},
@@ -153,7 +153,7 @@ let impl: I = {
return this.a;
>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 26, 17))
>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
},
@@ -173,7 +173,7 @@ impl.explicitStructural = function() { return this.a; };
>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3))
>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38))
>this.a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 24, 28))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 24, 23))
>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30))
impl.explicitInterface = function() { return this.a; };
@@ -181,7 +181,7 @@ impl.explicitInterface = function() { return this.a; };
>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3))
>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50))
>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 25, 22))
>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
impl.explicitStructural = () => 12;
@@ -199,7 +199,7 @@ impl.explicitThis = function () { return this.a; };
>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3))
>explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39))
>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 26, 17))
>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13))
// parameter checking
@@ -536,7 +536,7 @@ c.explicitC = function(m) { return this.n + m };
>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 126, 23))
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 9, 14))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 126, 23))
@@ -546,7 +546,7 @@ c.explicitProperty = function(m) { return this.n + m };
>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 127, 30))
>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28))
>this : Symbol(, Decl(thisTypeInFunctions.ts, 12, 26))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 12, 21))
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 127, 30))
@@ -556,7 +556,7 @@ c.explicitThis = function(m) { return this.n + m };
>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 128, 26))
>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1))
>this : Symbol(this, Decl(thisTypeInFunctions.ts, 6, 17))
>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 128, 26))
@@ -132,7 +132,7 @@ function implicitThis(n: number): number {
let impl: I = {
>impl : I
>I : I
>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(): number; explicitStructural(): number; explicitInterface(): number; explicitThis(): number; }
>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(this: void): number; explicitStructural(this: { a: number; }): number; explicitInterface(this: I): number; explicitThis(this: I): number; }
a: 12,
>a : number
@@ -146,11 +146,11 @@ let impl: I = {
>a : any
explicitVoid1() { return 12; },
>explicitVoid1 : () => number
>explicitVoid1 : (this: void) => number
>12 : number
explicitStructural() {
>explicitStructural : () => number
>explicitStructural : (this: { a: number; }) => number
return this.a;
>this.a : number
@@ -159,7 +159,7 @@ let impl: I = {
},
explicitInterface() {
>explicitInterface : () => number
>explicitInterface : (this: I) => number
return this.a;
>this.a : number
@@ -168,7 +168,7 @@ let impl: I = {
},
explicitThis() {
>explicitThis : () => number
>explicitThis : (this: I) => number
return this.a;
>this.a : number
@@ -178,11 +178,11 @@ let impl: I = {
},
}
impl.explicitVoid1 = function () { return 12; };
>impl.explicitVoid1 = function () { return 12; } : () => number
>impl.explicitVoid1 = function () { return 12; } : (this: void) => number
>impl.explicitVoid1 : (this: void) => number
>impl : I
>explicitVoid1 : (this: void) => number
>function () { return 12; } : () => number
>function () { return 12; } : (this: void) => number
>12 : number
impl.explicitVoid2 = () => 12;
@@ -194,21 +194,21 @@ impl.explicitVoid2 = () => 12;
>12 : number
impl.explicitStructural = function() { return this.a; };
>impl.explicitStructural = function() { return this.a; } : () => number
>impl.explicitStructural = function() { return this.a; } : (this: { a: number; }) => number
>impl.explicitStructural : (this: { a: number; }) => number
>impl : I
>explicitStructural : (this: { a: number; }) => number
>function() { return this.a; } : () => number
>function() { return this.a; } : (this: { a: number; }) => number
>this.a : number
>this : { a: number; }
>a : number
impl.explicitInterface = function() { return this.a; };
>impl.explicitInterface = function() { return this.a; } : () => number
>impl.explicitInterface = function() { return this.a; } : (this: I) => number
>impl.explicitInterface : (this: I) => number
>impl : I
>explicitInterface : (this: I) => number
>function() { return this.a; } : () => number
>function() { return this.a; } : (this: I) => number
>this.a : number
>this : I
>a : number
@@ -230,11 +230,11 @@ impl.explicitInterface = () => 12;
>12 : number
impl.explicitThis = function () { return this.a; };
>impl.explicitThis = function () { return this.a; } : () => number
>impl.explicitThis = function () { return this.a; } : (this: I) => number
>impl.explicitThis : (this: I) => number
>impl : I
>explicitThis : (this: I) => number
>function () { return this.a; } : () => number
>function () { return this.a; } : (this: I) => number
>this.a : number
>this : I
>a : number
@@ -433,7 +433,7 @@ let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + th
>this : { y: number; }
>y : number
>x : number
>x => x + this.y : (x: number) => any
>x => x + this.y : (this: { y: number; }, x: number) => any
>x : number
>x + this.y : any
>x : number
@@ -472,7 +472,7 @@ let specifiedLambda: (this: void, x: number) => number = x => x + 12;
>specifiedLambda : (this: void, x: number) => number
>this : void
>x : number
>x => x + 12 : (x: number) => number
>x => x + 12 : (this: void, x: number) => number
>x : number
>x + 12 : number
>x : number
@@ -560,40 +560,40 @@ c.explicitProperty = reconstructed.explicitProperty;
// lambdas are assignable to anything
c.explicitC = m => m;
>c.explicitC = m => m : (m: number) => number
>c.explicitC = m => m : (this: C, m: number) => number
>c.explicitC : (this: C, m: number) => number
>c : C
>explicitC : (this: C, m: number) => number
>m => m : (m: number) => number
>m => m : (this: C, m: number) => number
>m : number
>m : number
c.explicitThis = m => m;
>c.explicitThis = m => m : (m: number) => number
>c.explicitThis = m => m : (this: C, m: number) => number
>c.explicitThis : (this: C, m: number) => number
>c : C
>explicitThis : (this: C, m: number) => number
>m => m : (m: number) => number
>m => m : (this: C, m: number) => number
>m : number
>m : number
c.explicitProperty = m => m;
>c.explicitProperty = m => m : (m: number) => number
>c.explicitProperty = m => m : (this: { n: number; }, m: number) => number
>c.explicitProperty : (this: { n: number; }, m: number) => number
>c : C
>explicitProperty : (this: { n: number; }, m: number) => number
>m => m : (m: number) => number
>m => m : (this: { n: number; }, m: number) => number
>m : number
>m : number
// this inside lambdas refer to outer scope
// the outer-scoped lambda at top-level is still just `any`
c.explicitC = m => m + this.n;
>c.explicitC = m => m + this.n : (m: number) => any
>c.explicitC = m => m + this.n : (this: C, m: number) => any
>c.explicitC : (this: C, m: number) => number
>c : C
>explicitC : (this: C, m: number) => number
>m => m + this.n : (m: number) => any
>m => m + this.n : (this: C, m: number) => any
>m : number
>m + this.n : any
>m : number
@@ -602,11 +602,11 @@ c.explicitC = m => m + this.n;
>n : any
c.explicitThis = m => m + this.n;
>c.explicitThis = m => m + this.n : (m: number) => any
>c.explicitThis = m => m + this.n : (this: C, m: number) => any
>c.explicitThis : (this: C, m: number) => number
>c : C
>explicitThis : (this: C, m: number) => number
>m => m + this.n : (m: number) => any
>m => m + this.n : (this: C, m: number) => any
>m : number
>m + this.n : any
>m : number
@@ -615,11 +615,11 @@ c.explicitThis = m => m + this.n;
>n : any
c.explicitProperty = m => m + this.n;
>c.explicitProperty = m => m + this.n : (m: number) => any
>c.explicitProperty = m => m + this.n : (this: { n: number; }, m: number) => any
>c.explicitProperty : (this: { n: number; }, m: number) => number
>c : C
>explicitProperty : (this: { n: number; }, m: number) => number
>m => m + this.n : (m: number) => any
>m => m + this.n : (this: { n: number; }, m: number) => any
>m : number
>m + this.n : any
>m : number
@@ -652,11 +652,11 @@ c.explicitThis = function(this: C, m: number) { return this.n + m };
// this:any compatibility
c.explicitC = function(m) { return this.n + m };
>c.explicitC = function(m) { return this.n + m } : (m: number) => number
>c.explicitC = function(m) { return this.n + m } : (this: C, m: number) => number
>c.explicitC : (this: C, m: number) => number
>c : C
>explicitC : (this: C, m: number) => number
>function(m) { return this.n + m } : (m: number) => number
>function(m) { return this.n + m } : (this: C, m: number) => number
>m : number
>this.n + m : number
>this.n : number
@@ -665,11 +665,11 @@ c.explicitC = function(m) { return this.n + m };
>m : number
c.explicitProperty = function(m) { return this.n + m };
>c.explicitProperty = function(m) { return this.n + m } : (m: number) => number
>c.explicitProperty = function(m) { return this.n + m } : (this: { n: number; }, m: number) => number
>c.explicitProperty : (this: { n: number; }, m: number) => number
>c : C
>explicitProperty : (this: { n: number; }, m: number) => number
>function(m) { return this.n + m } : (m: number) => number
>function(m) { return this.n + m } : (this: { n: number; }, m: number) => number
>m : number
>this.n + m : number
>this.n : number
@@ -678,11 +678,11 @@ c.explicitProperty = function(m) { return this.n + m };
>m : number
c.explicitThis = function(m) { return this.n + m };
>c.explicitThis = function(m) { return this.n + m } : (m: number) => number
>c.explicitThis = function(m) { return this.n + m } : (this: C, m: number) => number
>c.explicitThis : (this: C, m: number) => number
>c : C
>explicitThis : (this: C, m: number) => number
>function(m) { return this.n + m } : (m: number) => number
>function(m) { return this.n + m } : (this: C, m: number) => number
>m : number
>this.n + m : number
>this.n : number
@@ -723,11 +723,11 @@ c.explicitC = function(this: B, m: number) { return this.n + m };
// this:void compatibility
c.explicitVoid = n => n;
>c.explicitVoid = n => n : (n: number) => number
>c.explicitVoid = n => n : (this: void, n: number) => number
>c.explicitVoid : (this: void, m: number) => number
>c : C
>explicitVoid : (this: void, m: number) => number
>n => n : (n: number) => number
>n => n : (this: void, n: number) => number
>n : number
>n : number
@@ -61,12 +61,12 @@ extend1({
>init : Symbol(init, Decl(thisTypeInFunctions2.ts, 20, 9))
this // this: IndexedWithThis because of contextual typing.
>this : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 2, 12))
// this.mine
this.willDestroy
>this.willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32))
>this : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0))
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 2, 12))
>willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32))
},
@@ -77,7 +77,10 @@ extend1({
>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 26, 13))
this.url; // this: any because 'foo' matches the string indexer
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 4, 87))
this.willDestroy;
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 4, 87))
}
});
extend2({
@@ -58,10 +58,10 @@ declare function simple(arg: SimpleInterface): void;
extend1({
>extend1({ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }}) : void
>extend1 : (args: IndexedWithThis) => void
>{ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }} : { init(): void; mine: number; foo(): void; }
>{ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }} : { init(this: IndexedWithThis): void; mine: number; foo(this: any): void; }
init() {
>init : () => void
>init : (this: IndexedWithThis) => void
this // this: IndexedWithThis because of contextual typing.
>this : IndexedWithThis
@@ -78,7 +78,7 @@ extend1({
>12 : number
foo() {
>foo : () => void
>foo : (this: any) => void
this.url; // this: any because 'foo' matches the string indexer
>this.url : any
@@ -0,0 +1,34 @@
//// [tests/cases/compiler/tsxDefaultImports.ts] ////
//// [a.ts]
enum SomeEnum {
one,
}
export default class SomeClass {
public static E = SomeEnum;
}
//// [b.ts]
import {default as Def} from "./a"
let a = Def.E.one;
//// [a.js]
"use strict";
var SomeEnum;
(function (SomeEnum) {
SomeEnum[SomeEnum["one"] = 0] = "one";
})(SomeEnum || (SomeEnum = {}));
var SomeClass = (function () {
function SomeClass() {
}
SomeClass.E = SomeEnum;
return SomeClass;
}());
exports.__esModule = true;
exports["default"] = SomeClass;
//// [b.js]
"use strict";
var a_1 = require("./a");
var a = a_1["default"].E.one;
@@ -0,0 +1,29 @@
=== tests/cases/compiler/a.ts ===
enum SomeEnum {
>SomeEnum : Symbol(SomeEnum, Decl(a.ts, 0, 0))
one,
>one : Symbol(SomeEnum.one, Decl(a.ts, 1, 15))
}
export default class SomeClass {
>SomeClass : Symbol(SomeClass, Decl(a.ts, 3, 1))
public static E = SomeEnum;
>E : Symbol(SomeClass.E, Decl(a.ts, 4, 32))
>SomeEnum : Symbol(SomeEnum, Decl(a.ts, 0, 0))
}
=== tests/cases/compiler/b.ts ===
import {default as Def} from "./a"
>default : Symbol(Def, Decl(b.ts, 0, 8))
>Def : Symbol(Def, Decl(b.ts, 0, 8))
let a = Def.E.one;
>a : Symbol(a, Decl(b.ts, 1, 3))
>Def.E.one : Symbol(SomeEnum.one, Decl(a.ts, 1, 15))
>Def.E : Symbol(Def.E, Decl(a.ts, 4, 32))
>Def : Symbol(Def, Decl(b.ts, 0, 8))
>E : Symbol(Def.E, Decl(a.ts, 4, 32))
>one : Symbol(SomeEnum.one, Decl(a.ts, 1, 15))
@@ -0,0 +1,29 @@
=== tests/cases/compiler/a.ts ===
enum SomeEnum {
>SomeEnum : SomeEnum
one,
>one : SomeEnum
}
export default class SomeClass {
>SomeClass : SomeClass
public static E = SomeEnum;
>E : typeof SomeEnum
>SomeEnum : typeof SomeEnum
}
=== tests/cases/compiler/b.ts ===
import {default as Def} from "./a"
>default : typeof Def
>Def : typeof Def
let a = Def.E.one;
>a : SomeEnum
>Def.E.one : SomeEnum
>Def.E : typeof SomeEnum
>Def : typeof Def
>E : typeof SomeEnum
>one : SomeEnum
@@ -4,8 +4,7 @@ tests/cases/compiler/tupleTypes.ts(14,1): error TS2322: Type 'undefined[]' is no
tests/cases/compiler/tupleTypes.ts(15,1): error TS2322: Type '[number]' is not assignable to type '[number, string]'.
Property '1' is missing in type '[number]'.
tests/cases/compiler/tupleTypes.ts(17,1): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
Types of property '0' are incompatible.
Type 'string' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/tupleTypes.ts(41,1): error TS2322: Type 'undefined[]' is not assignable to type '[number, string]'.
tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
Types of property 'pop' are incompatible.
@@ -18,11 +17,9 @@ tests/cases/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is n
Type 'number | {}' is not assignable to type 'number'.
Type '{}' is not assignable to type 'number'.
tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
Types of property '1' are incompatible.
Type 'number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is not assignable to type '[number, string]'.
Types of property '1' are incompatible.
Type '{}' is not assignable to type 'string'.
Type '{}' is not assignable to type 'string'.
==== tests/cases/compiler/tupleTypes.ts (9 errors) ====
@@ -53,8 +50,7 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
t = ["hello", 1]; // Error
~
!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
!!! error TS2322: Types of property '0' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
t = [1, "hello", 2]; // Ok
var tf: [string, (x: string) => number] = ["hello", x => x.length];
@@ -104,13 +100,11 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
a1 = a2; // Error
~~
!!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
!!! error TS2322: Types of property '1' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
a1 = a3; // Error
~~
!!! error TS2322: Type '[number, {}]' is not assignable to type '[number, string]'.
!!! error TS2322: Types of property '1' are incompatible.
!!! error TS2322: Type '{}' is not assignable to type 'string'.
!!! error TS2322: Type '{}' is not assignable to type 'string'.
a3 = a1;
a3 = a2;
@@ -0,0 +1,36 @@
//// [tests/cases/conformance/typings/typingsLookup4.ts] ////
//// [package.json]
{ "typings": "jquery.d.ts" }
//// [jquery.d.ts]
export const j: number;
//// [package.json]
{ "typings": "kquery" }
//// [kquery.d.ts]
export const k: number;
//// [package.json]
{ "typings": "lquery" }
//// [lquery.ts]
export const l = 2;
//// [a.ts]
import { j } from "jquery";
import { k } from "kquery";
import { l } from "lquery";
j + k + l;
//// [lquery.js]
"use strict";
exports.l = 2;
//// [a.js]
"use strict";
var jquery_1 = require("jquery");
var kquery_1 = require("kquery");
var lquery_1 = require("lquery");
jquery_1.j + kquery_1.k + lquery_1.l;

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