Merge branch 'master' into alternateFixSuperInAsyncMethod

This commit is contained in:
Ron Buckton committed 2016-01-21 16:52:45 -08:00
commit 6084dec8b9
283 files changed
+25468 -15035

No files matched your search

-1
View File
@@ -14,7 +14,6 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
+8 -9
View File
@@ -14,7 +14,6 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@@ -5121,15 +5120,15 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
/**
+32 -14
View File
@@ -14,7 +14,6 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@@ -5296,7 +5295,7 @@ interface Console {
select(element: Element): void;
time(timerName?: string): void;
timeEnd(timerName?: string): void;
trace(): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
@@ -5555,9 +5554,9 @@ interface DataTransferItemList {
length: number;
add(data: File): DataTransferItem;
clear(): void;
item(index: number): File;
item(index: number): DataTransferItem;
remove(index: number): void;
[index: number]: File;
[index: number]: DataTransferItem;
}
declare var DataTransferItemList: {
@@ -6610,6 +6609,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
createElement(tagName: "picture"): HTMLPictureElement;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -7022,6 +7023,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
webkitRequestFullscreen(): void;
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -7811,6 +7813,7 @@ interface HTMLCanvasElement extends HTMLElement {
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(): Blob;
}
declare var HTMLCanvasElement: {
@@ -10965,7 +10968,7 @@ interface IDBDatabase extends EventTarget {
objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
version: string;
version: number;
close(): void;
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
deleteObjectStore(name: string): void;
@@ -11681,7 +11684,7 @@ declare var MediaQueryList: {
interface MediaSource extends EventTarget {
activeSourceBuffers: SourceBufferList;
duration: number;
readyState: number;
readyState: string;
sourceBuffers: SourceBufferList;
addSourceBuffer(type: string): SourceBuffer;
endOfStream(error?: number): void;
@@ -14410,17 +14413,16 @@ declare var Storage: {
}
interface StorageEvent extends Event {
key: string;
newValue: any;
oldValue: any;
storageArea: Storage;
url: string;
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
key?: string;
oldValue?: string;
newValue?: string;
storageArea?: Storage;
}
declare var StorageEvent: {
prototype: StorageEvent;
new(): StorageEvent;
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
}
interface StyleMedia {
@@ -16018,7 +16020,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
msMatchMedia(mediaQuery: string): MediaQueryList;
msRequestAnimationFrame(callback: FrameRequestCallback): number;
msWriteProfilerMark(profilerMarkName: string): void;
open(url?: string, target?: string, features?: string, replace?: boolean): any;
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
postMessage(message: any, targetOrigin: string, ports?: any): void;
print(): void;
prompt(message?: string, _default?: string): string;
@@ -16620,6 +16622,14 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface StorageEventInit extends EventInit {
key?: string;
oldValue?: string;
newValue?: string;
url: string;
storageArea?: Storage;
}
interface IDBObjectStoreParameters {
keyPath?: string | string[];
autoIncrement?: boolean;
@@ -16674,6 +16684,14 @@ declare var HTMLTemplateElement: {
new(): HTMLTemplateElement;
}
interface HTMLPictureElement extends HTMLElement {
}
declare var HTMLPictureElement: {
prototype: HTMLPictureElement;
new(): HTMLPictureElement;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -16870,7 +16888,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function msWriteProfilerMark(profilerMarkName: string): void;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
declare function print(): void;
declare function prompt(message?: string, _default?: string): string;
+32 -13
View File
@@ -1472,7 +1472,7 @@ interface Console {
select(element: Element): void;
time(timerName?: string): void;
timeEnd(timerName?: string): void;
trace(): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
@@ -1731,9 +1731,9 @@ interface DataTransferItemList {
length: number;
add(data: File): DataTransferItem;
clear(): void;
item(index: number): File;
item(index: number): DataTransferItem;
remove(index: number): void;
[index: number]: File;
[index: number]: DataTransferItem;
}
declare var DataTransferItemList: {
@@ -2786,6 +2786,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
createElement(tagName: "picture"): HTMLPictureElement;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -3198,6 +3200,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
webkitRequestFullscreen(): void;
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -3987,6 +3990,7 @@ interface HTMLCanvasElement extends HTMLElement {
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(): Blob;
}
declare var HTMLCanvasElement: {
@@ -7141,7 +7145,7 @@ interface IDBDatabase extends EventTarget {
objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
version: string;
version: number;
close(): void;
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
deleteObjectStore(name: string): void;
@@ -7857,7 +7861,7 @@ declare var MediaQueryList: {
interface MediaSource extends EventTarget {
activeSourceBuffers: SourceBufferList;
duration: number;
readyState: number;
readyState: string;
sourceBuffers: SourceBufferList;
addSourceBuffer(type: string): SourceBuffer;
endOfStream(error?: number): void;
@@ -10586,17 +10590,16 @@ declare var Storage: {
}
interface StorageEvent extends Event {
key: string;
newValue: any;
oldValue: any;
storageArea: Storage;
url: string;
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
key?: string;
oldValue?: string;
newValue?: string;
storageArea?: Storage;
}
declare var StorageEvent: {
prototype: StorageEvent;
new(): StorageEvent;
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
}
interface StyleMedia {
@@ -12194,7 +12197,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
msMatchMedia(mediaQuery: string): MediaQueryList;
msRequestAnimationFrame(callback: FrameRequestCallback): number;
msWriteProfilerMark(profilerMarkName: string): void;
open(url?: string, target?: string, features?: string, replace?: boolean): any;
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
postMessage(message: any, targetOrigin: string, ports?: any): void;
print(): void;
prompt(message?: string, _default?: string): string;
@@ -12796,6 +12799,14 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface StorageEventInit extends EventInit {
key?: string;
oldValue?: string;
newValue?: string;
url: string;
storageArea?: Storage;
}
interface IDBObjectStoreParameters {
keyPath?: string | string[];
autoIncrement?: boolean;
@@ -12850,6 +12861,14 @@ declare var HTMLTemplateElement: {
new(): HTMLTemplateElement;
}
interface HTMLPictureElement extends HTMLElement {
}
declare var HTMLPictureElement: {
prototype: HTMLPictureElement;
new(): HTMLPictureElement;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -13046,7 +13065,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function msWriteProfilerMark(profilerMarkName: string): void;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
declare function print(): void;
declare function prompt(message?: string, _default?: string): string;
+41 -23
View File
@@ -13,6 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare type PropertyKey = string | number | symbol;
interface Symbol {
@@ -1296,15 +1297,15 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
/**
@@ -1346,8 +1347,6 @@ interface PromiseConstructor {
}
declare var Promise: PromiseConstructor;
/// <reference no-default-lib="true"/>
/////////////////////////////
/// ECMAScript APIs
/////////////////////////////
@@ -6629,7 +6628,7 @@ interface Console {
select(element: Element): void;
time(timerName?: string): void;
timeEnd(timerName?: string): void;
trace(): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
@@ -6888,9 +6887,9 @@ interface DataTransferItemList {
length: number;
add(data: File): DataTransferItem;
clear(): void;
item(index: number): File;
item(index: number): DataTransferItem;
remove(index: number): void;
[index: number]: File;
[index: number]: DataTransferItem;
}
declare var DataTransferItemList: {
@@ -7943,6 +7942,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
createElement(tagName: "picture"): HTMLPictureElement;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -8355,6 +8356,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
webkitRequestFullscreen(): void;
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -9144,6 +9146,7 @@ interface HTMLCanvasElement extends HTMLElement {
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(): Blob;
}
declare var HTMLCanvasElement: {
@@ -12298,7 +12301,7 @@ interface IDBDatabase extends EventTarget {
objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
version: string;
version: number;
close(): void;
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
deleteObjectStore(name: string): void;
@@ -13014,7 +13017,7 @@ declare var MediaQueryList: {
interface MediaSource extends EventTarget {
activeSourceBuffers: SourceBufferList;
duration: number;
readyState: number;
readyState: string;
sourceBuffers: SourceBufferList;
addSourceBuffer(type: string): SourceBuffer;
endOfStream(error?: number): void;
@@ -15743,17 +15746,16 @@ declare var Storage: {
}
interface StorageEvent extends Event {
key: string;
newValue: any;
oldValue: any;
storageArea: Storage;
url: string;
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
key?: string;
oldValue?: string;
newValue?: string;
storageArea?: Storage;
}
declare var StorageEvent: {
prototype: StorageEvent;
new(): StorageEvent;
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
}
interface StyleMedia {
@@ -17351,7 +17353,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
msMatchMedia(mediaQuery: string): MediaQueryList;
msRequestAnimationFrame(callback: FrameRequestCallback): number;
msWriteProfilerMark(profilerMarkName: string): void;
open(url?: string, target?: string, features?: string, replace?: boolean): any;
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
postMessage(message: any, targetOrigin: string, ports?: any): void;
print(): void;
prompt(message?: string, _default?: string): string;
@@ -17953,6 +17955,14 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface StorageEventInit extends EventInit {
key?: string;
oldValue?: string;
newValue?: string;
url: string;
storageArea?: Storage;
}
interface IDBObjectStoreParameters {
keyPath?: string | string[];
autoIncrement?: boolean;
@@ -18007,6 +18017,14 @@ declare var HTMLTemplateElement: {
new(): HTMLTemplateElement;
}
interface HTMLPictureElement extends HTMLElement {
}
declare var HTMLPictureElement: {
prototype: HTMLPictureElement;
new(): HTMLPictureElement;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -18203,7 +18221,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function msWriteProfilerMark(profilerMarkName: string): void;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
declare function print(): void;
declare function prompt(message?: string, _default?: string): string;
+2 -2
View File
@@ -286,7 +286,7 @@ interface Console {
select(element: any): void;
time(timerName?: string): void;
timeEnd(timerName?: string): void;
trace(): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
@@ -526,7 +526,7 @@ interface IDBDatabase extends EventTarget {
objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
version: string;
version: number;
close(): void;
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
deleteObjectStore(name: string): void;
+3048 -2636
View File
File diff suppressed because it is too large. Load diff
+4087 -3504
View File
File diff suppressed because it is too large. Load diff
+169 -149
View File
@@ -167,161 +167,162 @@ declare namespace ts {
SymbolKeyword = 131,
TypeKeyword = 132,
FromKeyword = 133,
OfKeyword = 134,
QualifiedName = 135,
ComputedPropertyName = 136,
TypeParameter = 137,
Parameter = 138,
Decorator = 139,
PropertySignature = 140,
PropertyDeclaration = 141,
MethodSignature = 142,
MethodDeclaration = 143,
Constructor = 144,
GetAccessor = 145,
SetAccessor = 146,
CallSignature = 147,
ConstructSignature = 148,
IndexSignature = 149,
TypePredicate = 150,
TypeReference = 151,
FunctionType = 152,
ConstructorType = 153,
TypeQuery = 154,
TypeLiteral = 155,
ArrayType = 156,
TupleType = 157,
UnionType = 158,
IntersectionType = 159,
ParenthesizedType = 160,
ThisType = 161,
StringLiteralType = 162,
ObjectBindingPattern = 163,
ArrayBindingPattern = 164,
BindingElement = 165,
ArrayLiteralExpression = 166,
ObjectLiteralExpression = 167,
PropertyAccessExpression = 168,
ElementAccessExpression = 169,
CallExpression = 170,
NewExpression = 171,
TaggedTemplateExpression = 172,
TypeAssertionExpression = 173,
ParenthesizedExpression = 174,
FunctionExpression = 175,
ArrowFunction = 176,
DeleteExpression = 177,
TypeOfExpression = 178,
VoidExpression = 179,
AwaitExpression = 180,
PrefixUnaryExpression = 181,
PostfixUnaryExpression = 182,
BinaryExpression = 183,
ConditionalExpression = 184,
TemplateExpression = 185,
YieldExpression = 186,
SpreadElementExpression = 187,
ClassExpression = 188,
OmittedExpression = 189,
ExpressionWithTypeArguments = 190,
AsExpression = 191,
TemplateSpan = 192,
SemicolonClassElement = 193,
Block = 194,
VariableStatement = 195,
EmptyStatement = 196,
ExpressionStatement = 197,
IfStatement = 198,
DoStatement = 199,
WhileStatement = 200,
ForStatement = 201,
ForInStatement = 202,
ForOfStatement = 203,
ContinueStatement = 204,
BreakStatement = 205,
ReturnStatement = 206,
WithStatement = 207,
SwitchStatement = 208,
LabeledStatement = 209,
ThrowStatement = 210,
TryStatement = 211,
DebuggerStatement = 212,
VariableDeclaration = 213,
VariableDeclarationList = 214,
FunctionDeclaration = 215,
ClassDeclaration = 216,
InterfaceDeclaration = 217,
TypeAliasDeclaration = 218,
EnumDeclaration = 219,
ModuleDeclaration = 220,
ModuleBlock = 221,
CaseBlock = 222,
ImportEqualsDeclaration = 223,
ImportDeclaration = 224,
ImportClause = 225,
NamespaceImport = 226,
NamedImports = 227,
ImportSpecifier = 228,
ExportAssignment = 229,
ExportDeclaration = 230,
NamedExports = 231,
ExportSpecifier = 232,
MissingDeclaration = 233,
ExternalModuleReference = 234,
JsxElement = 235,
JsxSelfClosingElement = 236,
JsxOpeningElement = 237,
JsxText = 238,
JsxClosingElement = 239,
JsxAttribute = 240,
JsxSpreadAttribute = 241,
JsxExpression = 242,
CaseClause = 243,
DefaultClause = 244,
HeritageClause = 245,
CatchClause = 246,
PropertyAssignment = 247,
ShorthandPropertyAssignment = 248,
EnumMember = 249,
SourceFile = 250,
JSDocTypeExpression = 251,
JSDocAllType = 252,
JSDocUnknownType = 253,
JSDocArrayType = 254,
JSDocUnionType = 255,
JSDocTupleType = 256,
JSDocNullableType = 257,
JSDocNonNullableType = 258,
JSDocRecordType = 259,
JSDocRecordMember = 260,
JSDocTypeReference = 261,
JSDocOptionalType = 262,
JSDocFunctionType = 263,
JSDocVariadicType = 264,
JSDocConstructorType = 265,
JSDocThisType = 266,
JSDocComment = 267,
JSDocTag = 268,
JSDocParameterTag = 269,
JSDocReturnTag = 270,
JSDocTypeTag = 271,
JSDocTemplateTag = 272,
SyntaxList = 273,
Count = 274,
GlobalKeyword = 134,
OfKeyword = 135,
QualifiedName = 136,
ComputedPropertyName = 137,
TypeParameter = 138,
Parameter = 139,
Decorator = 140,
PropertySignature = 141,
PropertyDeclaration = 142,
MethodSignature = 143,
MethodDeclaration = 144,
Constructor = 145,
GetAccessor = 146,
SetAccessor = 147,
CallSignature = 148,
ConstructSignature = 149,
IndexSignature = 150,
TypePredicate = 151,
TypeReference = 152,
FunctionType = 153,
ConstructorType = 154,
TypeQuery = 155,
TypeLiteral = 156,
ArrayType = 157,
TupleType = 158,
UnionType = 159,
IntersectionType = 160,
ParenthesizedType = 161,
ThisType = 162,
StringLiteralType = 163,
ObjectBindingPattern = 164,
ArrayBindingPattern = 165,
BindingElement = 166,
ArrayLiteralExpression = 167,
ObjectLiteralExpression = 168,
PropertyAccessExpression = 169,
ElementAccessExpression = 170,
CallExpression = 171,
NewExpression = 172,
TaggedTemplateExpression = 173,
TypeAssertionExpression = 174,
ParenthesizedExpression = 175,
FunctionExpression = 176,
ArrowFunction = 177,
DeleteExpression = 178,
TypeOfExpression = 179,
VoidExpression = 180,
AwaitExpression = 181,
PrefixUnaryExpression = 182,
PostfixUnaryExpression = 183,
BinaryExpression = 184,
ConditionalExpression = 185,
TemplateExpression = 186,
YieldExpression = 187,
SpreadElementExpression = 188,
ClassExpression = 189,
OmittedExpression = 190,
ExpressionWithTypeArguments = 191,
AsExpression = 192,
TemplateSpan = 193,
SemicolonClassElement = 194,
Block = 195,
VariableStatement = 196,
EmptyStatement = 197,
ExpressionStatement = 198,
IfStatement = 199,
DoStatement = 200,
WhileStatement = 201,
ForStatement = 202,
ForInStatement = 203,
ForOfStatement = 204,
ContinueStatement = 205,
BreakStatement = 206,
ReturnStatement = 207,
WithStatement = 208,
SwitchStatement = 209,
LabeledStatement = 210,
ThrowStatement = 211,
TryStatement = 212,
DebuggerStatement = 213,
VariableDeclaration = 214,
VariableDeclarationList = 215,
FunctionDeclaration = 216,
ClassDeclaration = 217,
InterfaceDeclaration = 218,
TypeAliasDeclaration = 219,
EnumDeclaration = 220,
ModuleDeclaration = 221,
ModuleBlock = 222,
CaseBlock = 223,
ImportEqualsDeclaration = 224,
ImportDeclaration = 225,
ImportClause = 226,
NamespaceImport = 227,
NamedImports = 228,
ImportSpecifier = 229,
ExportAssignment = 230,
ExportDeclaration = 231,
NamedExports = 232,
ExportSpecifier = 233,
MissingDeclaration = 234,
ExternalModuleReference = 235,
JsxElement = 236,
JsxSelfClosingElement = 237,
JsxOpeningElement = 238,
JsxText = 239,
JsxClosingElement = 240,
JsxAttribute = 241,
JsxSpreadAttribute = 242,
JsxExpression = 243,
CaseClause = 244,
DefaultClause = 245,
HeritageClause = 246,
CatchClause = 247,
PropertyAssignment = 248,
ShorthandPropertyAssignment = 249,
EnumMember = 250,
SourceFile = 251,
JSDocTypeExpression = 252,
JSDocAllType = 253,
JSDocUnknownType = 254,
JSDocArrayType = 255,
JSDocUnionType = 256,
JSDocTupleType = 257,
JSDocNullableType = 258,
JSDocNonNullableType = 259,
JSDocRecordType = 260,
JSDocRecordMember = 261,
JSDocTypeReference = 262,
JSDocOptionalType = 263,
JSDocFunctionType = 264,
JSDocVariadicType = 265,
JSDocConstructorType = 266,
JSDocThisType = 267,
JSDocComment = 268,
JSDocTag = 269,
JSDocParameterTag = 270,
JSDocReturnTag = 271,
JSDocTypeTag = 272,
JSDocTemplateTag = 273,
SyntaxList = 274,
Count = 275,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
LastReservedWord = 105,
FirstKeyword = 70,
LastKeyword = 134,
LastKeyword = 135,
FirstFutureReservedWord = 106,
LastFutureReservedWord = 114,
FirstTypeNode = 150,
LastTypeNode = 162,
FirstTypeNode = 151,
LastTypeNode = 163,
FirstPunctuation = 15,
LastPunctuation = 68,
FirstToken = 0,
LastToken = 134,
LastToken = 135,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -330,7 +331,7 @@ declare namespace ts {
LastTemplateToken = 14,
FirstBinaryOperator = 25,
LastBinaryOperator = 68,
FirstNode = 135,
FirstNode = 136,
}
enum NodeFlags {
None = 0,
@@ -354,10 +355,16 @@ declare namespace ts {
ContainsThis = 262144,
HasImplicitReturn = 524288,
HasExplicitReturn = 1048576,
GlobalAugmentation = 2097152,
HasClassExtends = 4194304,
HasDecorators = 8388608,
HasParamDecorators = 16777216,
HasAsyncFunctions = 33554432,
Modifier = 1022,
AccessibilityModifier = 56,
BlockScoped = 24576,
ReachabilityCheckFlags = 1572864,
EmitHelperFlags = 62914560,
}
enum JsxFlags {
None = 0,
@@ -1141,6 +1148,7 @@ declare namespace ts {
getSymbolAtLocation(node: Node): Symbol;
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
getShorthandAssignmentValueSymbol(location: Node): Symbol;
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
getTypeAtLocation(node: Node): Type;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
@@ -1154,6 +1162,7 @@ declare namespace ts {
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
isUndefinedSymbol(symbol: Symbol): boolean;
isArgumentsSymbol(symbol: Symbol): boolean;
isUnknownSymbol(symbol: Symbol): boolean;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
getAliasedSymbol(symbol: Symbol): Symbol;
@@ -1543,6 +1552,8 @@ declare namespace ts {
}
}
declare namespace ts {
type FileWatcherCallback = (path: string, removed?: boolean) => void;
type DirectoryWatcherCallback = (path: string) => void;
interface System {
args: string[];
newLine: string;
@@ -1550,8 +1561,8 @@ declare namespace ts {
write(s: string): void;
readFile(path: string, encoding?: string): string;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
@@ -1565,6 +1576,10 @@ declare namespace ts {
interface FileWatcher {
close(): void;
}
interface DirectoryWatcher extends FileWatcher {
directoryPath: Path;
referenceCount: number;
}
var sys: System;
}
declare namespace ts {
@@ -2237,6 +2252,9 @@ declare namespace ts {
static jsxOpenTagName: string;
static jsxCloseTagName: string;
static jsxSelfClosingTagName: string;
static jsxAttribute: string;
static jsxText: string;
static jsxAttributeStringLiteralValue: string;
}
enum ClassificationType {
comment = 1,
@@ -2260,6 +2278,9 @@ declare namespace ts {
jsxOpenTagName = 19,
jsxCloseTagName = 20,
jsxSelfClosingTagName = 21,
jsxAttribute = 22,
jsxText = 23,
jsxAttributeStringLiteralValue = 24,
}
interface DisplayPartsSymbolWriter extends SymbolWriter {
displayParts(): SymbolDisplayPart[];
@@ -2283,7 +2304,6 @@ declare namespace ts {
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
+4697 -3925
View File
File diff suppressed because it is too large. Load diff
+169 -149
View File
@@ -167,161 +167,162 @@ declare namespace ts {
SymbolKeyword = 131,
TypeKeyword = 132,
FromKeyword = 133,
OfKeyword = 134,
QualifiedName = 135,
ComputedPropertyName = 136,
TypeParameter = 137,
Parameter = 138,
Decorator = 139,
PropertySignature = 140,
PropertyDeclaration = 141,
MethodSignature = 142,
MethodDeclaration = 143,
Constructor = 144,
GetAccessor = 145,
SetAccessor = 146,
CallSignature = 147,
ConstructSignature = 148,
IndexSignature = 149,
TypePredicate = 150,
TypeReference = 151,
FunctionType = 152,
ConstructorType = 153,
TypeQuery = 154,
TypeLiteral = 155,
ArrayType = 156,
TupleType = 157,
UnionType = 158,
IntersectionType = 159,
ParenthesizedType = 160,
ThisType = 161,
StringLiteralType = 162,
ObjectBindingPattern = 163,
ArrayBindingPattern = 164,
BindingElement = 165,
ArrayLiteralExpression = 166,
ObjectLiteralExpression = 167,
PropertyAccessExpression = 168,
ElementAccessExpression = 169,
CallExpression = 170,
NewExpression = 171,
TaggedTemplateExpression = 172,
TypeAssertionExpression = 173,
ParenthesizedExpression = 174,
FunctionExpression = 175,
ArrowFunction = 176,
DeleteExpression = 177,
TypeOfExpression = 178,
VoidExpression = 179,
AwaitExpression = 180,
PrefixUnaryExpression = 181,
PostfixUnaryExpression = 182,
BinaryExpression = 183,
ConditionalExpression = 184,
TemplateExpression = 185,
YieldExpression = 186,
SpreadElementExpression = 187,
ClassExpression = 188,
OmittedExpression = 189,
ExpressionWithTypeArguments = 190,
AsExpression = 191,
TemplateSpan = 192,
SemicolonClassElement = 193,
Block = 194,
VariableStatement = 195,
EmptyStatement = 196,
ExpressionStatement = 197,
IfStatement = 198,
DoStatement = 199,
WhileStatement = 200,
ForStatement = 201,
ForInStatement = 202,
ForOfStatement = 203,
ContinueStatement = 204,
BreakStatement = 205,
ReturnStatement = 206,
WithStatement = 207,
SwitchStatement = 208,
LabeledStatement = 209,
ThrowStatement = 210,
TryStatement = 211,
DebuggerStatement = 212,
VariableDeclaration = 213,
VariableDeclarationList = 214,
FunctionDeclaration = 215,
ClassDeclaration = 216,
InterfaceDeclaration = 217,
TypeAliasDeclaration = 218,
EnumDeclaration = 219,
ModuleDeclaration = 220,
ModuleBlock = 221,
CaseBlock = 222,
ImportEqualsDeclaration = 223,
ImportDeclaration = 224,
ImportClause = 225,
NamespaceImport = 226,
NamedImports = 227,
ImportSpecifier = 228,
ExportAssignment = 229,
ExportDeclaration = 230,
NamedExports = 231,
ExportSpecifier = 232,
MissingDeclaration = 233,
ExternalModuleReference = 234,
JsxElement = 235,
JsxSelfClosingElement = 236,
JsxOpeningElement = 237,
JsxText = 238,
JsxClosingElement = 239,
JsxAttribute = 240,
JsxSpreadAttribute = 241,
JsxExpression = 242,
CaseClause = 243,
DefaultClause = 244,
HeritageClause = 245,
CatchClause = 246,
PropertyAssignment = 247,
ShorthandPropertyAssignment = 248,
EnumMember = 249,
SourceFile = 250,
JSDocTypeExpression = 251,
JSDocAllType = 252,
JSDocUnknownType = 253,
JSDocArrayType = 254,
JSDocUnionType = 255,
JSDocTupleType = 256,
JSDocNullableType = 257,
JSDocNonNullableType = 258,
JSDocRecordType = 259,
JSDocRecordMember = 260,
JSDocTypeReference = 261,
JSDocOptionalType = 262,
JSDocFunctionType = 263,
JSDocVariadicType = 264,
JSDocConstructorType = 265,
JSDocThisType = 266,
JSDocComment = 267,
JSDocTag = 268,
JSDocParameterTag = 269,
JSDocReturnTag = 270,
JSDocTypeTag = 271,
JSDocTemplateTag = 272,
SyntaxList = 273,
Count = 274,
GlobalKeyword = 134,
OfKeyword = 135,
QualifiedName = 136,
ComputedPropertyName = 137,
TypeParameter = 138,
Parameter = 139,
Decorator = 140,
PropertySignature = 141,
PropertyDeclaration = 142,
MethodSignature = 143,
MethodDeclaration = 144,
Constructor = 145,
GetAccessor = 146,
SetAccessor = 147,
CallSignature = 148,
ConstructSignature = 149,
IndexSignature = 150,
TypePredicate = 151,
TypeReference = 152,
FunctionType = 153,
ConstructorType = 154,
TypeQuery = 155,
TypeLiteral = 156,
ArrayType = 157,
TupleType = 158,
UnionType = 159,
IntersectionType = 160,
ParenthesizedType = 161,
ThisType = 162,
StringLiteralType = 163,
ObjectBindingPattern = 164,
ArrayBindingPattern = 165,
BindingElement = 166,
ArrayLiteralExpression = 167,
ObjectLiteralExpression = 168,
PropertyAccessExpression = 169,
ElementAccessExpression = 170,
CallExpression = 171,
NewExpression = 172,
TaggedTemplateExpression = 173,
TypeAssertionExpression = 174,
ParenthesizedExpression = 175,
FunctionExpression = 176,
ArrowFunction = 177,
DeleteExpression = 178,
TypeOfExpression = 179,
VoidExpression = 180,
AwaitExpression = 181,
PrefixUnaryExpression = 182,
PostfixUnaryExpression = 183,
BinaryExpression = 184,
ConditionalExpression = 185,
TemplateExpression = 186,
YieldExpression = 187,
SpreadElementExpression = 188,
ClassExpression = 189,
OmittedExpression = 190,
ExpressionWithTypeArguments = 191,
AsExpression = 192,
TemplateSpan = 193,
SemicolonClassElement = 194,
Block = 195,
VariableStatement = 196,
EmptyStatement = 197,
ExpressionStatement = 198,
IfStatement = 199,
DoStatement = 200,
WhileStatement = 201,
ForStatement = 202,
ForInStatement = 203,
ForOfStatement = 204,
ContinueStatement = 205,
BreakStatement = 206,
ReturnStatement = 207,
WithStatement = 208,
SwitchStatement = 209,
LabeledStatement = 210,
ThrowStatement = 211,
TryStatement = 212,
DebuggerStatement = 213,
VariableDeclaration = 214,
VariableDeclarationList = 215,
FunctionDeclaration = 216,
ClassDeclaration = 217,
InterfaceDeclaration = 218,
TypeAliasDeclaration = 219,
EnumDeclaration = 220,
ModuleDeclaration = 221,
ModuleBlock = 222,
CaseBlock = 223,
ImportEqualsDeclaration = 224,
ImportDeclaration = 225,
ImportClause = 226,
NamespaceImport = 227,
NamedImports = 228,
ImportSpecifier = 229,
ExportAssignment = 230,
ExportDeclaration = 231,
NamedExports = 232,
ExportSpecifier = 233,
MissingDeclaration = 234,
ExternalModuleReference = 235,
JsxElement = 236,
JsxSelfClosingElement = 237,
JsxOpeningElement = 238,
JsxText = 239,
JsxClosingElement = 240,
JsxAttribute = 241,
JsxSpreadAttribute = 242,
JsxExpression = 243,
CaseClause = 244,
DefaultClause = 245,
HeritageClause = 246,
CatchClause = 247,
PropertyAssignment = 248,
ShorthandPropertyAssignment = 249,
EnumMember = 250,
SourceFile = 251,
JSDocTypeExpression = 252,
JSDocAllType = 253,
JSDocUnknownType = 254,
JSDocArrayType = 255,
JSDocUnionType = 256,
JSDocTupleType = 257,
JSDocNullableType = 258,
JSDocNonNullableType = 259,
JSDocRecordType = 260,
JSDocRecordMember = 261,
JSDocTypeReference = 262,
JSDocOptionalType = 263,
JSDocFunctionType = 264,
JSDocVariadicType = 265,
JSDocConstructorType = 266,
JSDocThisType = 267,
JSDocComment = 268,
JSDocTag = 269,
JSDocParameterTag = 270,
JSDocReturnTag = 271,
JSDocTypeTag = 272,
JSDocTemplateTag = 273,
SyntaxList = 274,
Count = 275,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
LastReservedWord = 105,
FirstKeyword = 70,
LastKeyword = 134,
LastKeyword = 135,
FirstFutureReservedWord = 106,
LastFutureReservedWord = 114,
FirstTypeNode = 150,
LastTypeNode = 162,
FirstTypeNode = 151,
LastTypeNode = 163,
FirstPunctuation = 15,
LastPunctuation = 68,
FirstToken = 0,
LastToken = 134,
LastToken = 135,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -330,7 +331,7 @@ declare namespace ts {
LastTemplateToken = 14,
FirstBinaryOperator = 25,
LastBinaryOperator = 68,
FirstNode = 135,
FirstNode = 136,
}
enum NodeFlags {
None = 0,
@@ -354,10 +355,16 @@ declare namespace ts {
ContainsThis = 262144,
HasImplicitReturn = 524288,
HasExplicitReturn = 1048576,
GlobalAugmentation = 2097152,
HasClassExtends = 4194304,
HasDecorators = 8388608,
HasParamDecorators = 16777216,
HasAsyncFunctions = 33554432,
Modifier = 1022,
AccessibilityModifier = 56,
BlockScoped = 24576,
ReachabilityCheckFlags = 1572864,
EmitHelperFlags = 62914560,
}
enum JsxFlags {
None = 0,
@@ -1141,6 +1148,7 @@ declare namespace ts {
getSymbolAtLocation(node: Node): Symbol;
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
getShorthandAssignmentValueSymbol(location: Node): Symbol;
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
getTypeAtLocation(node: Node): Type;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
@@ -1154,6 +1162,7 @@ declare namespace ts {
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
isUndefinedSymbol(symbol: Symbol): boolean;
isArgumentsSymbol(symbol: Symbol): boolean;
isUnknownSymbol(symbol: Symbol): boolean;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
getAliasedSymbol(symbol: Symbol): Symbol;
@@ -1543,6 +1552,8 @@ declare namespace ts {
}
}
declare namespace ts {
type FileWatcherCallback = (path: string, removed?: boolean) => void;
type DirectoryWatcherCallback = (path: string) => void;
interface System {
args: string[];
newLine: string;
@@ -1550,8 +1561,8 @@ declare namespace ts {
write(s: string): void;
readFile(path: string, encoding?: string): string;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
@@ -1565,6 +1576,10 @@ declare namespace ts {
interface FileWatcher {
close(): void;
}
interface DirectoryWatcher extends FileWatcher {
directoryPath: Path;
referenceCount: number;
}
var sys: System;
}
declare namespace ts {
@@ -2237,6 +2252,9 @@ declare namespace ts {
static jsxOpenTagName: string;
static jsxCloseTagName: string;
static jsxSelfClosingTagName: string;
static jsxAttribute: string;
static jsxText: string;
static jsxAttributeStringLiteralValue: string;
}
enum ClassificationType {
comment = 1,
@@ -2260,6 +2278,9 @@ declare namespace ts {
jsxOpenTagName = 19,
jsxCloseTagName = 20,
jsxSelfClosingTagName = 21,
jsxAttribute = 22,
jsxText = 23,
jsxAttributeStringLiteralValue = 24,
}
interface DisplayPartsSymbolWriter extends SymbolWriter {
displayParts(): SymbolDisplayPart[];
@@ -2283,7 +2304,6 @@ declare namespace ts {
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
+4697 -3925
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -36,7 +36,7 @@
"istanbul": "latest",
"mocha-fivemat-progress-reporter": "latest",
"tslint": "next",
"typescript": "1.8.0-dev.20160113",
"typescript": "next",
"tsd": "latest"
},
"scripts": {
+91 -9
View File
@@ -117,6 +117,12 @@ namespace ts {
let labelIndexMap: Map<number>;
let implicitLabels: number[];
// state used for emit helpers
let hasClassExtends: boolean;
let hasAsyncFunctions: boolean;
let hasDecorators: boolean;
let hasParameterDecorators: boolean;
// If this file is an external module, then it is automatically in strict-mode according to
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
// not depending on if we see "use strict" in certain places (or if we hit a class/namespace).
@@ -131,6 +137,7 @@ namespace ts {
options = opts;
inStrictMode = !!file.externalModuleIndicator;
classifiableNames = {};
Symbol = objectAllocator.getSymbolConstructor();
if (!file.locals) {
@@ -150,6 +157,10 @@ namespace ts {
labelStack = undefined;
labelIndexMap = undefined;
implicitLabels = undefined;
hasClassExtends = false;
hasAsyncFunctions = false;
hasDecorators = false;
hasParameterDecorators = false;
}
return bindSourceFile;
@@ -191,8 +202,8 @@ namespace ts {
// unless it is a well known Symbol.
function getDeclarationName(node: Declaration): string {
if (node.name) {
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
return `"${(<LiteralExpression>node.name).text}"`;
if (isAmbientModule(node)) {
return isGlobalScopeAugmentation(<ModuleDeclaration>node) ? "__global" : `"${(<LiteralExpression>node.name).text}"`;
}
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
const nameExpression = (<ComputedPropertyName>node.name).expression;
@@ -348,7 +359,12 @@ namespace ts {
// 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
if (hasExportModifier || container.flags & NodeFlags.ExportContext) {
// NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
// and this case is specially handled. Module augmentations should only be merged with original module definition
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
if (!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) {
const exportKind =
(symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
(symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
@@ -423,6 +439,9 @@ namespace ts {
// reset all reachability check related flags on node (for incremental scenarios)
flags &= ~NodeFlags.ReachabilityCheckFlags;
// reset all emit helper flags on node (for incremental scenarios)
flags &= ~NodeFlags.EmitHelperFlags;
if (kind === SyntaxKind.InterfaceDeclaration) {
seenThisKeyword = false;
}
@@ -453,6 +472,21 @@ namespace ts {
flags = seenThisKeyword ? flags | NodeFlags.ContainsThis : flags & ~NodeFlags.ContainsThis;
}
if (kind === SyntaxKind.SourceFile) {
if (hasClassExtends) {
flags |= NodeFlags.HasClassExtends;
}
if (hasDecorators) {
flags |= NodeFlags.HasDecorators;
}
if (hasParameterDecorators) {
flags |= NodeFlags.HasParamDecorators;
}
if (hasAsyncFunctions) {
flags |= NodeFlags.HasAsyncFunctions;
}
}
node.flags = flags;
if (saveState) {
@@ -843,7 +877,10 @@ namespace ts {
function bindModuleDeclaration(node: ModuleDeclaration) {
setExportContextFlag(node);
if (node.name.kind === SyntaxKind.StringLiteral) {
if (isAmbientModule(node)) {
if (node.flags & NodeFlags.Export) {
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
}
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
}
else {
@@ -1246,8 +1283,7 @@ namespace ts {
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None),
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes);
case SyntaxKind.FunctionDeclaration:
checkStrictModeFunctionName(<FunctionDeclaration>node);
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
return bindFunctionDeclaration(<FunctionDeclaration>node);
case SyntaxKind.Constructor:
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ SymbolFlags.None);
case SyntaxKind.GetAccessor:
@@ -1263,9 +1299,7 @@ namespace ts {
return bindObjectLiteralExpression(<ObjectLiteralExpression>node);
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
checkStrictModeFunctionName(<FunctionExpression>node);
const bindingName = (<FunctionExpression>node).name ? (<FunctionExpression>node).name.text : "__function";
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
return bindFunctionExpression(<FunctionExpression>node);
case SyntaxKind.CallExpression:
if (isInJavaScriptFile(node)) {
@@ -1415,6 +1449,15 @@ namespace ts {
}
function bindClassLikeDeclaration(node: ClassLikeDeclaration) {
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
if (getClassExtendsHeritageClauseElement(node) !== undefined) {
hasClassExtends = true;
}
if (nodeIsDecorated(node)) {
hasDecorators = true;
}
}
if (node.kind === SyntaxKind.ClassDeclaration) {
bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
}
@@ -1484,6 +1527,13 @@ namespace ts {
}
function bindParameter(node: ParameterDeclaration) {
if (!isDeclarationFile(file) &&
!isInAmbientContext(node) &&
nodeIsDecorated(node)) {
hasDecorators = true;
hasParameterDecorators = true;
}
if (inStrictMode) {
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
@@ -1505,7 +1555,39 @@ namespace ts {
}
}
function bindFunctionDeclaration(node: FunctionDeclaration) {
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
if (isAsyncFunctionLike(node)) {
hasAsyncFunctions = true;
}
}
checkStrictModeFunctionName(<FunctionDeclaration>node);
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
}
function bindFunctionExpression(node: FunctionExpression) {
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
if (isAsyncFunctionLike(node)) {
hasAsyncFunctions = true;
}
}
checkStrictModeFunctionName(<FunctionExpression>node);
const bindingName = (<FunctionExpression>node).name ? (<FunctionExpression>node).name.text : "__function";
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
}
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
if (isAsyncFunctionLike(node)) {
hasAsyncFunctions = true;
}
if (nodeIsDecorated(node)) {
hasDecorators = true;
}
}
return hasDynamicName(node)
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
+257 -200
View File
@@ -174,11 +174,6 @@ namespace ts {
const unionTypes: Map<UnionType> = {};
const intersectionTypes: Map<IntersectionType> = {};
const stringLiteralTypes: Map<StringLiteralType> = {};
let emitExtends = false;
let emitDecorate = false;
let emitParam = false;
let emitAwaiter = false;
const emitGenerator = false;
const resolutionTargets: TypeSystemEntity[] = [];
const resolutionResults: boolean[] = [];
@@ -377,6 +372,32 @@ namespace ts {
}
}
function mergeModuleAugmentation(moduleName: LiteralExpression): void {
const moduleAugmentation = <ModuleDeclaration>moduleName.parent;
if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) {
// this is a combined symbol for multiple augmentations within the same file.
// its symbol already has accumulated information for all declarations
// so we need to add it just once - do the work only for first declaration
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
return;
}
if (isGlobalScopeAugmentation(moduleAugmentation)) {
mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
}
else {
// find a module that about to be augmented
let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found);
if (!mainModule) {
return;
}
// if module symbol has already been merged - it is safe to use it.
// otherwise clone it
mainModule = mainModule.flags & SymbolFlags.Merged ? mainModule : cloneSymbol(mainModule);
mergeSymbol(mainModule, moduleAugmentation.symbol);
}
}
function addToSymbolTable(target: SymbolTable, source: SymbolTable, message: DiagnosticMessage) {
for (const id in source) {
if (hasProperty(source, id)) {
@@ -406,22 +427,10 @@ namespace ts {
return nodeLinks[nodeId] || (nodeLinks[nodeId] = {});
}
function getSourceFile(node: Node): SourceFile {
return <SourceFile>getAncestor(node, SyntaxKind.SourceFile);
}
function isGlobalSourceFile(node: Node) {
return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(<SourceFile>node);
}
/** Is this type one of the apparent types created from the primitive types. */
function isPrimitiveApparentType(type: Type): boolean {
return type === globalStringType ||
type === globalNumberType ||
type === globalBooleanType ||
type === globalESSymbolType;
}
function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol {
if (meaning && hasProperty(symbols, name)) {
const symbol = symbols[name];
@@ -444,7 +453,7 @@ namespace ts {
* Get symbols that represent parameter-property-declaration as parameter and as property declaration
* @param parameter a parameterDeclaration node
* @param parameterName a name of the parameter to get the symbols for.
* @return a tuple of two symbols
* @return a tuple of two symbols
*/
function getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): [Symbol, Symbol] {
const constructoDeclaration = parameter.parent;
@@ -584,8 +593,7 @@ namespace ts {
if (!isExternalOrCommonJsModule(<SourceFile>location)) break;
case SyntaxKind.ModuleDeclaration:
const moduleExports = getSymbolOfNode(location).exports;
if (location.kind === SyntaxKind.SourceFile ||
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
if (location.kind === SyntaxKind.SourceFile || isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
@@ -1118,6 +1126,10 @@ namespace ts {
}
function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol {
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, Diagnostics.Cannot_find_module_0);
}
function resolveExternalModuleNameWorker(location: Node, moduleReferenceExpression: Expression, moduleNotFoundError: DiagnosticMessage): Symbol {
if (moduleReferenceExpression.kind !== SyntaxKind.StringLiteral) {
return;
}
@@ -1136,20 +1148,29 @@ namespace ts {
if (!isRelative) {
const symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule);
if (symbol) {
return symbol;
// merged symbol is module declaration symbol combined with all augmentations
return getMergedSymbol(symbol);
}
}
const resolvedModule = getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
const resolvedModule = getResolvedModule(getSourceFileOfNode(location), moduleReferenceLiteral.text);
const sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
if (sourceFile) {
if (sourceFile.symbol) {
return sourceFile.symbol;
// merged symbol is module declaration symbol combined with all augmentations
return getMergedSymbol(sourceFile.symbol);
}
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
return;
if (moduleNotFoundError) {
// report errors only if it was requested
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
}
return undefined;
}
error(moduleReferenceLiteral, Diagnostics.Cannot_find_module_0, moduleName);
if (moduleNotFoundError) {
// report errors only if it was requested
error(moduleReferenceLiteral, moduleNotFoundError, moduleName);
}
return undefined;
}
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
@@ -1566,8 +1587,7 @@ namespace ts {
}
function hasExternalModuleSymbol(declaration: Node) {
return (declaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>declaration).name.kind === SyntaxKind.StringLiteral) ||
(declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(<SourceFile>declaration));
return isAmbientModule(declaration) || (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(<SourceFile>declaration));
}
function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult {
@@ -1691,6 +1711,12 @@ namespace ts {
return undefined;
}
function isTopLevelInExternalModuleAugmentation(node: Node): boolean {
return node && node.parent &&
node.parent.kind === SyntaxKind.ModuleBlock &&
isExternalModuleAugmentation(node.parent.parent);
}
function getSymbolDisplayBuilder(): SymbolDisplayBuilder {
function getNameOfSymbol(symbol: Symbol): string {
@@ -2273,6 +2299,10 @@ namespace ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
// external module augmentation is always visible
if (isExternalModuleAugmentation(node)) {
return true;
}
const parent = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(getCombinedNodeFlags(node) & NodeFlags.Export) &&
@@ -2365,7 +2395,9 @@ namespace ts {
const firstIdentifier = getFirstIdentifier(internalModuleReference);
const importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace,
Diagnostics.Cannot_find_name_0, firstIdentifier);
buildVisibleNodeList(importSymbol.declarations);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
}
});
}
@@ -2450,7 +2482,7 @@ namespace ts {
// Every class automatically contains a static property member named 'prototype',
// the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter.
// It is an error to explicitly declare a static property member with the name 'prototype'.
const classType = <InterfaceType>getDeclaredTypeOfSymbol(prototype.parent);
const classType = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(prototype.parent));
return classType.typeParameters ? createTypeReference(<GenericType>classType, map(classType.typeParameters, _ => anyType)) : classType;
}
@@ -4944,6 +4976,10 @@ namespace ts {
return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined) ? Ternary.True : Ternary.False;
}
function compareTypesAssignable(source: Type, target: Type): Ternary {
return checkTypeRelatedTo(source, target, assignableRelation, /*errorNode*/ undefined) ? Ternary.True : Ternary.False;
}
function isTypeSubtypeOf(source: Type, target: Type): boolean {
return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined);
}
@@ -4960,16 +4996,27 @@ namespace ts {
return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain);
}
function isSignatureAssignableTo(source: Signature,
target: Signature,
ignoreReturnTypes: boolean): boolean {
return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False;
}
/**
* See signatureRelatedTo, compareSignaturesIdentical
*/
function isSignatureAssignableTo(source: Signature, target: Signature, ignoreReturnTypes: boolean): boolean {
function compareSignaturesRelated(source: Signature,
target: Signature,
ignoreReturnTypes: boolean,
reportErrors: boolean,
errorReporter: (d: DiagnosticMessage, arg0?: string, arg1?: string) => void,
compareTypes: (s: Type, t: Type, reportErrors?: boolean) => Ternary): Ternary {
// TODO (drosen): De-duplicate code between related functions.
if (source === target) {
return true;
return Ternary.True;
}
if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) {
return false;
return Ternary.False;
}
// Spec 1.0 Section 3.8.3 & 3.8.4:
@@ -4977,36 +5024,49 @@ namespace ts {
source = getErasedSignature(source);
target = getErasedSignature(target);
let result = Ternary.True;
const sourceMax = getNumNonRestParameters(source);
const targetMax = getNumNonRestParameters(target);
const checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax);
const sourceParams = source.parameters;
const targetParams = target.parameters;
for (let i = 0; i < checkCount; i++) {
const s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
const t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
const related = isTypeAssignableTo(t, s) || isTypeAssignableTo(s, t);
const s = i < sourceMax ? getTypeOfSymbol(sourceParams[i]) : getRestTypeOfSignature(source);
const t = i < targetMax ? getTypeOfSymbol(targetParams[i]) : getRestTypeOfSignature(target);
const related = compareTypes(t, s, /*reportErrors*/ false) || compareTypes(s, t, reportErrors);
if (!related) {
return false;
if (reportErrors) {
errorReporter(Diagnostics.Types_of_parameters_0_and_1_are_incompatible,
sourceParams[i < sourceMax ? i : sourceMax].name,
targetParams[i < targetMax ? i : targetMax].name);
}
return Ternary.False;
}
result &= related;
}
if (!ignoreReturnTypes) {
const targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return true;
return result;
}
const sourceReturnType = getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
if (targetReturnType.flags & TypeFlags.PredicateType && (targetReturnType as PredicateType).predicate.kind === TypePredicateKind.Identifier) {
if (!(sourceReturnType.flags & TypeFlags.PredicateType)) {
return false;
if (reportErrors) {
errorReporter(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
}
return Ternary.False;
}
}
return isTypeAssignableTo(sourceReturnType, targetReturnType);
result &= compareTypes(sourceReturnType, targetReturnType, reportErrors);
}
return true;
return result;
}
function isImplementationCompatibleWithOverload(implementation: Signature, overload: Signature): boolean {
@@ -5077,24 +5137,14 @@ namespace ts {
let expandingFlags: number;
let depth = 0;
let overflow = false;
let elaborateErrors = false;
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
const result = isRelatedTo(source, target, errorNode !== undefined, headMessage);
const result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (overflow) {
error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
}
else if (errorInfo) {
// If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution),
// then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened,
// request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context
// where errors were being reported.
if (errorInfo.next === undefined) {
errorInfo = undefined;
elaborateErrors = true;
isRelatedTo(source, target, errorNode !== undefined, headMessage);
}
if (containingMessageChain) {
errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo);
}
@@ -5104,6 +5154,7 @@ namespace ts {
return result !== Ternary.False;
function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string, arg2?: string): void {
Debug.assert(!!errorNode);
errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2);
}
@@ -5241,14 +5292,14 @@ namespace ts {
}
// Even if relationship doesn't hold for unions, intersections, or generic type references,
// it may hold in a structural comparison.
const apparentType = getApparentType(source);
const apparentSource = getApparentType(source);
// In a check of the form X = A & B, we will have previously checked if A relates to X or B relates
// to X. Failing both of those we want to check if the aggregation of A and B's members structurally
// relates to X. Thus, we include intersection types on the source side here.
if (apparentType.flags & (TypeFlags.ObjectType | TypeFlags.Intersection) && target.flags & TypeFlags.ObjectType) {
if (apparentSource.flags & (TypeFlags.ObjectType | TypeFlags.Intersection) && target.flags & TypeFlags.ObjectType) {
// Report structural errors only if we haven't reported any errors yet
const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo;
if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) {
const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & TypeFlags.Primitive);
if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
errorInfo = saveErrorInfo;
return result;
}
@@ -5313,6 +5364,7 @@ namespace ts {
// We know *exactly* where things went wrong when comparing the types.
// Use this property as the error node as this will be more helpful in
// reasoning about what went wrong.
Debug.assert(!!errorNode);
errorNode = prop.valueDeclaration;
reportError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
symbolToString(prop), typeToString(target));
@@ -5415,7 +5467,7 @@ namespace ts {
const id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
const related = relation[id];
if (related !== undefined) {
if (elaborateErrors && related === RelationComparisonResult.Failed) {
if (reportErrors && related === RelationComparisonResult.Failed) {
// We are elaborating errors and the cached result is an unreported failure. Record the result as a reported
// failure and continue computing the relation such that errors get reported.
relation[id] = RelationComparisonResult.FailedAndReported;
@@ -5635,7 +5687,7 @@ namespace ts {
}
// don't elaborate the primitive apparent types (like Number)
// because the actual primitives will have already been reported.
if (shouldElaborateErrors && !isPrimitiveApparentType(source)) {
if (shouldElaborateErrors) {
reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1,
typeToString(source),
signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind));
@@ -5647,77 +5699,10 @@ namespace ts {
}
/**
* See signatureAssignableTo, signatureAssignableTo
* See signatureAssignableTo, compareSignaturesIdentical
*/
function signatureRelatedTo(source: Signature, target: Signature, reportErrors: boolean): Ternary {
// TODO (drosen): De-duplicate code between related functions.
if (source === target) {
return Ternary.True;
}
if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) {
return Ternary.False;
}
let sourceMax = source.parameters.length;
let targetMax = target.parameters.length;
let checkCount: number;
if (source.hasRestParameter && target.hasRestParameter) {
checkCount = sourceMax > targetMax ? sourceMax : targetMax;
sourceMax--;
targetMax--;
}
else if (source.hasRestParameter) {
sourceMax--;
checkCount = targetMax;
}
else if (target.hasRestParameter) {
targetMax--;
checkCount = sourceMax;
}
else {
checkCount = sourceMax < targetMax ? sourceMax : targetMax;
}
// Spec 1.0 Section 3.8.3 & 3.8.4:
// M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
source = getErasedSignature(source);
target = getErasedSignature(target);
let result = Ternary.True;
for (let i = 0; i < checkCount; i++) {
const s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
const t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
const saveErrorInfo = errorInfo;
let related = isRelatedTo(s, t, reportErrors);
if (!related) {
related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) {
if (reportErrors) {
reportError(Diagnostics.Types_of_parameters_0_and_1_are_incompatible,
source.parameters[i < sourceMax ? i : sourceMax].name,
target.parameters[i < targetMax ? i : targetMax].name);
}
return Ternary.False;
}
errorInfo = saveErrorInfo;
}
result &= related;
}
const targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
const sourceReturnType = getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
if (targetReturnType.flags & TypeFlags.PredicateType && (targetReturnType as PredicateType).predicate.kind === TypePredicateKind.Identifier) {
if (!(sourceReturnType.flags & TypeFlags.PredicateType)) {
if (reportErrors) {
reportError(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
}
return Ternary.False;
}
}
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo);
}
function signaturesIdenticalTo(source: Type, target: Type, kind: SignatureKind): Ternary {
@@ -8682,7 +8667,7 @@ namespace ts {
function checkIndexedAccess(node: ElementAccessExpression): Type {
// Grammar checking
if (!node.argumentExpression) {
const sourceFile = getSourceFile(node);
const sourceFile = getSourceFileOfNode(node);
if (node.parent.kind === SyntaxKind.NewExpression && (<NewExpression>node.parent).expression === node) {
const start = skipTrivia(sourceFile.text, node.expression.end);
const end = node.end;
@@ -10278,11 +10263,6 @@ namespace ts {
return anyFunctionType;
}
const isAsync = isAsyncFunctionLike(node);
if (isAsync) {
emitAwaiter = true;
}
const links = getNodeLinks(node);
const type = getTypeOfSymbol(node.symbol);
const contextSensitive = isContextSensitive(node);
@@ -10331,10 +10311,6 @@ namespace ts {
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
const isAsync = isAsyncFunctionLike(node);
if (isAsync) {
emitAwaiter = true;
}
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
if (!node.asteriskToken) {
// return is not necessary in the body of generators
@@ -12062,7 +12038,7 @@ namespace ts {
case SyntaxKind.InterfaceDeclaration:
return SymbolFlags.ExportType;
case SyntaxKind.ModuleDeclaration:
return (<ModuleDeclaration>d).name.kind === SyntaxKind.StringLiteral || getModuleInstanceState(d) !== ModuleInstanceState.NonInstantiated
return isAmbientModule(d) || getModuleInstanceState(d) !== ModuleInstanceState.NonInstantiated
? SymbolFlags.ExportNamespace | SymbolFlags.ExportValue
: SymbolFlags.ExportNamespace;
case SyntaxKind.ClassDeclaration:
@@ -12471,11 +12447,6 @@ namespace ts {
}
}
emitDecorate = true;
if (node.kind === SyntaxKind.Parameter) {
emitParam = true;
}
forEach(node.decorators, checkDecorator);
}
@@ -12493,9 +12464,6 @@ namespace ts {
checkDecorators(node);
checkSignatureDeclaration(node);
const isAsync = isAsyncFunctionLike(node);
if (isAsync) {
emitAwaiter = true;
}
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
@@ -12518,7 +12486,7 @@ namespace ts {
// checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
const firstDeclaration = forEach(localSymbol.declarations,
// Get first non javascript function declaration
declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFile(declaration)) ?
declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFileOfNode(declaration)) ?
declaration : undefined);
// Only type check the symbol once
@@ -13626,7 +13594,6 @@ namespace ts {
const baseTypeNode = getClassExtendsHeritageClauseElement(node);
if (baseTypeNode) {
emitExtends = emitExtends || !isInAmbientContext(node);
const baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
const baseType = baseTypes[0];
@@ -14204,7 +14171,13 @@ namespace ts {
function checkModuleDeclaration(node: ModuleDeclaration) {
if (produceDiagnostics) {
// Grammar checking
const isAmbientExternalModule = node.name.kind === SyntaxKind.StringLiteral;
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
const inAmbientContext = isInAmbientContext(node);
if (isGlobalAugmentation && !inAmbientContext) {
error(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
}
const isAmbientExternalModule = isAmbientModule(node);
const contextErrorMessage = isAmbientExternalModule
? Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
: Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;
@@ -14214,7 +14187,7 @@ namespace ts {
}
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) {
if (!isInAmbientContext(node) && node.name.kind === SyntaxKind.StringLiteral) {
if (!inAmbientContext && node.name.kind === SyntaxKind.StringLiteral) {
grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names);
}
}
@@ -14227,7 +14200,7 @@ namespace ts {
// The following checks only apply on a non-ambient instantiated module declaration.
if (symbol.flags & SymbolFlags.ValueModule
&& symbol.declarations.length > 1
&& !isInAmbientContext(node)
&& !inAmbientContext
&& isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) {
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
if (firstNonAmbientClassOrFunc) {
@@ -14248,19 +14221,107 @@ namespace ts {
}
}
// Checks for ambient external modules.
if (isAmbientExternalModule) {
if (!isGlobalSourceFile(node.parent)) {
error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
if (isExternalModuleAugmentation(node)) {
// body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module)
// otherwise we'll be swamped in cascading errors.
// We can detect if augmentation was applied using following rules:
// - augmentation for a global scope is always applied
// - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
const checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & SymbolFlags.Merged);
if (checkBody) {
// body of ambient external module is always a module block
for (const statement of (<ModuleBlock>node.body).statements) {
checkModuleAugmentationElement(statement, isGlobalAugmentation);
}
}
}
if (isExternalModuleNameRelative(node.name.text)) {
error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
else if (isGlobalSourceFile(node.parent)) {
if (isGlobalAugmentation) {
error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
}
else if (isExternalModuleNameRelative(node.name.text)) {
error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
}
}
else {
if (isGlobalAugmentation) {
error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
}
else {
// Node is not an augmentation and is not located on the script level.
// This means that this is declaration of ambient module that is located in other module or namespace which is prohibited.
error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
}
}
}
}
checkSourceElement(node.body);
}
function checkModuleAugmentationElement(node: Node, isGlobalAugmentation: boolean): void {
switch (node.kind) {
case SyntaxKind.VariableStatement:
// error each individual name in variable statement instead of marking the entire variable statement
for (const decl of (<VariableStatement>node).declarationList.declarations) {
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
case SyntaxKind.ExportAssignment:
case SyntaxKind.ExportDeclaration:
grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
case SyntaxKind.ImportEqualsDeclaration:
if ((<ImportEqualsDeclaration>node).moduleReference.kind !== SyntaxKind.StringLiteral) {
error((<ImportEqualsDeclaration>node).name, Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope);
break;
}
// fallthrough
case SyntaxKind.ImportDeclaration:
grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
case SyntaxKind.BindingElement:
case SyntaxKind.VariableDeclaration:
const name = (<VariableDeclaration | BindingElement>node).name;
if (isBindingPattern(name)) {
for (const el of name.elements) {
// mark individual names in binding pattern
checkModuleAugmentationElement(el, isGlobalAugmentation);
}
break;
}
// fallthrough
case SyntaxKind.ClassDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
const symbol = getSymbolOfNode(node);
if (symbol) {
// module augmentations cannot introduce new names on the top level scope of the module
// this is done it two steps
// 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error
// 2. main check - report error if value declaration of the parent symbol is module augmentation)
let reportError = !(symbol.flags & SymbolFlags.Merged);
if (!reportError) {
if (isGlobalAugmentation) {
// global symbol should not have parent since it is not explicitly exported
reportError = symbol.parent !== undefined;
}
else {
// symbol should not originate in augmentation
reportError = isExternalModuleAugmentation(symbol.parent.valueDeclaration);
}
}
if (reportError) {
error(node, Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope);
}
}
break;
}
}
function getFirstIdentifier(node: EntityName | Expression): Identifier {
while (true) {
if (node.kind === SyntaxKind.QualifiedName) {
@@ -14283,7 +14344,7 @@ namespace ts {
error(moduleName, Diagnostics.String_literal_expected);
return false;
}
const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && isAmbientModule(<ModuleDeclaration>node.parent.parent);
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(moduleName, node.kind === SyntaxKind.ExportDeclaration ?
Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
@@ -14291,12 +14352,16 @@ namespace ts {
return false;
}
if (inAmbientExternalModule && isExternalModuleNameRelative((<LiteralExpression>moduleName).text)) {
// TypeScript 1.0 spec (April 2013): 12.1.6
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference
// other external modules only through top - level external module names.
// Relative external module names are not permitted.
error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
return false;
// we have already reported errors on top level imports\exports in external module augmentations in checkModuleDeclaration
// no need to do this again.
if (!isTopLevelInExternalModuleAugmentation(node)) {
// TypeScript 1.0 spec (April 2013): 12.1.6
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference
// other external modules only through top - level external module names.
// Relative external module names are not permitted.
error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
return false;
}
}
return true;
}
@@ -14402,7 +14467,7 @@ namespace ts {
// export { x, y } from "foo"
forEach(node.exportClause.elements, checkExportSpecifier);
const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && isAmbientModule(node.parent.parent);
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
@@ -14430,7 +14495,7 @@ namespace ts {
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
const symbol = resolveName(exportedName, exportedName.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
if (symbol && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0]))) {
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, Diagnostics.Cannot_re_export_name_that_is_not_defined_in_the_module);
}
else {
@@ -14446,7 +14511,7 @@ namespace ts {
}
const container = node.parent.kind === SyntaxKind.SourceFile ? <SourceFile>node.parent : <ModuleDeclaration>node.parent.parent;
if (container.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>container).name.kind === SyntaxKind.Identifier) {
if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) {
error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
return;
}
@@ -14476,7 +14541,7 @@ namespace ts {
}
function hasExportedMembers(moduleSymbol: Symbol) {
for (var id in moduleSymbol.exports) {
for (const id in moduleSymbol.exports) {
if (id !== "export=") {
return true;
}
@@ -14491,7 +14556,9 @@ namespace ts {
const exportEqualsSymbol = moduleSymbol.exports["export="];
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
if (!isTopLevelInExternalModuleAugmentation(declaration)) {
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
}
// Checks for export * conflicts
const exports = getExportsOfModule(moduleSymbol);
@@ -14706,10 +14773,6 @@ namespace ts {
// Grammar checking
checkGrammarSourceFile(node);
emitExtends = false;
emitDecorate = false;
emitParam = false;
emitAwaiter = false;
potentialThisCollisions.length = 0;
deferredNodes = [];
@@ -14726,26 +14789,6 @@ namespace ts {
potentialThisCollisions.length = 0;
}
if (emitExtends) {
links.flags |= NodeCheckFlags.EmitExtends;
}
if (emitDecorate) {
links.flags |= NodeCheckFlags.EmitDecorate;
}
if (emitParam) {
links.flags |= NodeCheckFlags.EmitParam;
}
if (emitAwaiter) {
links.flags |= NodeCheckFlags.EmitAwaiter;
}
if (emitGenerator || (emitAwaiter && languageVersion < ScriptTarget.ES6)) {
links.flags |= NodeCheckFlags.EmitGenerator;
}
links.flags |= NodeCheckFlags.TypeChecked;
}
}
@@ -15575,13 +15618,13 @@ namespace ts {
};
}
function getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile {
const specifier = getExternalModuleName(declaration);
const moduleSymbol = getSymbolAtLocation(specifier);
if (!moduleSymbol) {
return undefined;
}
return getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile;
function getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile {
const specifier = getExternalModuleName(declaration);
const moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined);
if (!moduleSymbol) {
return undefined;
}
return getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile;
}
function initializeTypeChecker() {
@@ -15590,13 +15633,27 @@ namespace ts {
bindSourceFile(file, compilerOptions);
});
let augmentations: LiteralExpression[][];
// Initialize global symbol table
forEach(host.getSourceFiles(), file => {
if (!isExternalOrCommonJsModule(file)) {
mergeSymbolTable(globals, file.locals);
}
if (file.moduleAugmentations) {
(augmentations || (augmentations = [])).push(file.moduleAugmentations);
}
});
if (augmentations) {
// merge module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
for (const list of augmentations) {
for (const augmentation of list) {
mergeModuleAugmentation(augmentation);
}
}
}
// Setup global builtins
addToSymbolTable(globals, builtinGlobals, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0);
@@ -16412,7 +16469,7 @@ namespace ts {
return true;
}
else if (node.body === undefined) {
return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, Diagnostics._0_expected, "{");
return grammarErrorAtPos(getSourceFileOfNode(node), node.end - 1, ";".length, Diagnostics._0_expected, "{");
}
}
+2 -1
View File
@@ -718,7 +718,8 @@ namespace ts {
}
// Find the component that differs
for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
let joinStartIndex: number;
for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {
break;
}
+34 -5
View File
@@ -54,6 +54,7 @@ namespace ts {
let writer = createAndSetNewTextWriterWithSymbolWriter();
let enclosingDeclaration: Node;
let resultHasExternalModuleIndicator: boolean;
let currentText: string;
let currentLineMap: number[];
let currentIdentifiers: Map<string>;
@@ -101,6 +102,7 @@ namespace ts {
});
}
resultHasExternalModuleIndicator = false;
if (!isBundledEmit || !isExternalModule(sourceFile)) {
noDeclare = false;
emitSourceFile(sourceFile);
@@ -139,6 +141,14 @@ namespace ts {
allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo);
moduleElementDeclarationEmitInfo = [];
}
if (!isBundledEmit && isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) {
// if file was external module with augmentations - this fact should be preserved in .d.ts as well.
// in case if we didn't write any external module specifiers in .d.ts we need to emit something
// that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here.
write("export {};");
writeLine();
}
});
return {
@@ -721,16 +731,25 @@ namespace ts {
writer.writeLine();
}
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration) {
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration) {
// emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations).
// the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered
// external modules since they are indistingushable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}'
// so compiler will treat them as external modules.
resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== SyntaxKind.ModuleDeclaration;
let moduleSpecifier: Node;
if (parent.kind === SyntaxKind.ImportEqualsDeclaration) {
const node = parent as ImportEqualsDeclaration;
moduleSpecifier = getExternalModuleImportEqualsDeclarationExpression(node);
}
else if (parent.kind === SyntaxKind.ModuleDeclaration) {
moduleSpecifier = (<ModuleDeclaration>parent).name;
}
else {
const node = parent as (ImportDeclaration | ExportDeclaration);
moduleSpecifier = node.moduleSpecifier;
}
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, parent);
if (moduleName) {
@@ -784,13 +803,23 @@ namespace ts {
function writeModuleDeclaration(node: ModuleDeclaration) {
emitJsDocComments(node);
emitModuleElementDeclarationFlags(node);
if (node.flags & NodeFlags.Namespace) {
write("namespace ");
if (isGlobalScopeAugmentation(node)) {
write("global ");
}
else {
write("module ");
if (node.flags & NodeFlags.Namespace) {
write("namespace ");
}
else {
write("module ");
}
if (isExternalModuleAugmentation(node)) {
emitExternalModuleSpecifier(node);
}
else {
writeTextOfNode(currentText, node.name);
}
}
writeTextOfNode(currentText, node.name);
while (node.body.kind !== SyntaxKind.ModuleBlock) {
node = <ModuleDeclaration>node.body;
write(".");
+28
View File
@@ -1775,6 +1775,34 @@
"category": "Error",
"code": 2663
},
"Invalid module name in augmentation, module '{0}' cannot be found.": {
"category": "Error",
"code": 2664
},
"Module augmentation cannot introduce new names in the top level scope.": {
"category": "Error",
"code": 2665
},
"Exports and export assignments are not permitted in module augmentations.": {
"category": "Error",
"code": 2666
},
"Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.": {
"category": "Error",
"code": 2667
},
"'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.": {
"category": "Error",
"code": 2668
},
"Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.": {
"category": "Error",
"code": 2669
},
"Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.": {
"category": "Error",
"code": 2670
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
+15 -20
View File
@@ -319,17 +319,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};`;
const awaiterHelper = `
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
return new Promise(function (resolve, reject) {
generator = generator.apply(thisArg, _arguments);
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
function step(verb, value) {
var result = generator[verb](value);
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
}
step("next", void 0);
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};`;
@@ -1250,7 +1245,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
else {
// One object literal with all the attributes in them
write("{");
for (var i = 0; i < attrs.length; i++) {
for (let i = 0, n = attrs.length; i < n; i++) {
if (i > 0) {
write(", ");
}
@@ -1262,7 +1257,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// Children
if (children) {
for (var i = 0; i < children.length; i++) {
for (let i = 0; i < children.length; i++) {
// Don't emit empty expressions
if (children[i].kind === SyntaxKind.JsxExpression && !((<JsxExpression>children[i]).expression)) {
continue;
@@ -1356,7 +1351,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitJsxElement(node: JsxElement) {
emitJsxOpeningOrSelfClosingElement(node.openingElement);
for (var i = 0, n = node.children.length; i < n; i++) {
for (let i = 0, n = node.children.length; i < n; i++) {
emit(node.children[i]);
}
@@ -5227,7 +5222,7 @@ const _super = (function (geti, seti) {
// a lexical declaration such as a LexicalDeclaration or a ClassDeclaration.
if (isClassExpressionWithStaticProperties) {
for (var property of staticProperties) {
for (const property of staticProperties) {
write(",");
writeLine();
emitPropertyDeclaration(node, property, /*receiver*/ tempVariable, /*isExpression*/ true);
@@ -5774,7 +5769,7 @@ const _super = (function (geti, seti) {
const parameters = valueDeclaration.parameters;
const parameterCount = parameters.length;
if (parameterCount > 0) {
for (var i = 0; i < parameterCount; i++) {
for (let i = 0; i < parameterCount; i++) {
if (i > 0) {
write(", ");
}
@@ -7409,12 +7404,12 @@ const _super = (function (geti, seti) {
if (!compilerOptions.noEmitHelpers) {
// Only Emit __extends function when target ES5.
// For target ES6 and above, we can emit classDeclaration as is.
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) {
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && node.flags & NodeFlags.HasClassExtends)) {
writeLines(extendsHelper);
extendsEmitted = true;
}
if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) {
if (!decorateEmitted && node.flags & NodeFlags.HasDecorators) {
writeLines(decorateHelper);
if (compilerOptions.emitDecoratorMetadata) {
writeLines(metadataHelper);
@@ -7422,12 +7417,12 @@ const _super = (function (geti, seti) {
decorateEmitted = true;
}
if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) {
if (!paramEmitted && node.flags & NodeFlags.HasParamDecorators) {
writeLines(paramHelper);
paramEmitted = true;
}
if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitAwaiter) {
if (!awaiterEmitted && node.flags & NodeFlags.HasAsyncFunctions) {
writeLines(awaiterHelper);
awaiterEmitted = true;
}
+19 -2
View File
@@ -4430,6 +4430,9 @@ namespace ts {
}
continue;
case SyntaxKind.GlobalKeyword:
return nextToken() === SyntaxKind.OpenBraceToken;
case SyntaxKind.ImportKeyword:
nextToken();
return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken ||
@@ -4494,6 +4497,7 @@ namespace ts {
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.TypeKeyword:
case SyntaxKind.GlobalKeyword:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
@@ -4582,6 +4586,7 @@ namespace ts {
case SyntaxKind.PublicKeyword:
case SyntaxKind.AbstractKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.GlobalKeyword:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -4609,6 +4614,7 @@ namespace ts {
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.GlobalKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
return parseModuleDeclaration(fullStart, decorators, modifiers);
@@ -5243,14 +5249,25 @@ namespace ts {
const node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parseLiteralNode(/*internName*/ true);
if (token === SyntaxKind.GlobalKeyword) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= NodeFlags.GlobalAugmentation;
}
else {
node.name = parseLiteralNode(/*internName*/ true);
}
node.body = parseModuleBlock();
return finishNode(node);
}
function parseModuleDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ModuleDeclaration {
let flags = modifiers ? modifiers.flags : 0;
if (parseOptional(SyntaxKind.NamespaceKeyword)) {
if (token === SyntaxKind.GlobalKeyword) {
// global augmentation
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
else if (parseOptional(SyntaxKind.NamespaceKeyword)) {
flags |= NodeFlags.Namespace;
}
else {
+95 -46
View File
@@ -361,7 +361,24 @@ namespace ts {
const currentDirectory = host.getCurrentDirectory();
const resolveModuleNamesWorker = host.resolveModuleNames
? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile))
: ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule));
: ((moduleNames: string[], containingFile: string) => {
const resolvedModuleNames: ResolvedModule[] = [];
// resolveModuleName does not store any results between calls.
// lookup is a local cache to avoid resolving the same module name several times
const lookup: Map<ResolvedModule> = {};
for (const moduleName of moduleNames) {
let resolvedName: ResolvedModule;
if (hasProperty(lookup, moduleName)) {
resolvedName = lookup[moduleName];
}
else {
resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule;
lookup[moduleName] = resolvedName;
}
resolvedModuleNames.push(resolvedName);
}
return resolvedModuleNames;
});
const filesByName = createFileMap<SourceFile>();
// stores 'filename -> file association' ignoring case
@@ -498,15 +515,19 @@ namespace ts {
return false;
}
// check imports
// check imports and module augmentations
collectExternalModuleReferences(newSourceFile);
if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
// imports has changed
return false;
}
if (!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
// moduleAugmentations has changed
return false;
}
if (resolveModuleNamesWorker) {
const moduleNames = map(newSourceFile.imports, name => name.text);
const moduleNames = map(concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);
const resolutions = resolveModuleNamesWorker(moduleNames, getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory));
// ensure that module resolution results are still correct
for (let i = 0; i < moduleNames.length; i++) {
@@ -895,65 +916,85 @@ namespace ts {
return a.text === b.text;
}
function getTextOfLiteral(literal: LiteralExpression): string {
return literal.text;
}
function collectExternalModuleReferences(file: SourceFile): void {
if (file.imports) {
return;
}
const isJavaScriptFile = isSourceFileJavaScript(file);
const isExternalModuleFile = isExternalModule(file);
let imports: LiteralExpression[];
let moduleAugmentations: LiteralExpression[];
for (const node of file.statements) {
collect(node, /*allowRelativeModuleNames*/ true, /*collectOnlyRequireCalls*/ false);
collectModuleReferences(node, /*inAmbientModule*/ false);
if (isJavaScriptFile) {
collectRequireCalls(node);
}
}
file.imports = imports || emptyArray;
file.moduleAugmentations = moduleAugmentations || emptyArray;
return;
function collect(node: Node, allowRelativeModuleNames: boolean, collectOnlyRequireCalls: boolean): void {
if (!collectOnlyRequireCalls) {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ExportDeclaration:
let moduleNameExpr = getExternalModuleName(node);
if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) {
break;
}
if (!(<LiteralExpression>moduleNameExpr).text) {
break;
}
if (allowRelativeModuleNames || !isExternalModuleNameRelative((<LiteralExpression>moduleNameExpr).text)) {
(imports || (imports = [])).push(<LiteralExpression>moduleNameExpr);
}
function collectModuleReferences(node: Node, inAmbientModule: boolean): void {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ExportDeclaration:
let moduleNameExpr = getExternalModuleName(node);
if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) {
break;
case SyntaxKind.ModuleDeclaration:
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
// TypeScript 1.0 spec (April 2014): 12.1.6
}
if (!(<LiteralExpression>moduleNameExpr).text) {
break;
}
// TypeScript 1.0 spec (April 2014): 12.1.6
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules
// only through top - level external module names. Relative external module names are not permitted.
if (!inAmbientModule || !isExternalModuleNameRelative((<LiteralExpression>moduleNameExpr).text)) {
(imports || (imports = [])).push(<LiteralExpression>moduleNameExpr);
}
break;
case SyntaxKind.ModuleDeclaration:
if (isAmbientModule(<ModuleDeclaration>node) && (inAmbientModule || node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
const moduleName = <LiteralExpression>(<ModuleDeclaration>node).name;
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
// This will happen in two cases:
// - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope
// - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name
// immediately nested in top level ambient module declaration .
if (isExternalModuleFile || (inAmbientModule && !isExternalModuleNameRelative(moduleName.text))) {
(moduleAugmentations || (moduleAugmentations = [])).push(moduleName);
}
else if (!inAmbientModule) {
// An AmbientExternalModuleDeclaration declares an external module.
// This type of declaration is permitted only in the global module.
// The StringLiteral must specify a top - level external module name.
// Relative external module names are not permitted
forEachChild((<ModuleDeclaration>node).body, node => {
// TypeScript 1.0 spec (April 2014): 12.1.6
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
// only through top - level external module names. Relative external module names are not permitted.
collect(node, /*allowRelativeModuleNames*/ false, collectOnlyRequireCalls);
});
}
break;
}
}
if (isJavaScriptFile) {
if (isRequireCall(node)) {
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
}
else {
forEachChild(node, node => collect(node, allowRelativeModuleNames, /*collectOnlyRequireCalls*/ true));
}
// NOTE: body of ambient module is always a module block
for (const statement of (<ModuleBlock>(<ModuleDeclaration>node).body).statements) {
collectModuleReferences(statement, /*inAmbientModule*/ true);
}
}
}
}
}
function collectRequireCalls(node: Node): void {
if (isRequireCall(node)) {
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
}
else {
forEachChild(node, collectRequireCalls);
}
}
}
@@ -1083,14 +1124,22 @@ namespace ts {
function processImportedModules(file: SourceFile, basePath: string) {
collectExternalModuleReferences(file);
if (file.imports.length) {
if (file.imports.length || file.moduleAugmentations.length) {
file.resolvedModules = {};
const moduleNames = map(file.imports, name => name.text);
const moduleNames = map(concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral);
const resolutions = resolveModuleNamesWorker(moduleNames, getNormalizedAbsolutePath(file.fileName, currentDirectory));
for (let i = 0; i < file.imports.length; i++) {
for (let i = 0; i < moduleNames.length; i++) {
const resolution = resolutions[i];
setResolvedModule(file, moduleNames[i], resolution);
if (resolution && !options.noResolve) {
// add file to program only if:
// - resolution was successfull
// - noResolve is falsy
// - module name come from the list fo imports
const shouldAddFile = resolution &&
!options.noResolve &&
i < file.imports.length;
if (shouldAddFile) {
const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
if (importedFile && resolution.isExternalLibraryImport) {
@@ -1168,7 +1217,7 @@ namespace ts {
if (sourceFiles) {
const absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory));
for (var sourceFile of sourceFiles) {
for (const sourceFile of sourceFiles) {
if (!isDeclarationFile(sourceFile)) {
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
+1
View File
@@ -94,6 +94,7 @@ namespace ts {
"protected": SyntaxKind.ProtectedKeyword,
"public": SyntaxKind.PublicKeyword,
"require": SyntaxKind.RequireKeyword,
"global": SyntaxKind.GlobalKeyword,
"return": SyntaxKind.ReturnKeyword,
"set": SyntaxKind.SetKeyword,
"static": SyntaxKind.StaticKeyword,
+5 -3
View File
@@ -376,9 +376,11 @@ namespace ts {
/**
* @param watcherPath is the path from which the watcher is triggered.
*/
function fileEventHandler(eventName: string, relativefileName: string, baseDirPath: Path) {
function fileEventHandler(eventName: string, relativeFileName: string, baseDirPath: Path) {
// When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
const filePath = relativefileName === undefined ? undefined : toPath(relativefileName, baseDirPath, getCanonicalPath);
const filePath = typeof relativeFileName !== "string"
? undefined
: toPath(relativeFileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) {
for (const fileCallback of fileWatcherCallbacks.get(filePath)) {
fileCallback(filePath);
@@ -460,7 +462,7 @@ namespace ts {
}
function getCanonicalPath(path: string): string {
return useCaseSensitiveFileNames ? path.toLowerCase() : path;
return useCaseSensitiveFileNames ? path : path.toLowerCase();
}
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
+11 -7
View File
@@ -170,6 +170,7 @@ namespace ts {
SymbolKeyword,
TypeKeyword,
FromKeyword,
GlobalKeyword,
OfKeyword, // LastKeyword and LastToken
// Parse tree nodes
@@ -389,11 +390,18 @@ namespace ts {
ContainsThis = 1 << 18, // Interface contains references to "this"
HasImplicitReturn = 1 << 19, // If function implicitly returns on one of codepaths (initialized by binding)
HasExplicitReturn = 1 << 20, // If function has explicit reachable return on one of codepaths (initialized by binding)
GlobalAugmentation = 1 << 21, // Set if module declaration is an augmentation for the global scope
HasClassExtends = 1 << 22, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
HasDecorators = 1 << 23, // If the file has decorators (initialized by binding)
HasParamDecorators = 1 << 24, // If the file has parameter decorators (initialized by binding)
HasAsyncFunctions = 1 << 25, // If the file has async functions (initialized by binding)
Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async,
AccessibilityModifier = Public | Private | Protected,
BlockScoped = Let | Const,
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn,
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions,
}
/* @internal */
@@ -1577,6 +1585,7 @@ namespace ts {
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
/* @internal */ resolvedModules: Map<ResolvedModule>;
/* @internal */ imports: LiteralExpression[];
/* @internal */ moduleAugmentations: LiteralExpression[];
}
export interface ScriptReferenceHost {
@@ -1911,7 +1920,7 @@ namespace ts {
isOptionalParameter(node: ParameterDeclaration): boolean;
moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean;
isArgumentsLocalBinding(node: Identifier): boolean;
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile;
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile;
}
export const enum SymbolFlags {
@@ -2044,11 +2053,6 @@ namespace ts {
TypeChecked = 0x00000001, // Node has been type checked
LexicalThis = 0x00000002, // Lexical 'this' reference
CaptureThis = 0x00000004, // Lexical 'this' used in body
EmitExtends = 0x00000008, // Emit __extends
EmitDecorate = 0x00000010, // Emit __decorate
EmitParam = 0x00000020, // Emit __param helper for decorators
EmitAwaiter = 0x00000040, // Emit __awaiter
EmitGenerator = 0x00000080, // Emit __generator
SuperInstance = 0x00000100, // Instance 'super' reference
SuperStatic = 0x00000200, // Static 'super' reference
ContextChecked = 0x00000400, // Contextual types have been assigned
+43 -40
View File
@@ -251,6 +251,31 @@ namespace ts {
isCatchClauseVariableDeclaration(declaration);
}
export function isAmbientModule(node: Node): boolean {
return node && node.kind === SyntaxKind.ModuleDeclaration &&
((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral || isGlobalScopeAugmentation(<ModuleDeclaration>node));
}
export function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean {
return !!(module.flags & NodeFlags.GlobalAugmentation);
}
export function isExternalModuleAugmentation(node: Node): boolean {
// external module augmentation is a ambient module declaration that is either:
// - defined in the top level scope and source file is an external module
// - defined inside ambient module declaration located in the top level scope and source file not an external module
if (!node || !isAmbientModule(node)) {
return false;
}
switch (node.parent.kind) {
case SyntaxKind.SourceFile:
return isExternalModule(<SourceFile>node.parent);
case SyntaxKind.ModuleBlock:
return isAmbientModule(node.parent.parent) && !isExternalModule(<SourceFile>node.parent.parent.parent);
}
return false;
}
// Gets the nearest enclosing block scope container that has the provided node
// as a descendant, that is not the provided node.
export function getEnclosingBlockScopeContainer(node: Node): Node {
@@ -343,6 +368,7 @@ namespace ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.TypeAliasDeclaration:
errorNode = (<Declaration>node).name;
break;
}
@@ -776,8 +802,8 @@ namespace ts {
}
/**
* Given an super call\property node returns a closest node where either
* - super call\property is legal in the node and not legal in the parent node the node.
* Given an super call\property node returns a closest node where either
* - super call\property is legal in the node and not legal in the parent node the node.
* i.e. super call is legal in constructor but not legal in the class body.
* - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher)
* - super call\property is definitely illegal in the node (but might be legal in some subnode)
@@ -859,54 +885,28 @@ namespace ts {
// property declarations are valid if their parent is a class declaration.
return node.parent.kind === SyntaxKind.ClassDeclaration;
case SyntaxKind.Parameter:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return (<FunctionLikeDeclaration>node.parent).body && node.parent.parent.kind === SyntaxKind.ClassDeclaration;
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.MethodDeclaration:
// if this method has a body and its parent is a class declaration, this is a valid target.
return (<FunctionLikeDeclaration>node).body && node.parent.kind === SyntaxKind.ClassDeclaration;
return (<FunctionLikeDeclaration>node).body !== undefined
&& node.parent.kind === SyntaxKind.ClassDeclaration;
case SyntaxKind.Parameter:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return (<FunctionLikeDeclaration>node.parent).body !== undefined
&& (node.parent.kind === SyntaxKind.Constructor
|| node.parent.kind === SyntaxKind.MethodDeclaration
|| node.parent.kind === SyntaxKind.SetAccessor)
&& node.parent.parent.kind === SyntaxKind.ClassDeclaration;
}
return false;
}
export function nodeIsDecorated(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
if (node.decorators) {
return true;
}
return false;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
if (node.decorators) {
return true;
}
return false;
case SyntaxKind.GetAccessor:
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
return true;
}
return false;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.SetAccessor:
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
return true;
}
return false;
}
return false;
return node.decorators !== undefined
&& nodeCanBeDecorated(node);
}
export function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression {
@@ -1115,6 +1115,9 @@ namespace ts {
if (node.kind === SyntaxKind.ExportDeclaration) {
return (<ExportDeclaration>node).moduleSpecifier;
}
if (node.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
return (<ModuleDeclaration>node).name;
}
}
export function hasQuestionToken(node: Node) {
+32 -13
View File
@@ -1255,7 +1255,7 @@ interface Console {
select(element: Element): void;
time(timerName?: string): void;
timeEnd(timerName?: string): void;
trace(): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
@@ -1514,9 +1514,9 @@ interface DataTransferItemList {
length: number;
add(data: File): DataTransferItem;
clear(): void;
item(index: number): File;
item(index: number): DataTransferItem;
remove(index: number): void;
[index: number]: File;
[index: number]: DataTransferItem;
}
declare var DataTransferItemList: {
@@ -2569,6 +2569,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
createElement(tagName: "picture"): HTMLPictureElement;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -2981,6 +2983,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
webkitRequestFullscreen(): void;
getElementsByClassName(classNames: string): NodeListOf<Element>;
matches(selector: string): boolean;
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -3770,6 +3773,7 @@ interface HTMLCanvasElement extends HTMLElement {
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(): Blob;
}
declare var HTMLCanvasElement: {
@@ -6924,7 +6928,7 @@ interface IDBDatabase extends EventTarget {
objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
version: string;
version: number;
close(): void;
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
deleteObjectStore(name: string): void;
@@ -7640,7 +7644,7 @@ declare var MediaQueryList: {
interface MediaSource extends EventTarget {
activeSourceBuffers: SourceBufferList;
duration: number;
readyState: number;
readyState: string;
sourceBuffers: SourceBufferList;
addSourceBuffer(type: string): SourceBuffer;
endOfStream(error?: number): void;
@@ -10369,17 +10373,16 @@ declare var Storage: {
}
interface StorageEvent extends Event {
key: string;
newValue: any;
oldValue: any;
storageArea: Storage;
url: string;
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
key?: string;
oldValue?: string;
newValue?: string;
storageArea?: Storage;
}
declare var StorageEvent: {
prototype: StorageEvent;
new(): StorageEvent;
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
}
interface StyleMedia {
@@ -11977,7 +11980,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
msMatchMedia(mediaQuery: string): MediaQueryList;
msRequestAnimationFrame(callback: FrameRequestCallback): number;
msWriteProfilerMark(profilerMarkName: string): void;
open(url?: string, target?: string, features?: string, replace?: boolean): any;
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
postMessage(message: any, targetOrigin: string, ports?: any): void;
print(): void;
prompt(message?: string, _default?: string): string;
@@ -12579,6 +12582,14 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface StorageEventInit extends EventInit {
key?: string;
oldValue?: string;
newValue?: string;
url: string;
storageArea?: Storage;
}
interface IDBObjectStoreParameters {
keyPath?: string | string[];
autoIncrement?: boolean;
@@ -12633,6 +12644,14 @@ declare var HTMLTemplateElement: {
new(): HTMLTemplateElement;
}
interface HTMLPictureElement extends HTMLElement {
}
declare var HTMLPictureElement: {
prototype: HTMLPictureElement;
new(): HTMLPictureElement;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -12829,7 +12848,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
declare function msWriteProfilerMark(profilerMarkName: string): void;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
declare function print(): void;
declare function prompt(message?: string, _default?: string): string;
+2 -2
View File
@@ -69,7 +69,7 @@ interface Console {
select(element: any): void;
time(timerName?: string): void;
timeEnd(timerName?: string): void;
trace(): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
@@ -309,7 +309,7 @@ interface IDBDatabase extends EventTarget {
objectStoreNames: DOMStringList;
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
version: string;
version: number;
close(): void;
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
deleteObjectStore(name: string): void;
+6 -2
View File
@@ -1002,7 +1002,9 @@ namespace ts.server {
info.setFormatOptions(this.getFormatCodeOptions());
this.filenameToScriptInfo[fileName] = info;
if (!info.isOpen) {
info.fileWatcher = this.host.watchFile(<Path>fileName, _ => { this.watchedFileChanged(fileName); });
info.fileWatcher = this.host.watchFile(
toPath(fileName, fileName, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)),
_ => { this.watchedFileChanged(fileName); });
}
}
}
@@ -1215,7 +1217,9 @@ namespace ts.server {
}
}
project.finishGraph();
project.projectFileWatcher = this.host.watchFile(<Path>configFilename, _ => this.watchedProjectConfigFileChanged(project));
project.projectFileWatcher = this.host.watchFile(
toPath(configFilename, configFilename, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)),
_ => this.watchedProjectConfigFileChanged(project));
this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename));
project.directoryWatcher = this.host.watchDirectory(
ts.getDirectoryPath(configFilename),
+1 -1
View File
@@ -387,7 +387,7 @@ namespace ts.NavigationBar {
function getModuleName(moduleDeclaration: ModuleDeclaration): string {
// We want to maintain quotation marks.
if (moduleDeclaration.name.kind === SyntaxKind.StringLiteral) {
if (isAmbientModule(moduleDeclaration)) {
return getTextOfNode(moduleDeclaration.name);
}
+9 -3
View File
@@ -811,6 +811,7 @@ namespace ts {
public nameTable: Map<string>;
public resolvedModules: Map<ResolvedModule>;
public imports: LiteralExpression[];
public moduleAugmentations: LiteralExpression[];
private namedDeclarations: Map<Declaration[]>;
constructor(kind: SyntaxKind, pos: number, end: number) {
@@ -6028,6 +6029,10 @@ namespace ts {
*/
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[],
previousIterationSymbolsCache: SymbolTable): void {
if (!symbol) {
return;
}
// If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited
// This is particularly important for the following cases, so that we do not infinitely visit the same symbol.
// For example:
@@ -6043,7 +6048,7 @@ namespace ts {
return;
}
if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
forEach(symbol.getDeclarations(), declaration => {
if (declaration.kind === SyntaxKind.ClassDeclaration) {
getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(<ClassDeclaration>declaration));
@@ -6292,7 +6297,7 @@ namespace ts {
return SemanticMeaning.Value | SemanticMeaning.Type;
case SyntaxKind.ModuleDeclaration:
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
if (isAmbientModule(<ModuleDeclaration>node)) {
return SemanticMeaning.Namespace | SemanticMeaning.Value;
}
else if (getModuleInstanceState(node) === ModuleInstanceState.Instantiated) {
@@ -6823,7 +6828,8 @@ namespace ts {
function classifyDisabledMergeCode(text: string, start: number, end: number) {
// Classify the line that the ======= marker is on as a comment. Then just lex
// all further tokens and add them to the result.
for (var i = start; i < end; i++) {
let i: number;
for (i = start; i < end; i++) {
if (isLineBreak(text.charCodeAt(i))) {
break;
}
@@ -1,5 +1,4 @@
tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"'.
Property 'someClass' is missing in type 'Number'.
tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'.
@@ -9,7 +8,6 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes
x = 1; // Should be error
~
!!! error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"'.
!!! error TS2322: Property 'someClass' is missing in type 'Number'.
var y = 1;
y = moduleA; // should be error
~
@@ -1,4 +1,4 @@
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2664: Invalid module name in augmentation, module 'ext' cannot be found.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find module 'ext'.
@@ -9,7 +9,7 @@ tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): err
declare module "ext" {
~~~~~
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
!!! error TS2664: Invalid module name in augmentation, module 'ext' cannot be found.
export class C { }
}
@@ -1,9 +1,12 @@
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ====
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (2 errors) ====
module M {
export declare module "M" { }
~~~~~~
!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
~~~
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
}
@@ -1,7 +1,10 @@
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2664: Invalid module name in augmentation, module 'M' cannot be found.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ====
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (2 errors) ====
export declare module "M" { }
~~~~~~
!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
~~~
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
!!! error TS2664: Invalid module name in augmentation, module 'M' cannot be found.
@@ -1,5 +1,4 @@
tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ====
@@ -8,5 +7,4 @@ tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS
arguments = 10; /// This shouldnt be of type number and result in error.
~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'IArguments'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
}
@@ -26,10 +26,13 @@ tests/cases/compiler/arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is
Property 'C2M1' is missing in type 'C3'.
tests/cases/compiler/arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'.
Type 'C2' is not assignable to type 'C3'.
Property 'CM3M1' is missing in type 'C2'.
tests/cases/compiler/arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'.
Type 'C1' is not assignable to type 'C3'.
Property 'CM3M1' is missing in type 'C1'.
tests/cases/compiler/arrayAssignmentTest1.ts(77,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]'.
Type 'I1' is not assignable to type 'C3'.
Property 'CM3M1' is missing in type 'I1'.
tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => C1'.
tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'.
@@ -159,14 +162,17 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n
~~~~~~
!!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]'.
!!! error TS2322: Type 'C2' is not assignable to type 'C3'.
!!! error TS2322: Property 'CM3M1' is missing in type 'C2'.
arr_c3 = arr_c1_2; // should be an error - is
~~~~~~
!!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]'.
!!! error TS2322: Type 'C1' is not assignable to type 'C3'.
!!! error TS2322: Property 'CM3M1' is missing in type 'C1'.
arr_c3 = arr_i1_2; // should be an error - is
~~~~~~
!!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]'.
!!! error TS2322: Type 'I1' is not assignable to type 'C3'.
!!! error TS2322: Property 'CM3M1' is missing in type 'I1'.
arr_any = f1; // should be an error - is
~~~~~~~
@@ -18,7 +18,6 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
Types of parameters 'items' and 'items' are incompatible.
Type 'number | string' is not assignable to type 'Number'.
Type 'string' is not assignable to type 'Number'.
Property 'toFixed' is missing in type 'String'.
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ====
@@ -82,5 +81,4 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
!!! error TS2322: Type 'number | string' is not assignable to type 'Number'.
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
!!! error TS2322: Property 'toFixed' is missing in type 'String'.
@@ -4,7 +4,6 @@ tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is n
tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'.
Type 'number[]' is not assignable to type 'number[][]'.
Type 'number' is not assignable to type 'number[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/arraySigChecking.ts (3 errors) ====
@@ -39,7 +38,6 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]'
!!! error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'.
!!! error TS2322: Type 'number[]' is not assignable to type 'number[][]'.
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
function isEmpty(l: { length: number }) {
return l.length === 0;
@@ -1,5 +1,4 @@
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
Property 'isArray' is missing in type 'Number'.
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected.
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected.
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
@@ -16,7 +15,6 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(
var xs3: typeof Array<number>;
~~~
!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
!!! error TS2322: Property 'isArray' is missing in type 'Number'.
~
!!! error TS1005: '=' expected.
~
@@ -3,9 +3,7 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: st
tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
Property 'one' is missing in type '{ [index: number]: any; }'.
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
Index signature is missing in type 'String'.
tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
Index signature is missing in type 'Boolean'.
==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ====
@@ -25,11 +23,9 @@ tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is
y = "foo"; // Error
~
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
!!! error TS2322: Index signature is missing in type 'String'.
z = "foo"; // OK, string has numeric indexer
z = false; // Error
~
!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
!!! error TS2322: Index signature is missing in type 'Boolean'.
@@ -8,6 +8,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(53,9): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '<T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
Types of parameters 'y' and 'y' are incompatible.
Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
Types of parameters 'arg2' and 'arg2' are incompatible.
Type 'Base' is not assignable to type '{ foo: number; }'.
Types of property 'foo' are incompatible.
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts (2 errors) ====
@@ -76,6 +80,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '<T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible.
!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
var b10: <T extends Derived>(...x: T[]) => T;
@@ -8,6 +8,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(53,9): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new <T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
Types of parameters 'y' and 'y' are incompatible.
Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
Types of parameters 'arg2' and 'arg2' are incompatible.
Type 'Base' is not assignable to type '{ foo: number; }'.
Types of property 'foo' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new <T>(x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'.
Types of parameters 'x' and 'x' are incompatible.
Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'.
@@ -15,6 +19,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
Types of parameters 'x' and 'x' are incompatible.
Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'.
Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any'
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new <T>(x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }'.
Types of parameters 'x' and 'x' are incompatible.
Type '(a: any) => any' is not assignable to type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }'.
@@ -22,6 +27,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
Types of parameters 'x' and 'x' are incompatible.
Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' is not assignable to type '(a: any) => any'.
Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' provides no match for the signature '(a: any): any'
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (6 errors) ====
@@ -90,6 +96,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new <T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible.
!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
var b10: new <T extends Derived>(...x: T[]) => T;
@@ -124,6 +134,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'.
!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any'
var b17: new <T>(x: (a: T) => T) => any[];
a17 = b17; // error
@@ -137,6 +148,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
!!! error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' is not assignable to type '(a: any) => any'.
!!! error TS2322: Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' provides no match for the signature '(a: any): any'
}
module WithGenericSignaturesInBaseType {
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'any[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability16.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: any[]; }'.
Types of property 'two' are incompatible.
Type 'string' is not assignable to type 'any[]'.
Property 'push' is missing in type 'String'.
==== tests/cases/compiler/assignmentCompatability17.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: any[]; }'.
!!! error TS2322: Types of property 'two' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'any[]'.
!!! error TS2322: Property 'push' is missing in type 'String'.
!!! error TS2322: Type 'string' is not assignable to type 'any[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'number[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability18.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: number[]; }'.
Types of property 'two' are incompatible.
Type 'string' is not assignable to type 'number[]'.
Property 'push' is missing in type 'String'.
==== tests/cases/compiler/assignmentCompatability19.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: number[]; }'.
!!! error TS2322: Types of property 'two' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number[]'.
!!! error TS2322: Property 'push' is missing in type 'String'.
!!! error TS2322: Type 'string' is not assignable to type 'number[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'string[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability20.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: string[]; }'.
Types of property 'two' are incompatible.
Type 'string' is not assignable to type 'string[]'.
Property 'push' is missing in type 'String'.
==== tests/cases/compiler/assignmentCompatability21.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: string[]; }'.
!!! error TS2322: Types of property 'two' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'string[]'.
!!! error TS2322: Property 'push' is missing in type 'String'.
!!! error TS2322: Type 'string' is not assignable to type 'string[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'boolean[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability22.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: boolean[]; }'.
Types of property 'two' are incompatible.
Type 'string' is not assignable to type 'boolean[]'.
Property 'push' is missing in type 'String'.
==== tests/cases/compiler/assignmentCompatability23.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: boolean[]; }'.
!!! error TS2322: Types of property 'two' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'boolean[]'.
!!! error TS2322: Property 'push' is missing in type 'String'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'any[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability29.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'number[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability30.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'string[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability31.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
@@ -1,7 +1,6 @@
tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'boolean[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/assignmentCompatability32.ts (1 errors) ====
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'inte
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
@@ -1,9 +1,7 @@
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable'.
Property 'apply' is missing in type 'String'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Applicable'.
Property 'apply' is missing in type 'string[]'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable'.
Property 'apply' is missing in type 'Number'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Applicable'.
Property 'apply' is missing in type '{}'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'.
@@ -26,7 +24,6 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi
x = '';
~
!!! error TS2322: Type 'string' is not assignable to type 'Applicable'.
!!! error TS2322: Property 'apply' is missing in type 'String'.
x = [''];
~
!!! error TS2322: Type 'string[]' is not assignable to type 'Applicable'.
@@ -34,7 +31,6 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi
x = 4;
~
!!! error TS2322: Type 'number' is not assignable to type 'Applicable'.
!!! error TS2322: Property 'apply' is missing in type 'Number'.
x = {};
~
!!! error TS2322: Type '{}' is not assignable to type 'Applicable'.
@@ -1,9 +1,7 @@
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Callable'.
Property 'call' is missing in type 'String'.
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Callable'.
Property 'call' is missing in type 'string[]'.
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Callable'.
Property 'call' is missing in type 'Number'.
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Callable'.
Property 'call' is missing in type '{}'.
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'.
@@ -26,7 +24,6 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio
x = '';
~
!!! error TS2322: Type 'string' is not assignable to type 'Callable'.
!!! error TS2322: Property 'call' is missing in type 'String'.
x = [''];
~
!!! error TS2322: Type 'string[]' is not assignable to type 'Callable'.
@@ -34,7 +31,6 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio
x = 4;
~
!!! error TS2322: Type 'number' is not assignable to type 'Callable'.
!!! error TS2322: Property 'call' is missing in type 'Number'.
x = {};
~
!!! error TS2322: Type '{}' is not assignable to type 'Callable'.
@@ -40,17 +40,12 @@ module M {
}
//// [asyncAwaitIsolatedModules_es6.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
return new Promise(function (resolve, reject) {
generator = generator.apply(thisArg, _arguments);
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
function step(verb, value) {
var result = generator[verb](value);
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
}
step("next", void 0);
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
function f0() {
+6 -11
View File
@@ -40,17 +40,12 @@ module M {
}
//// [asyncAwait_es6.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
return new Promise(function (resolve, reject) {
generator = generator.apply(thisArg, _arguments);
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
function step(verb, value) {
var result = generator[verb](value);
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
}
step("next", void 0);
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
function f0() {
@@ -0,0 +1,47 @@
//// [tests/cases/compiler/asyncFunctionsAcrossFiles.ts] ////
//// [a.ts]
import { b } from './b';
export const a = {
f: async () => {
await b.f();
}
};
//// [b.ts]
import { a } from './a';
export const b = {
f: async () => {
await a.f();
}
};
//// [b.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
import { a } from './a';
export const b = {
f: () => __awaiter(this, void 0, Promise, function* () {
yield a.f();
})
};
//// [a.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
import { b } from './b';
export const a = {
f: () => __awaiter(this, void 0, Promise, function* () {
yield b.f();
})
};
@@ -0,0 +1,32 @@
=== tests/cases/compiler/a.ts ===
import { b } from './b';
>b : Symbol(b, Decl(a.ts, 0, 8))
export const a = {
>a : Symbol(a, Decl(a.ts, 1, 12))
f: async () => {
>f : Symbol(f, Decl(a.ts, 1, 18))
await b.f();
>b.f : Symbol(f, Decl(b.ts, 1, 18))
>b : Symbol(b, Decl(a.ts, 0, 8))
>f : Symbol(f, Decl(b.ts, 1, 18))
}
};
=== tests/cases/compiler/b.ts ===
import { a } from './a';
>a : Symbol(a, Decl(b.ts, 0, 8))
export const b = {
>b : Symbol(b, Decl(b.ts, 1, 12))
f: async () => {
>f : Symbol(f, Decl(b.ts, 1, 18))
await a.f();
>a.f : Symbol(f, Decl(a.ts, 1, 18))
>a : Symbol(a, Decl(b.ts, 0, 8))
>f : Symbol(f, Decl(a.ts, 1, 18))
}
};
@@ -0,0 +1,40 @@
=== tests/cases/compiler/a.ts ===
import { b } from './b';
>b : { f: () => Promise<void>; }
export const a = {
>a : { f: () => Promise<void>; }
>{ f: async () => { await b.f(); }} : { f: () => Promise<void>; }
f: async () => {
>f : () => Promise<void>
>async () => { await b.f(); } : () => Promise<void>
await b.f();
>await b.f() : void
>b.f() : Promise<void>
>b.f : () => Promise<void>
>b : { f: () => Promise<void>; }
>f : () => Promise<void>
}
};
=== tests/cases/compiler/b.ts ===
import { a } from './a';
>a : { f: () => Promise<void>; }
export const b = {
>b : { f: () => Promise<void>; }
>{ f: async () => { await a.f(); }} : { f: () => Promise<void>; }
f: async () => {
>f : () => Promise<void>
>async () => { await a.f(); } : () => Promise<void>
await a.f();
>await a.f() : void
>a.f() : Promise<void>
>a.f : () => Promise<void>
>a : { f: () => Promise<void>; }
>f : () => Promise<void>
}
};
@@ -16,17 +16,12 @@ class Task extends Promise {
exports.Task = Task;
//// [test.js]
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
return new Promise(function (resolve, reject) {
generator = generator.call(thisArg, _arguments);
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
function step(verb, value) {
var result = generator[verb](value);
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
}
step("next", void 0);
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
var task_1 = require("./task");
+6 -11
View File
@@ -6,17 +6,12 @@ async function f() {}
function g() { }
//// [a.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
return new Promise(function (resolve, reject) {
generator = generator.apply(thisArg, _arguments);
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
function step(verb, value) {
var result = generator[verb](value);
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
}
step("next", void 0);
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new P(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
function f() {
@@ -1,11 +1,5 @@
tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type 'number' is not assignable to type 'Boolean'.
Types of property 'valueOf' are incompatible.
Type '() => number' is not assignable to type '() => boolean'.
Type 'number' is not assignable to type 'boolean'.
tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type 'string' is not assignable to type 'Boolean'.
Types of property 'valueOf' are incompatible.
Type '() => string' is not assignable to type '() => boolean'.
Type 'string' is not assignable to type 'boolean'.
tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'.
Types of property 'valueOf' are incompatible.
Type '() => Object' is not assignable to type '() => boolean'.
@@ -17,15 +11,9 @@ tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not a
b = 1; // Error
~
!!! error TS2322: Type 'number' is not assignable to type 'Boolean'.
!!! error TS2322: Types of property 'valueOf' are incompatible.
!!! error TS2322: Type '() => number' is not assignable to type '() => boolean'.
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
b = "a"; // Error
~
!!! error TS2322: Type 'string' is not assignable to type 'Boolean'.
!!! error TS2322: Types of property 'valueOf' are incompatible.
!!! error TS2322: Type '() => string' is not assignable to type '() => boolean'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
b = {}; // Error
~
!!! error TS2322: Type '{}' is not assignable to type 'Boolean'.
@@ -0,0 +1,71 @@
//// [tests/cases/compiler/classExtendsAcrossFiles.ts] ////
//// [a.ts]
import { b } from './b';
export const a = {
f: () => {
class A { }
class B extends A { }
b.f();
}
};
//// [b.ts]
import { a } from './a';
export const b = {
f: () => {
class A { }
class B extends A { }
a.f();
}
};
//// [b.js]
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var a_1 = require('./a');
exports.b = {
f: function () {
var A = (function () {
function A() {
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
}(A));
a_1.a.f();
}
};
//// [a.js]
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var b_1 = require('./b');
exports.a = {
f: function () {
var A = (function () {
function A() {
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
}(A));
b_1.b.f();
}
};
@@ -0,0 +1,46 @@
=== tests/cases/compiler/a.ts ===
import { b } from './b';
>b : Symbol(b, Decl(a.ts, 0, 8))
export const a = {
>a : Symbol(a, Decl(a.ts, 1, 12))
f: () => {
>f : Symbol(f, Decl(a.ts, 1, 18))
class A { }
>A : Symbol(A, Decl(a.ts, 2, 14))
class B extends A { }
>B : Symbol(B, Decl(a.ts, 3, 19))
>A : Symbol(A, Decl(a.ts, 2, 14))
b.f();
>b.f : Symbol(f, Decl(b.ts, 1, 18))
>b : Symbol(b, Decl(a.ts, 0, 8))
>f : Symbol(f, Decl(b.ts, 1, 18))
}
};
=== tests/cases/compiler/b.ts ===
import { a } from './a';
>a : Symbol(a, Decl(b.ts, 0, 8))
export const b = {
>b : Symbol(b, Decl(b.ts, 1, 12))
f: () => {
>f : Symbol(f, Decl(b.ts, 1, 18))
class A { }
>A : Symbol(A, Decl(b.ts, 2, 14))
class B extends A { }
>B : Symbol(B, Decl(b.ts, 3, 19))
>A : Symbol(A, Decl(b.ts, 2, 14))
a.f();
>a.f : Symbol(f, Decl(a.ts, 1, 18))
>a : Symbol(a, Decl(b.ts, 0, 8))
>f : Symbol(f, Decl(a.ts, 1, 18))
}
};
@@ -0,0 +1,52 @@
=== tests/cases/compiler/a.ts ===
import { b } from './b';
>b : { f: () => void; }
export const a = {
>a : { f: () => void; }
>{ f: () => { class A { } class B extends A { } b.f(); }} : { f: () => void; }
f: () => {
>f : () => void
>() => { class A { } class B extends A { } b.f(); } : () => void
class A { }
>A : A
class B extends A { }
>B : B
>A : A
b.f();
>b.f() : void
>b.f : () => void
>b : { f: () => void; }
>f : () => void
}
};
=== tests/cases/compiler/b.ts ===
import { a } from './a';
>a : { f: () => void; }
export const b = {
>b : { f: () => void; }
>{ f: () => { class A { } class B extends A { } a.f(); }} : { f: () => void; }
f: () => {
>f : () => void
>() => { class A { } class B extends A { } a.f(); } : () => void
class A { }
>A : A
class B extends A { }
>B : B
>A : A
a.f();
>a.f() : void
>a.f : () => void
>a : { f: () => void; }
>f : () => void
}
};
@@ -2,7 +2,6 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(8,1): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(11,1): error TS2322: Type 'string' is not assignable to type 'E'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(14,1): error TS2322: Type 'string' is not assignable to type '{ a: string; }'.
Property 'a' is missing in type 'String'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(17,1): error TS2322: Type 'string' is not assignable to type 'void'.
@@ -29,7 +28,6 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
x4 += '';
~~
!!! error TS2322: Type 'string' is not assignable to type '{ a: string; }'.
!!! error TS2322: Property 'a' is missing in type 'String'.
var x5: void;
x5 += '';
@@ -1,5 +1,4 @@
tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2322: Type 'number' is not assignable to type 'X'.
Property 'foo' is missing in type 'Number'.
tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
@@ -9,7 +8,6 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2409: Retur
return 1;
~
!!! error TS2322: Type 'number' is not assignable to type 'X'.
!!! error TS2322: Property 'foo' is missing in type 'Number'.
~
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class
}
@@ -1,5 +1,4 @@
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2322: Type 'number' is not assignable to type 'D'.
Property 'x' is missing in type 'Number'.
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,16): error TS2322: Type '{ x: number; }' is not assignable to type 'F<T>'.
Types of property 'x' are incompatible.
@@ -22,7 +21,6 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl
return 1; // error
~
!!! error TS2322: Type 'number' is not assignable to type 'D'.
!!! error TS2322: Property 'x' is missing in type 'Number'.
~
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class
}
@@ -1,7 +1,6 @@
tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'.
Type '{ id: number; } | number' is not assignable to type '{ id: number; }'.
Type 'number' is not assignable to type '{ id: number; }'.
Property 'id' is missing in type 'Number'.
==== tests/cases/compiler/contextualTyping21.ts (1 errors) ====
@@ -9,5 +8,4 @@ tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: num
~~~
!!! error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'.
!!! error TS2322: Type '{ id: number; } | number' is not assignable to type '{ id: number; }'.
!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'.
!!! error TS2322: Property 'id' is missing in type 'Number'.
!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'.
@@ -1,6 +1,7 @@
tests/cases/compiler/contextualTyping33.ts(1,66): error TS2345: Argument of type '((() => number) | (() => string))[]' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'.
Type '(() => number) | (() => string)' is not assignable to type '{ (): number; (i: number): number; }'.
Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'.
Type 'string' is not assignable to type 'number'.
==== tests/cases/compiler/contextualTyping33.ts (1 errors) ====
@@ -8,4 +9,5 @@ tests/cases/compiler/contextualTyping33.ts(1,66): error TS2345: Argument of type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '((() => number) | (() => string))[]' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'.
!!! error TS2345: Type '(() => number) | (() => string)' is not assignable to type '{ (): number; (i: number): number; }'.
!!! error TS2345: Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'.
!!! error TS2345: Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
@@ -2,7 +2,6 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ
Index signatures are incompatible.
Type 'Date | number' is not assignable to type 'Date'.
Type 'number' is not assignable to type 'Date'.
Property 'toDateString' is missing in type 'Number'.
==== tests/cases/compiler/contextualTypingOfArrayLiterals1.ts (1 errors) ====
@@ -16,7 +15,6 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'Date | number' is not assignable to type 'Date'.
!!! error TS2322: Type 'number' is not assignable to type 'Date'.
!!! error TS2322: Property 'toDateString' is missing in type 'Number'.
var r2 = x3[1];
r2.getDate();
@@ -2,7 +2,6 @@ tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS
Type '(b: number) => void' is not assignable to type '(a: A) => void'.
Types of parameters 'b' and 'a' are incompatible.
Type 'number' is not assignable to type 'A'.
Property 'foo' is missing in type 'Number'.
==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (1 errors) ====
@@ -22,5 +21,4 @@ tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS
!!! error TS2322: Type '(b: number) => void' is not assignable to type '(a: A) => void'.
!!! error TS2322: Types of parameters 'b' and 'a' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'A'.
!!! error TS2322: Property 'foo' is missing in type 'Number'.
@@ -1,6 +1,5 @@
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
Type 'string' is not assignable to type 'Date'.
Property 'toDateString' is missing in type 'String'.
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
Type 'string' is not assignable to type 'Date'.
@@ -25,7 +24,6 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32):
~
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
!!! error TS2345: Property 'toDateString' is missing in type 'String'.
var r6 = _.forEach<number>(c2, (x) => { return x.toFixed() });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
@@ -0,0 +1,15 @@
tests/cases/compiler/declarationEmit_UnknownImport.ts(2,1): error TS2304: Cannot find name 'SomeNonExistingName'.
tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS2503: Cannot find namespace 'SomeNonExistingName'.
tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'.
==== tests/cases/compiler/declarationEmit_UnknownImport.ts (3 errors) ====
import Foo = SomeNonExistingName
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'SomeNonExistingName'.
~~~~~~~~~~~~~~~~~~~
!!! error TS2503: Cannot find namespace 'SomeNonExistingName'.
~~~~~~~~~~~~~~~~~~~
!!! error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'.
export {Foo}
@@ -0,0 +1,7 @@
//// [declarationEmit_UnknownImport.ts]
import Foo = SomeNonExistingName
export {Foo}
//// [declarationEmit_UnknownImport.js]
"use strict";
@@ -0,0 +1,21 @@
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,1): error TS2304: Cannot find name 'From'.
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS1005: '=' expected.
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS2503: Cannot find namespace 'From'.
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS4000: Import declaration 'Foo' is using private name 'From'.
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,17): error TS1005: ';' expected.
==== tests/cases/compiler/declarationEmit_UnknownImport2.ts (5 errors) ====
import Foo From './Foo'; // Syntax error
~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'From'.
~~~~
!!! error TS1005: '=' expected.
~~~~
!!! error TS2503: Cannot find namespace 'From'.
~~~~
!!! error TS4000: Import declaration 'Foo' is using private name 'From'.
~~~~~~~
!!! error TS1005: ';' expected.
export default Foo
@@ -0,0 +1,8 @@
//// [declarationEmit_UnknownImport2.ts]
import Foo From './Foo'; // Syntax error
export default Foo
//// [declarationEmit_UnknownImport2.js]
"use strict";
'./Foo'; // Syntax error
@@ -5,7 +5,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
Types of property '1' are incompatible.
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'.
Property 'toFixed' is missing in type 'String'.
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[]'.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(23,5): error TS2322: Type 'number[]' is not assignable to type '[string, string]'.
@@ -43,7 +42,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
var [b3 = "string", b4, b5] = bar(); // Error
~~
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
!!! error TS2322: Property 'toFixed' is missing in type 'String'.
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
@@ -8,7 +8,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
Type 'number | string[][] | string' is not assignable to type 'number | string[][]'.
Type 'string' is not assignable to type 'number | string[][]'.
Type 'string' is not assignable to type 'string[][]'.
Property 'push' is missing in type 'String'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(23,14): error TS2345: Argument of type '{ x: string; y: boolean; }' is not assignable to parameter of type '{ x: number; y: any; }'.
@@ -34,7 +33,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,4): error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
Types of property '2' are incompatible.
Type 'boolean' is not assignable to type '[[any]]'.
Property '0' is missing in type 'Boolean'.
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]]'.
@@ -78,7 +76,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
!!! error TS2345: Type 'number | string[][] | string' is not assignable to type 'number | string[][]'.
!!! error TS2345: Type 'string' is not assignable to type 'number | string[][]'.
!!! error TS2345: Type 'string' is not assignable to type 'string[][]'.
!!! error TS2345: Property 'push' is missing in type 'String'.
// If the declaration includes an initializer expression (which is permitted only
@@ -146,7 +143,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
!!! error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
!!! error TS2345: Types of property '2' are incompatible.
!!! error TS2345: Type 'boolean' is not assignable to type '[[any]]'.
!!! error TS2345: Property '0' is missing in type 'Boolean'.
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]]]'.
@@ -6,7 +6,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,4): error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
Types of property '2' are incompatible.
Type 'string' is not assignable to type '[[any]]'.
Property '0' is missing in type 'String'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'.
Property '2' is missing in type '[number, number]'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
@@ -53,7 +52,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
!!! error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
!!! error TS2345: Types of property '2' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type '[[any]]'.
!!! error TS2345: Property '0' is missing in type 'String'.
a5([1, 2]); // Error, parameter type is [any, any, [[any]]]
~~~~~~
!!! error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'.
@@ -1,6 +1,7 @@
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(47,4): error TS2345: Argument of type '{ y: Class; }' is not assignable to parameter of type '{ y: D; }'.
Types of property 'y' are incompatible.
Type 'Class' is not assignable to type 'D'.
Property 'foo' is missing in type 'Class'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(48,4): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ y: D; }'.
Property 'y' is missing in type '{}'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(49,4): error TS2345: Argument of type '{ y: number; }' is not assignable to parameter of type '{ y: D; }'.
@@ -63,6 +64,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(
!!! error TS2345: Argument of type '{ y: Class; }' is not assignable to parameter of type '{ y: D; }'.
!!! error TS2345: Types of property 'y' are incompatible.
!!! error TS2345: Type 'Class' is not assignable to type 'D'.
!!! error TS2345: Property 'foo' is missing in type 'Class'.
d3({});
~~
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type '{ y: D; }'.
@@ -1,5 +1,4 @@
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }'.
Property 'x' is missing in type 'Number'.
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected.
tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected.
@@ -8,7 +7,6 @@ tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Exp
var f: {
~
!!! error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }'.
!!! error TS2322: Property 'x' is missing in type 'Number'.
x: number;
<-
~
@@ -3,23 +3,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(29,9): error TS2322: Type 'E' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(30,9): error TS2322: Type 'E' is not assignable to type 'boolean'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(31,9): error TS2322: Type 'E' is not assignable to type 'Date'.
Property 'toDateString' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(33,9): error TS2322: Type 'E' is not assignable to type 'void'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(36,9): error TS2322: Type 'E' is not assignable to type '() => {}'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(37,9): error TS2322: Type 'E' is not assignable to type 'Function'.
Property 'apply' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(38,9): error TS2322: Type 'E' is not assignable to type '(x: number) => string'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(39,5): error TS2322: Type 'E' is not assignable to type 'C'.
Property 'foo' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(40,5): error TS2322: Type 'E' is not assignable to type 'I'.
Property 'foo' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(41,9): error TS2322: Type 'E' is not assignable to type 'number[]'.
Property 'length' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(42,9): error TS2322: Type 'E' is not assignable to type '{ foo: string; }'.
Property 'foo' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2322: Type 'E' is not assignable to type '<T>(x: T) => T'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String'.
Property 'charAt' is missing in type 'Number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(48,9): error TS2322: Type 'E' is not assignable to type 'T'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(49,9): error TS2322: Type 'E' is not assignable to type 'U'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(50,9): error TS2322: Type 'E' is not assignable to type 'V'.
@@ -69,7 +62,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
var ee: Date = e;
~~
!!! error TS2322: Type 'E' is not assignable to type 'Date'.
!!! error TS2322: Property 'toDateString' is missing in type 'Number'.
var f: any = e; // ok
var g: void = e;
~
@@ -82,26 +74,21 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
var k: Function = e;
~
!!! error TS2322: Type 'E' is not assignable to type 'Function'.
!!! error TS2322: Property 'apply' is missing in type 'Number'.
var l: (x: number) => string = e;
~
!!! error TS2322: Type 'E' is not assignable to type '(x: number) => string'.
ac = e;
~~
!!! error TS2322: Type 'E' is not assignable to type 'C'.
!!! error TS2322: Property 'foo' is missing in type 'Number'.
ai = e;
~~
!!! error TS2322: Type 'E' is not assignable to type 'I'.
!!! error TS2322: Property 'foo' is missing in type 'Number'.
var m: number[] = e;
~
!!! error TS2322: Type 'E' is not assignable to type 'number[]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
var n: { foo: string } = e;
~
!!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }'.
!!! error TS2322: Property 'foo' is missing in type 'Number'.
var o: <T>(x: T) => T = e;
~
!!! error TS2322: Type 'E' is not assignable to type '<T>(x: T) => T'.
@@ -109,7 +96,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
var q: String = e;
~
!!! error TS2322: Type 'E' is not assignable to type 'String'.
!!! error TS2322: Property 'charAt' is missing in type 'Number'.
function foo<T, U extends T, V extends Date, A extends Number, B extends E>(x: T, y: U, z: V) {
x = e;
@@ -1,9 +1,7 @@
tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W' is not assignable to type 'typeof W'.
Property 'D' is missing in type 'Number'.
tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type 'number' is not assignable to type 'typeof W'.
tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W' is not assignable to type 'WStatic'.
Property 'a' is missing in type 'Number'.
tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number' is not assignable to type 'WStatic'.
@@ -40,7 +38,6 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number'
var b: typeof W = W.a; // error
~
!!! error TS2322: Type 'W' is not assignable to type 'typeof W'.
!!! error TS2322: Property 'D' is missing in type 'Number'.
var c: typeof W.a = W.a;
var d: typeof W = 3; // error
~
@@ -49,7 +46,6 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number'
var f: WStatic = W.a; // error
~
!!! error TS2322: Type 'W' is not assignable to type 'WStatic'.
!!! error TS2322: Property 'a' is missing in type 'Number'.
var g: WStatic = 5; // error
~
!!! error TS2322: Type 'number' is not assignable to type 'WStatic'.
@@ -1,9 +1,7 @@
tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W' is not assignable to type 'typeof W'.
Property 'a' is missing in type 'Number'.
tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type 'number' is not assignable to type 'typeof W'.
tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W' is not assignable to type 'WStatic'.
Property 'a' is missing in type 'Number'.
tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number' is not assignable to type 'WStatic'.
@@ -39,7 +37,6 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number'
var b: typeof W = W.a; // error
~
!!! error TS2322: Type 'W' is not assignable to type 'typeof W'.
!!! error TS2322: Property 'a' is missing in type 'Number'.
var c: typeof W.a = W.a;
var d: typeof W = 3; // error
~
@@ -48,7 +45,6 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number'
var f: WStatic = W.a; // error
~
!!! error TS2322: Type 'W' is not assignable to type 'WStatic'.
!!! error TS2322: Property 'a' is missing in type 'Number'.
var g: WStatic = 5; // error
~
!!! error TS2322: Type 'number' is not assignable to type 'WStatic'.
@@ -1,7 +1,6 @@
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date'.
Property 'toDateString' is missing in type 'Number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type 'number' is not assignable to type 'void'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2322: Type 'D<{}>' is not assignable to type 'I'.
Property 'id' is missing in type 'D<{}>'.
@@ -76,7 +75,6 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
var aDate: Date = 9.9;
~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'Date'.
!!! error TS2322: Property 'toDateString' is missing in type 'Number'.
var aVoid: void = 9.9;
~~~~~
@@ -1,5 +1,4 @@
tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
Property 'a' is missing in type 'Boolean'.
==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ====
@@ -7,7 +6,6 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument o
var x = new foo(true); // Should error
~~~~
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
!!! error TS2345: Property 'a' is missing in type 'Boolean'.
var y = new foo({a: "test", b: 42}); // Should be OK
var z: number = y.test.b;
==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ====
@@ -1,6 +1,5 @@
tests/cases/compiler/functionCall7.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
Property 'a' is missing in type 'Number'.
tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
@@ -15,7 +14,6 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do
foo(4);
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
!!! error TS2345: Property 'a' is missing in type 'Number'.
foo();
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
@@ -1,5 +1,4 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
Property 'apply' is missing in type 'Number'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
@@ -20,9 +19,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
Type 'F2' provides no match for the signature '(x: string): string'
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
Type '() => void' is not assignable to type '(x: string) => string'.
Type 'void' is not assignable to type 'string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
Type 'T' is not assignable to type '(x: string) => string'.
Type '() => void' is not assignable to type '(x: string) => string'.
Type 'void' is not assignable to type 'string'.
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts (13 errors) ====
@@ -33,7 +34,6 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
foo(1);
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
!!! error TS2345: Property 'apply' is missing in type 'Number'.
foo(() => { }, 1);
~~~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
@@ -97,10 +97,12 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
~
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type '() => void' is not assignable to type '(x: string) => string'.
!!! error TS2345: Type 'void' is not assignable to type 'string'.
foo2(y);
~
!!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'T' is not assignable to type '(x: string) => string'.
!!! error TS2345: Type '() => void' is not assignable to type '(x: string) => string'.
!!! error TS2345: Type 'void' is not assignable to type 'string'.
}
@@ -1,5 +1,4 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
Property 'toDateString' is missing in type 'Number'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (1 errors) ====
@@ -16,5 +15,4 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon
var r4 = foo<Date, Date>(1); // error
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
!!! error TS2345: Property 'toDateString' is missing in type 'Number'.
var r5 = foo<Date, Date>(new Date()); // no error
@@ -1,6 +1,5 @@
tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
Type 'string' is not assignable to type 'Date'.
Property 'toDateString' is missing in type 'String'.
tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
Type 'string' is not assignable to type 'Date'.
@@ -24,7 +23,6 @@ tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of ty
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
!!! error TS2345: Property 'toDateString' is missing in type 'String'.
var r5b = _.map<number, string, Date>(c2, rf1);
~~~
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
@@ -1,7 +1,6 @@
tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts(11,1): error TS2322: Type 'B<number>' is not assignable to type 'A<{ length: number; foo: number; }>'.
Types of property 'x' are incompatible.
Type 'string' is not assignable to type '{ length: number; foo: number; }'.
Property 'foo' is missing in type 'String'.
==== tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts (1 errors) ====
@@ -20,5 +19,4 @@ tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts(11,1): error TS23
!!! error TS2322: Type 'B<number>' is not assignable to type 'A<{ length: number; foo: number; }>'.
!!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type '{ length: number; foo: number; }'.
!!! error TS2322: Property 'foo' is missing in type 'String'.
@@ -4,7 +4,6 @@ tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 's
tests/cases/compiler/genericRestArgs.ts(10,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/genericRestArgs.ts (4 errors) ====
@@ -29,5 +28,4 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '
var a2Gb = makeArrayG<any>(1, "");
var a2Gc = makeArrayG<any[]>(1, ""); // error
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
!!! error TS2345: Property 'length' is missing in type 'Number'.
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
@@ -0,0 +1,34 @@
//// [globalIsContextualKeyword.ts]
function a() {
let global = 1;
}
function b() {
class global {}
}
namespace global {
}
function foo(global: number) {
}
let obj = {
global: "123"
}
//// [globalIsContextualKeyword.js]
function a() {
var global = 1;
}
function b() {
var global = (function () {
function global() {
}
return global;
}());
}
function foo(global) {
}
var obj = {
global: "123"
};
@@ -0,0 +1,29 @@
=== tests/cases/compiler/globalIsContextualKeyword.ts ===
function a() {
>a : Symbol(a, Decl(globalIsContextualKeyword.ts, 0, 0))
let global = 1;
>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 1, 7))
}
function b() {
>b : Symbol(b, Decl(globalIsContextualKeyword.ts, 2, 1))
class global {}
>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 3, 14))
}
namespace global {
>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 5, 1))
}
function foo(global: number) {
>foo : Symbol(foo, Decl(globalIsContextualKeyword.ts, 8, 1))
>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 10, 13))
}
let obj = {
>obj : Symbol(obj, Decl(globalIsContextualKeyword.ts, 13, 3))
global: "123"
>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 13, 11))
}
@@ -0,0 +1,32 @@
=== tests/cases/compiler/globalIsContextualKeyword.ts ===
function a() {
>a : () => void
let global = 1;
>global : number
>1 : number
}
function b() {
>b : () => void
class global {}
>global : global
}
namespace global {
>global : any
}
function foo(global: number) {
>foo : (global: number) => void
>global : number
}
let obj = {
>obj : { global: string; }
>{ global: "123"} : { global: string; }
global: "123"
>global : string
>"123" : string
}
@@ -1,6 +1,6 @@
tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,20): error TS2307: Cannot find module 'externalModule'.
tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2664: Invalid module name in augmentation, module 'm1' cannot be found.
tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): error TS2307: Cannot find module 'externalModule'.
@@ -12,7 +12,7 @@ tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): er
!!! error TS2307: Cannot find module 'externalModule'.
declare module "m1" {
~~~~
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
!!! error TS2664: Invalid module name in augmentation, module 'm1' cannot be found.
import im2 = require("externalModule");
~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'externalModule'.
@@ -1,7 +1,6 @@
tests/cases/compiler/instanceSubtypeCheck2.ts(5,7): error TS2415: Class 'C2<T>' incorrectly extends base class 'C1<T>'.
Types of property 'x' are incompatible.
Type 'string' is not assignable to type 'C2<T>'.
Property 'x' is missing in type 'String'.
==== tests/cases/compiler/instanceSubtypeCheck2.ts (1 errors) ====
@@ -14,6 +13,5 @@ tests/cases/compiler/instanceSubtypeCheck2.ts(5,7): error TS2415: Class 'C2<T>'
!!! error TS2415: Class 'C2<T>' incorrectly extends base class 'C1<T>'.
!!! error TS2415: Types of property 'x' are incompatible.
!!! error TS2415: Type 'string' is not assignable to type 'C2<T>'.
!!! error TS2415: Property 'x' is missing in type 'String'.
x: string
}
Loaded 100 of 283 files, more files were not shown because too many files have changed in this diff. Show more