Merge branch 'master' into object-spread-rest-fixes

This commit is contained in:
Nathan Shively-Sanders
2016-11-15 11:19:01 -08:00
198 changed files with 76244 additions and 60805 deletions
-2
View File
@@ -39,5 +39,3 @@ function createCancellationToken(args) {
};
}
module.exports = createCancellationToken;
//# sourceMappingURL=cancellationToken.js.map
+14 -10
View File
@@ -5836,6 +5836,7 @@ interface CSSStyleDeclaration {
writingMode: string | null;
zIndex: string | null;
zoom: string | null;
resize: string | null;
getPropertyPriority(propertyName: string): string;
getPropertyValue(propertyName: string): string;
item(index: number): string;
@@ -5905,6 +5906,7 @@ declare var CanvasGradient: {
}
interface CanvasPattern {
setTransform(matrix: SVGMatrix): void;
}
declare var CanvasPattern: {
@@ -6330,7 +6332,7 @@ interface DataTransfer {
effectAllowed: string;
readonly files: FileList;
readonly items: DataTransferItemList;
readonly types: DOMStringList;
readonly types: string[];
clearData(format?: string): boolean;
getData(format: string): string;
setData(format: string, data: string): boolean;
@@ -12759,7 +12761,7 @@ interface MouseEvent extends UIEvent {
readonly x: number;
readonly y: number;
getModifierState(keyArg: string): boolean;
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;
}
declare var MouseEvent: {
@@ -12872,6 +12874,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
readonly plugins: PluginArray;
readonly pointerEnabled: boolean;
readonly webdriver: boolean;
readonly hardwareConcurrency: number;
getGamepads(): Gamepad[];
javaEnabled(): boolean;
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
@@ -12889,18 +12892,18 @@ interface Node extends EventTarget {
readonly attributes: NamedNodeMap;
readonly baseURI: string | null;
readonly childNodes: NodeList;
readonly firstChild: Node;
readonly lastChild: Node;
readonly firstChild: Node | null;
readonly lastChild: Node | null;
readonly localName: string | null;
readonly namespaceURI: string | null;
readonly nextSibling: Node;
readonly nextSibling: Node | null;
readonly nodeName: string;
readonly nodeType: number;
nodeValue: string | null;
readonly ownerDocument: Document;
readonly parentElement: HTMLElement;
readonly parentNode: Node;
readonly previousSibling: Node;
readonly parentElement: HTMLElement | null;
readonly parentNode: Node | null;
readonly previousSibling: Node | null;
textContent: string | null;
appendChild(newChild: Node): Node;
cloneNode(deep?: boolean): Node;
@@ -17010,7 +17013,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly devicePixelRatio: number;
readonly doNotTrack: string;
readonly document: Document;
event: Event;
event: Event | undefined;
readonly external: External;
readonly frameElement: Element;
readonly frames: Window;
@@ -17312,6 +17315,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
msCaching?: string;
readonly responseURL: string;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
@@ -18458,7 +18462,7 @@ declare var defaultStatus: string;
declare var devicePixelRatio: number;
declare var doNotTrack: string;
declare var document: Document;
declare var event: Event;
declare var event: Event | undefined;
declare var external: External;
declare var frameElement: Element;
declare var frames: Window;
+14 -10
View File
@@ -1699,6 +1699,7 @@ interface CSSStyleDeclaration {
writingMode: string | null;
zIndex: string | null;
zoom: string | null;
resize: string | null;
getPropertyPriority(propertyName: string): string;
getPropertyValue(propertyName: string): string;
item(index: number): string;
@@ -1768,6 +1769,7 @@ declare var CanvasGradient: {
}
interface CanvasPattern {
setTransform(matrix: SVGMatrix): void;
}
declare var CanvasPattern: {
@@ -2193,7 +2195,7 @@ interface DataTransfer {
effectAllowed: string;
readonly files: FileList;
readonly items: DataTransferItemList;
readonly types: DOMStringList;
readonly types: string[];
clearData(format?: string): boolean;
getData(format: string): string;
setData(format: string, data: string): boolean;
@@ -8622,7 +8624,7 @@ interface MouseEvent extends UIEvent {
readonly x: number;
readonly y: number;
getModifierState(keyArg: string): boolean;
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;
}
declare var MouseEvent: {
@@ -8735,6 +8737,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
readonly plugins: PluginArray;
readonly pointerEnabled: boolean;
readonly webdriver: boolean;
readonly hardwareConcurrency: number;
getGamepads(): Gamepad[];
javaEnabled(): boolean;
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
@@ -8752,18 +8755,18 @@ interface Node extends EventTarget {
readonly attributes: NamedNodeMap;
readonly baseURI: string | null;
readonly childNodes: NodeList;
readonly firstChild: Node;
readonly lastChild: Node;
readonly firstChild: Node | null;
readonly lastChild: Node | null;
readonly localName: string | null;
readonly namespaceURI: string | null;
readonly nextSibling: Node;
readonly nextSibling: Node | null;
readonly nodeName: string;
readonly nodeType: number;
nodeValue: string | null;
readonly ownerDocument: Document;
readonly parentElement: HTMLElement;
readonly parentNode: Node;
readonly previousSibling: Node;
readonly parentElement: HTMLElement | null;
readonly parentNode: Node | null;
readonly previousSibling: Node | null;
textContent: string | null;
appendChild(newChild: Node): Node;
cloneNode(deep?: boolean): Node;
@@ -12873,7 +12876,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly devicePixelRatio: number;
readonly doNotTrack: string;
readonly document: Document;
event: Event;
event: Event | undefined;
readonly external: External;
readonly frameElement: Element;
readonly frames: Window;
@@ -13175,6 +13178,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
msCaching?: string;
readonly responseURL: string;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
@@ -14321,7 +14325,7 @@ declare var defaultStatus: string;
declare var devicePixelRatio: number;
declare var doNotTrack: string;
declare var document: Document;
declare var event: Event;
declare var event: Event | undefined;
declare var external: External;
declare var frameElement: Element;
declare var frames: Window;
+4 -4
View File
@@ -225,13 +225,13 @@ interface NumberConstructor {
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
isFinite(number: number): boolean;
isFinite(value: any): value is number;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
isInteger(value: any): value is number;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
@@ -239,13 +239,13 @@ interface NumberConstructor {
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
isNaN(number: number): boolean;
isNaN(value: any): value is number;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
isSafeInteger(number: number): boolean;
isSafeInteger(value: any): value is number;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
+3 -3
View File
@@ -19,7 +19,7 @@ and limitations under the License.
interface ProxyHandler<T> {
getPrototypeOf? (target: T): any;
getPrototypeOf? (target: T): {} | null;
setPrototypeOf? (target: T, v: any): boolean;
isExtensible? (target: T): boolean;
preventExtensions? (target: T): boolean;
@@ -32,11 +32,11 @@ interface ProxyHandler<T> {
enumerate? (target: T): PropertyKey[];
ownKeys? (target: T): PropertyKey[];
apply? (target: T, thisArg: any, argArray?: any): any;
construct? (target: T, thisArg: any, argArray?: any): any;
construct? (target: T, argArray: any, newTarget?: any): {};
}
interface ProxyConstructor {
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T>(target: T, handler: ProxyHandler<T>): T
}
declare var Proxy: ProxyConstructor;
declare var Proxy: ProxyConstructor;
+2 -1
View File
@@ -20,4 +20,5 @@ and limitations under the License.
/// <reference path="lib.es2016.d.ts" />
/// <reference path="lib.es2017.object.d.ts" />
/// <reference path="lib.es2017.sharedmemory.d.ts" />
/// <reference path="lib.es2017.sharedmemory.d.ts" />
/// <reference path="lib.es2017.string.d.ts" />
+2 -2
View File
@@ -29,6 +29,6 @@ interface ObjectConstructor {
* Returns an array of key/values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
entries<T>(o: { [s: string]: T }): [string, T][];
entries<T extends { [key: string]: any }, K extends keyof T>(o: T): [keyof T, T[K]][];
entries(o: any): [string, any][];
}
}
+47
View File
@@ -0,0 +1,47 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/**
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
* The padding is applied from the start (left) of the current string.
*
* @param maxLength The length of the resulting string once the current string has been padded.
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
*
* @param fillString The string to pad the current string with.
* If this string is too long, it will be truncated and the left-most part will be applied.
* The default value for this parameter is " " (U+0020).
*/
padStart(maxLength: number, fillString?: string): string;
/**
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
* The padding is applied from the end (right) of the current string.
*
* @param maxLength The length of the resulting string once the current string has been padded.
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
*
* @param fillString The string to pad the current string with.
* If this string is too long, it will be truncated and the left-most part will be applied.
* The default value for this parameter is " " (U+0020).
*/
padEnd(maxLength: number, fillString?: string): string;
}
+22 -17
View File
@@ -4362,13 +4362,13 @@ interface NumberConstructor {
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
isFinite(number: number): boolean;
isFinite(value: any): value is number;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
isInteger(value: any): value is number;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
@@ -4376,13 +4376,13 @@ interface NumberConstructor {
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
isNaN(number: number): boolean;
isNaN(value: any): value is number;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
isSafeInteger(number: number): boolean;
isSafeInteger(value: any): value is number;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
@@ -5471,7 +5471,7 @@ interface PromiseConstructor {
declare var Promise: PromiseConstructor;
interface ProxyHandler<T> {
getPrototypeOf? (target: T): any;
getPrototypeOf? (target: T): {} | null;
setPrototypeOf? (target: T, v: any): boolean;
isExtensible? (target: T): boolean;
preventExtensions? (target: T): boolean;
@@ -5484,14 +5484,15 @@ interface ProxyHandler<T> {
enumerate? (target: T): PropertyKey[];
ownKeys? (target: T): PropertyKey[];
apply? (target: T, thisArg: any, argArray?: any): any;
construct? (target: T, thisArg: any, argArray?: any): any;
construct? (target: T, argArray: any, newTarget?: any): {};
}
interface ProxyConstructor {
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T>(target: T, handler: ProxyHandler<T>): T
}
declare var Proxy: ProxyConstructor;
declare var Proxy: ProxyConstructor;
declare namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
@@ -7555,6 +7556,7 @@ interface CSSStyleDeclaration {
writingMode: string | null;
zIndex: string | null;
zoom: string | null;
resize: string | null;
getPropertyPriority(propertyName: string): string;
getPropertyValue(propertyName: string): string;
item(index: number): string;
@@ -7624,6 +7626,7 @@ declare var CanvasGradient: {
}
interface CanvasPattern {
setTransform(matrix: SVGMatrix): void;
}
declare var CanvasPattern: {
@@ -8049,7 +8052,7 @@ interface DataTransfer {
effectAllowed: string;
readonly files: FileList;
readonly items: DataTransferItemList;
readonly types: DOMStringList;
readonly types: string[];
clearData(format?: string): boolean;
getData(format: string): string;
setData(format: string, data: string): boolean;
@@ -14478,7 +14481,7 @@ interface MouseEvent extends UIEvent {
readonly x: number;
readonly y: number;
getModifierState(keyArg: string): boolean;
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;
}
declare var MouseEvent: {
@@ -14591,6 +14594,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
readonly plugins: PluginArray;
readonly pointerEnabled: boolean;
readonly webdriver: boolean;
readonly hardwareConcurrency: number;
getGamepads(): Gamepad[];
javaEnabled(): boolean;
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
@@ -14608,18 +14612,18 @@ interface Node extends EventTarget {
readonly attributes: NamedNodeMap;
readonly baseURI: string | null;
readonly childNodes: NodeList;
readonly firstChild: Node;
readonly lastChild: Node;
readonly firstChild: Node | null;
readonly lastChild: Node | null;
readonly localName: string | null;
readonly namespaceURI: string | null;
readonly nextSibling: Node;
readonly nextSibling: Node | null;
readonly nodeName: string;
readonly nodeType: number;
nodeValue: string | null;
readonly ownerDocument: Document;
readonly parentElement: HTMLElement;
readonly parentNode: Node;
readonly previousSibling: Node;
readonly parentElement: HTMLElement | null;
readonly parentNode: Node | null;
readonly previousSibling: Node | null;
textContent: string | null;
appendChild(newChild: Node): Node;
cloneNode(deep?: boolean): Node;
@@ -18729,7 +18733,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly devicePixelRatio: number;
readonly doNotTrack: string;
readonly document: Document;
event: Event;
event: Event | undefined;
readonly external: External;
readonly frameElement: Element;
readonly frames: Window;
@@ -19031,6 +19035,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
msCaching?: string;
readonly responseURL: string;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
@@ -20177,7 +20182,7 @@ declare var defaultStatus: string;
declare var devicePixelRatio: number;
declare var doNotTrack: string;
declare var document: Document;
declare var event: Event;
declare var event: Event | undefined;
declare var external: External;
declare var frameElement: Element;
declare var frames: Window;
+2
View File
@@ -760,6 +760,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
msCaching?: string;
readonly responseURL: string;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
@@ -922,6 +923,7 @@ declare var WorkerLocation: {
}
interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine {
readonly hardwareConcurrency: number;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
+168 -205
View File
@@ -59,7 +59,7 @@ declare namespace ts.server.protocol {
/**
* One of "request", "response", or "event"
*/
type: string;
type: "request" | "response" | "event";
}
/**
* Client-initiated request message
@@ -653,7 +653,7 @@ declare namespace ts.server.protocol {
/**
* Script kind of the file
*/
scriptKind?: ScriptKind;
scriptKind?: ScriptKindName | ts.ScriptKind;
/**
* Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
*/
@@ -684,37 +684,17 @@ declare namespace ts.server.protocol {
*/
typingOptions?: TypingOptions;
}
/**
* For external projects, some of the project settings are sent together with
* compiler settings.
*/
interface ExternalProjectCompilerOptions extends CompilerOptions {
interface CompileOnSaveMixin {
/**
* If compile on save is enabled for the project
*/
compileOnSave?: boolean;
}
/**
* Contains information about current project version
* For external projects, some of the project settings are sent together with
* compiler settings.
*/
interface ProjectVersionInfo {
/**
* Project name
*/
projectName: string;
/**
* true if project is inferred or false if project is external or configured
*/
isInferred: boolean;
/**
* Project version
*/
version: number;
/**
* Current set of compiler options for project
*/
options: CompilerOptions;
}
type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin;
/**
* Represents a set of changes that happen in project
*/
@@ -728,36 +708,6 @@ declare namespace ts.server.protocol {
*/
removed: string[];
}
/**
* Describes set of files in the project.
* info might be omitted in case of inferred projects
* if files is set - then this is the entire set of files in the project
* if changes is set - then this is the set of changes that should be applied to existing project
* otherwise - assume that nothing is changed
*/
interface ProjectFiles {
/**
* Information abount project verison
*/
info?: ProjectVersionInfo;
/**
* List of files in project (might be omitted if current state of project can be computed using only information from 'changes')
*/
files?: string[];
/**
* Set of changes in project (omitted if the entire set of files in project should be replaced)
*/
changes?: ProjectChanges;
}
/**
* Combines project information with project level errors.
*/
interface ProjectFilesWithDiagnostics extends ProjectFiles {
/**
* List of errors in project
*/
projectErrors: DiagnosticWithLinePosition[];
}
/**
* Information found in a configure request.
*/
@@ -803,8 +753,9 @@ declare namespace ts.server.protocol {
* Used to specify the script kind of the file explicitly. It could be one of the following:
* "TS", "JS", "TSX", "JSX"
*/
scriptKindName?: "TS" | "JS" | "TSX" | "JSX";
scriptKindName?: ScriptKindName;
}
type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
/**
* Open request; value of command field is "open". Notify the
* server that the client has file open. The server will not
@@ -878,15 +829,6 @@ declare namespace ts.server.protocol {
*/
interface CloseExternalProjectResponse extends Response {
}
/**
* Arguments to SynchronizeProjectListRequest
*/
interface SynchronizeProjectListRequestArgs {
/**
* List of last known projects
*/
knownProjects: protocol.ProjectVersionInfo[];
}
/**
* Request to set compiler options for inferred projects.
* External projects are opened / closed explicitly.
@@ -1669,12 +1611,158 @@ declare namespace ts.server.protocol {
spans: TextSpan[];
childItems?: NavigationTree[];
}
type TelemetryEventName = "telemetry";
interface TelemetryEvent extends Event {
event: TelemetryEventName;
body: TelemetryEventBody;
}
interface TelemetryEventBody {
telemetryEventName: string;
payload: any;
}
type TypingsInstalledTelemetryEventName = "typingsInstalled";
interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
telemetryEventName: TypingsInstalledTelemetryEventName;
payload: TypingsInstalledTelemetryEventPayload;
}
interface TypingsInstalledTelemetryEventPayload {
/**
* Comma separated list of installed typing packages
*/
installedPackages: string;
/**
* true if install request succeeded, otherwise - false
*/
installSuccess: boolean;
}
interface NavBarResponse extends Response {
body?: NavigationBarItem[];
}
interface NavTreeResponse extends Response {
body?: NavigationTree;
}
namespace IndentStyle {
type None = "None";
type Block = "Block";
type Smart = "Smart";
}
type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart;
interface EditorSettings {
baseIndentSize?: number;
indentSize?: number;
tabSize?: number;
newLineCharacter?: string;
convertTabsToSpaces?: boolean;
indentStyle?: IndentStyle | ts.IndentStyle;
}
interface FormatCodeSettings extends EditorSettings {
insertSpaceAfterCommaDelimiter?: boolean;
insertSpaceAfterSemicolonInForStatements?: boolean;
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
placeOpenBraceOnNewLineForFunctions?: boolean;
placeOpenBraceOnNewLineForControlBlocks?: boolean;
}
interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
baseUrl?: string;
charset?: string;
declaration?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
inlineSourceMap?: boolean;
inlineSources?: boolean;
isolatedModules?: boolean;
jsx?: JsxEmit | ts.JsxEmit;
lib?: string[];
locale?: string;
mapRoot?: string;
maxNodeModuleJsDepth?: number;
module?: ModuleKind | ts.ModuleKind;
moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
newLine?: NewLineKind | ts.NewLineKind;
noEmit?: boolean;
noEmitHelpers?: boolean;
noEmitOnError?: boolean;
noErrorTruncation?: boolean;
noFallthroughCasesInSwitch?: boolean;
noImplicitAny?: boolean;
noImplicitReturns?: boolean;
noImplicitThis?: boolean;
noUnusedLocals?: boolean;
noUnusedParameters?: boolean;
noImplicitUseStrict?: boolean;
noLib?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
outFile?: string;
paths?: MapLike<string[]>;
preserveConstEnums?: boolean;
project?: string;
reactNamespace?: string;
removeComments?: boolean;
rootDir?: string;
rootDirs?: string[];
skipLibCheck?: boolean;
skipDefaultLibCheck?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
strictNullChecks?: boolean;
suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget | ts.ScriptTarget;
traceResolution?: boolean;
types?: string[];
/** Paths used to used to compute primary types search locations */
typeRoots?: string[];
[option: string]: CompilerOptionsValue | undefined;
}
namespace JsxEmit {
type None = "None";
type Preserve = "Preserve";
type React = "React";
}
type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React;
namespace ModuleKind {
type None = "None";
type CommonJS = "CommonJS";
type AMD = "AMD";
type UMD = "UMD";
type System = "System";
type ES6 = "ES6";
type ES2015 = "ES2015";
}
type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015;
namespace ModuleResolutionKind {
type Classic = "Classic";
type Node = "Node";
}
type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node;
namespace NewLineKind {
type Crlf = "Crlf";
type Lf = "Lf";
}
type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf;
namespace ScriptTarget {
type ES3 = "ES3";
type ES5 = "ES5";
type ES6 = "ES6";
type ES2015 = "ES2015";
}
type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015;
}
declare namespace ts.server.protocol {
@@ -1695,29 +1783,6 @@ declare namespace ts.server.protocol {
position: number;
}
interface EditorSettings {
baseIndentSize?: number;
indentSize?: number;
tabSize?: number;
newLineCharacter?: string;
convertTabsToSpaces?: boolean;
indentStyle?: IndentStyle;
}
enum IndentStyle {
None = 0,
Block = 1,
Smart = 2,
}
enum ScriptKind {
Unknown = 0,
JS = 1,
JSX = 2,
TS = 3,
TSX = 4,
}
interface TypingOptions {
enableAutoDiscovery?: boolean;
include?: string[];
@@ -1725,124 +1790,22 @@ declare namespace ts.server.protocol {
[option: string]: string[] | boolean | undefined;
}
interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
baseUrl?: string;
charset?: string;
declaration?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
importHelpers?: boolean;
inlineSourceMap?: boolean;
inlineSources?: boolean;
isolatedModules?: boolean;
jsx?: JsxEmit;
lib?: string[];
locale?: string;
mapRoot?: string;
maxNodeModuleJsDepth?: number;
module?: ModuleKind;
moduleResolution?: ModuleResolutionKind;
newLine?: NewLineKind;
noEmit?: boolean;
noEmitHelpers?: boolean;
noEmitOnError?: boolean;
noErrorTruncation?: boolean;
noFallthroughCasesInSwitch?: boolean;
noImplicitAny?: boolean;
noImplicitReturns?: boolean;
noImplicitThis?: boolean;
noUnusedLocals?: boolean;
noUnusedParameters?: boolean;
noImplicitUseStrict?: boolean;
noLib?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
outFile?: string;
paths?: MapLike<string[]>;
preserveConstEnums?: boolean;
project?: string;
reactNamespace?: string;
removeComments?: boolean;
rootDir?: string;
rootDirs?: string[];
skipLibCheck?: boolean;
skipDefaultLibCheck?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
strictNullChecks?: boolean;
suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget;
traceResolution?: boolean;
types?: string[];
/** Paths used to used to compute primary types search locations */
typeRoots?: string[];
[option: string]: CompilerOptionsValue | undefined;
}
enum JsxEmit {
None = 0,
Preserve = 1,
React = 2,
}
enum ModuleKind {
None = 0,
CommonJS = 1,
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
ES2015 = 5,
}
enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2,
}
enum NewLineKind {
CarriageReturnLineFeed = 0,
LineFeed = 1,
}
interface MapLike<T> {
[index: string]: T;
}
enum ScriptTarget {
ES3 = 0,
ES5 = 1,
ES6 = 2,
ES2015 = 2,
Latest = 2,
}
type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]>;
interface FormatCodeSettings extends EditorSettings {
insertSpaceAfterCommaDelimiter?: boolean;
insertSpaceAfterSemicolonInForStatements?: boolean;
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
insertSpaceAfterTypeAssertion?: boolean;
placeOpenBraceOnNewLineForFunctions?: boolean;
placeOpenBraceOnNewLineForControlBlocks?: boolean;
}
}
}
declare namespace ts {
// these types are empty stubs for types from services and should not be used directly
export type ScriptKind = never;
export type IndentStyle = never;
export type JsxEmit = never;
export type ModuleKind = never;
export type ModuleResolutionKind = never;
export type NewLineKind = never;
export type ScriptTarget = never;
}
import protocol = ts.server.protocol;
export = protocol;
export as namespace protocol;
+8486 -7770
View File
File diff suppressed because it is too large Load Diff
+15250 -14407
View File
File diff suppressed because it is too large Load Diff
+8577 -1127
View File
File diff suppressed because one or more lines are too long
+15163 -14382
View File
File diff suppressed because it is too large Load Diff
+323 -213
View File
@@ -163,170 +163,177 @@ declare namespace ts {
DeclareKeyword = 123,
GetKeyword = 124,
IsKeyword = 125,
ModuleKeyword = 126,
NamespaceKeyword = 127,
NeverKeyword = 128,
ReadonlyKeyword = 129,
RequireKeyword = 130,
NumberKeyword = 131,
SetKeyword = 132,
StringKeyword = 133,
SymbolKeyword = 134,
TypeKeyword = 135,
UndefinedKeyword = 136,
FromKeyword = 137,
GlobalKeyword = 138,
OfKeyword = 139,
QualifiedName = 140,
ComputedPropertyName = 141,
TypeParameter = 142,
Parameter = 143,
Decorator = 144,
PropertySignature = 145,
PropertyDeclaration = 146,
MethodSignature = 147,
MethodDeclaration = 148,
Constructor = 149,
GetAccessor = 150,
SetAccessor = 151,
CallSignature = 152,
ConstructSignature = 153,
IndexSignature = 154,
TypePredicate = 155,
TypeReference = 156,
FunctionType = 157,
ConstructorType = 158,
TypeQuery = 159,
TypeLiteral = 160,
ArrayType = 161,
TupleType = 162,
UnionType = 163,
IntersectionType = 164,
ParenthesizedType = 165,
ThisType = 166,
LiteralType = 167,
ObjectBindingPattern = 168,
ArrayBindingPattern = 169,
BindingElement = 170,
ArrayLiteralExpression = 171,
ObjectLiteralExpression = 172,
PropertyAccessExpression = 173,
ElementAccessExpression = 174,
CallExpression = 175,
NewExpression = 176,
TaggedTemplateExpression = 177,
TypeAssertionExpression = 178,
ParenthesizedExpression = 179,
FunctionExpression = 180,
ArrowFunction = 181,
DeleteExpression = 182,
TypeOfExpression = 183,
VoidExpression = 184,
AwaitExpression = 185,
PrefixUnaryExpression = 186,
PostfixUnaryExpression = 187,
BinaryExpression = 188,
ConditionalExpression = 189,
TemplateExpression = 190,
YieldExpression = 191,
SpreadElementExpression = 192,
ClassExpression = 193,
OmittedExpression = 194,
ExpressionWithTypeArguments = 195,
AsExpression = 196,
NonNullExpression = 197,
TemplateSpan = 198,
SemicolonClassElement = 199,
Block = 200,
VariableStatement = 201,
EmptyStatement = 202,
ExpressionStatement = 203,
IfStatement = 204,
DoStatement = 205,
WhileStatement = 206,
ForStatement = 207,
ForInStatement = 208,
ForOfStatement = 209,
ContinueStatement = 210,
BreakStatement = 211,
ReturnStatement = 212,
WithStatement = 213,
SwitchStatement = 214,
LabeledStatement = 215,
ThrowStatement = 216,
TryStatement = 217,
DebuggerStatement = 218,
VariableDeclaration = 219,
VariableDeclarationList = 220,
FunctionDeclaration = 221,
ClassDeclaration = 222,
InterfaceDeclaration = 223,
TypeAliasDeclaration = 224,
EnumDeclaration = 225,
ModuleDeclaration = 226,
ModuleBlock = 227,
CaseBlock = 228,
NamespaceExportDeclaration = 229,
ImportEqualsDeclaration = 230,
ImportDeclaration = 231,
ImportClause = 232,
NamespaceImport = 233,
NamedImports = 234,
ImportSpecifier = 235,
ExportAssignment = 236,
ExportDeclaration = 237,
NamedExports = 238,
ExportSpecifier = 239,
MissingDeclaration = 240,
ExternalModuleReference = 241,
JsxElement = 242,
JsxSelfClosingElement = 243,
JsxOpeningElement = 244,
JsxClosingElement = 245,
JsxAttribute = 246,
JsxSpreadAttribute = 247,
JsxExpression = 248,
CaseClause = 249,
DefaultClause = 250,
HeritageClause = 251,
CatchClause = 252,
PropertyAssignment = 253,
ShorthandPropertyAssignment = 254,
EnumMember = 255,
SourceFile = 256,
JSDocTypeExpression = 257,
JSDocAllType = 258,
JSDocUnknownType = 259,
JSDocArrayType = 260,
JSDocUnionType = 261,
JSDocTupleType = 262,
JSDocNullableType = 263,
JSDocNonNullableType = 264,
JSDocRecordType = 265,
JSDocRecordMember = 266,
JSDocTypeReference = 267,
JSDocOptionalType = 268,
JSDocFunctionType = 269,
JSDocVariadicType = 270,
JSDocConstructorType = 271,
JSDocThisType = 272,
JSDocComment = 273,
JSDocTag = 274,
JSDocParameterTag = 275,
JSDocReturnTag = 276,
JSDocTypeTag = 277,
JSDocTemplateTag = 278,
JSDocTypedefTag = 279,
JSDocPropertyTag = 280,
JSDocTypeLiteral = 281,
JSDocLiteralType = 282,
JSDocNullKeyword = 283,
JSDocUndefinedKeyword = 284,
JSDocNeverKeyword = 285,
SyntaxList = 286,
NotEmittedStatement = 287,
PartiallyEmittedExpression = 288,
Count = 289,
KeyOfKeyword = 126,
ModuleKeyword = 127,
NamespaceKeyword = 128,
NeverKeyword = 129,
ReadonlyKeyword = 130,
RequireKeyword = 131,
NumberKeyword = 132,
SetKeyword = 133,
StringKeyword = 134,
SymbolKeyword = 135,
TypeKeyword = 136,
UndefinedKeyword = 137,
FromKeyword = 138,
GlobalKeyword = 139,
OfKeyword = 140,
QualifiedName = 141,
ComputedPropertyName = 142,
TypeParameter = 143,
Parameter = 144,
Decorator = 145,
PropertySignature = 146,
PropertyDeclaration = 147,
MethodSignature = 148,
MethodDeclaration = 149,
Constructor = 150,
GetAccessor = 151,
SetAccessor = 152,
CallSignature = 153,
ConstructSignature = 154,
IndexSignature = 155,
TypePredicate = 156,
TypeReference = 157,
FunctionType = 158,
ConstructorType = 159,
TypeQuery = 160,
TypeLiteral = 161,
ArrayType = 162,
TupleType = 163,
UnionType = 164,
IntersectionType = 165,
ParenthesizedType = 166,
ThisType = 167,
TypeOperator = 168,
IndexedAccessType = 169,
MappedType = 170,
LiteralType = 171,
ObjectBindingPattern = 172,
ArrayBindingPattern = 173,
BindingElement = 174,
ArrayLiteralExpression = 175,
ObjectLiteralExpression = 176,
PropertyAccessExpression = 177,
ElementAccessExpression = 178,
CallExpression = 179,
NewExpression = 180,
TaggedTemplateExpression = 181,
TypeAssertionExpression = 182,
ParenthesizedExpression = 183,
FunctionExpression = 184,
ArrowFunction = 185,
DeleteExpression = 186,
TypeOfExpression = 187,
VoidExpression = 188,
AwaitExpression = 189,
PrefixUnaryExpression = 190,
PostfixUnaryExpression = 191,
BinaryExpression = 192,
ConditionalExpression = 193,
TemplateExpression = 194,
YieldExpression = 195,
SpreadElement = 196,
ClassExpression = 197,
OmittedExpression = 198,
ExpressionWithTypeArguments = 199,
AsExpression = 200,
NonNullExpression = 201,
TemplateSpan = 202,
SemicolonClassElement = 203,
Block = 204,
VariableStatement = 205,
EmptyStatement = 206,
ExpressionStatement = 207,
IfStatement = 208,
DoStatement = 209,
WhileStatement = 210,
ForStatement = 211,
ForInStatement = 212,
ForOfStatement = 213,
ContinueStatement = 214,
BreakStatement = 215,
ReturnStatement = 216,
WithStatement = 217,
SwitchStatement = 218,
LabeledStatement = 219,
ThrowStatement = 220,
TryStatement = 221,
DebuggerStatement = 222,
VariableDeclaration = 223,
VariableDeclarationList = 224,
FunctionDeclaration = 225,
ClassDeclaration = 226,
InterfaceDeclaration = 227,
TypeAliasDeclaration = 228,
EnumDeclaration = 229,
ModuleDeclaration = 230,
ModuleBlock = 231,
CaseBlock = 232,
NamespaceExportDeclaration = 233,
ImportEqualsDeclaration = 234,
ImportDeclaration = 235,
ImportClause = 236,
NamespaceImport = 237,
NamedImports = 238,
ImportSpecifier = 239,
ExportAssignment = 240,
ExportDeclaration = 241,
NamedExports = 242,
ExportSpecifier = 243,
MissingDeclaration = 244,
ExternalModuleReference = 245,
JsxElement = 246,
JsxSelfClosingElement = 247,
JsxOpeningElement = 248,
JsxClosingElement = 249,
JsxAttribute = 250,
JsxSpreadAttribute = 251,
JsxExpression = 252,
CaseClause = 253,
DefaultClause = 254,
HeritageClause = 255,
CatchClause = 256,
PropertyAssignment = 257,
ShorthandPropertyAssignment = 258,
SpreadAssignment = 259,
EnumMember = 260,
SourceFile = 261,
JSDocTypeExpression = 262,
JSDocAllType = 263,
JSDocUnknownType = 264,
JSDocArrayType = 265,
JSDocUnionType = 266,
JSDocTupleType = 267,
JSDocNullableType = 268,
JSDocNonNullableType = 269,
JSDocRecordType = 270,
JSDocRecordMember = 271,
JSDocTypeReference = 272,
JSDocOptionalType = 273,
JSDocFunctionType = 274,
JSDocVariadicType = 275,
JSDocConstructorType = 276,
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
JSDocParameterTag = 280,
JSDocReturnTag = 281,
JSDocTypeTag = 282,
JSDocTemplateTag = 283,
JSDocTypedefTag = 284,
JSDocPropertyTag = 285,
JSDocTypeLiteral = 286,
JSDocLiteralType = 287,
JSDocNullKeyword = 288,
JSDocUndefinedKeyword = 289,
JSDocNeverKeyword = 290,
SyntaxList = 291,
NotEmittedStatement = 292,
PartiallyEmittedExpression = 293,
MergeDeclarationMarker = 294,
EndOfDeclarationMarker = 295,
Count = 296,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
@@ -334,15 +341,15 @@ declare namespace ts {
FirstReservedWord = 71,
LastReservedWord = 106,
FirstKeyword = 71,
LastKeyword = 139,
LastKeyword = 140,
FirstFutureReservedWord = 107,
LastFutureReservedWord = 115,
FirstTypeNode = 155,
LastTypeNode = 167,
FirstTypeNode = 156,
LastTypeNode = 171,
FirstPunctuation = 16,
LastPunctuation = 69,
FirstToken = 0,
LastToken = 139,
LastToken = 140,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -351,11 +358,11 @@ declare namespace ts {
LastTemplateToken = 15,
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
FirstNode = 140,
FirstJSDocNode = 257,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
LastJSDocTagNode = 285,
FirstNode = 141,
FirstJSDocNode = 262,
LastJSDocNode = 287,
FirstJSDocTagNode = 278,
LastJSDocTagNode = 290,
}
enum NodeFlags {
None = 0,
@@ -373,21 +380,22 @@ declare namespace ts {
HasDecorators = 2048,
HasParamDecorators = 4096,
HasAsyncFunctions = 8192,
HasJsxSpreadAttributes = 16384,
DisallowInContext = 32768,
YieldContext = 65536,
DecoratorContext = 131072,
AwaitContext = 262144,
ThisNodeHasError = 524288,
JavaScriptFile = 1048576,
ThisNodeOrAnySubNodesHasError = 2097152,
HasAggregatedChildData = 4194304,
HasSpreadAttribute = 16384,
HasRestAttribute = 32768,
DisallowInContext = 65536,
YieldContext = 131072,
DecoratorContext = 262144,
AwaitContext = 524288,
ThisNodeHasError = 1048576,
JavaScriptFile = 2097152,
ThisNodeOrAnySubNodesHasError = 4194304,
HasAggregatedChildData = 8388608,
BlockScoped = 3,
ReachabilityCheckFlags = 384,
EmitHelperFlags = 31744,
ReachabilityAndEmitFlags = 32128,
ContextFlags = 1540096,
TypeExcludesFlags = 327680,
EmitHelperFlags = 64512,
ReachabilityAndEmitFlags = 64896,
ContextFlags = 3080192,
TypeExcludesFlags = 655360,
}
enum ModifierFlags {
None = 0,
@@ -407,6 +415,7 @@ declare namespace ts {
ParameterPropertyModifier = 92,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
ExportDefault = 513,
}
enum JsxFlags {
None = 0,
@@ -437,12 +446,14 @@ declare namespace ts {
type EqualsGreaterThanToken = Token<SyntaxKind.EqualsGreaterThanToken>;
type EndOfFileToken = Token<SyntaxKind.EndOfFileToken>;
type AtToken = Token<SyntaxKind.AtToken>;
type ReadonlyToken = Token<SyntaxKind.ReadonlyKeyword>;
type Modifier = Token<SyntaxKind.AbstractKeyword> | Token<SyntaxKind.AsyncKeyword> | Token<SyntaxKind.ConstKeyword> | Token<SyntaxKind.DeclareKeyword> | Token<SyntaxKind.DefaultKeyword> | Token<SyntaxKind.ExportKeyword> | Token<SyntaxKind.PublicKeyword> | Token<SyntaxKind.PrivateKeyword> | Token<SyntaxKind.ProtectedKeyword> | Token<SyntaxKind.ReadonlyKeyword> | Token<SyntaxKind.StaticKeyword>;
type ModifiersArray = NodeArray<Modifier>;
interface Identifier extends PrimaryExpression {
kind: SyntaxKind.Identifier;
text: string;
originalKeywordKind?: SyntaxKind;
isInJSDocNamespace?: boolean;
}
interface TransientIdentifier extends Identifier {
resolvedSymbol: Symbol;
@@ -533,7 +544,7 @@ declare namespace ts {
_objectLiteralBrandBrand: any;
name?: PropertyName;
}
type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration;
type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment;
interface PropertyAssignment extends ObjectLiteralElement {
kind: SyntaxKind.PropertyAssignment;
name: PropertyName;
@@ -547,6 +558,10 @@ declare namespace ts {
equalsToken?: Token<SyntaxKind.EqualsToken>;
objectAssignmentInitializer?: Expression;
}
interface SpreadAssignment extends ObjectLiteralElement {
kind: SyntaxKind.SpreadAssignment;
expression: Expression;
}
interface VariableLikeDeclaration extends Declaration {
propertyName?: PropertyName;
dotDotDotToken?: DotDotDotToken;
@@ -677,6 +692,23 @@ declare namespace ts {
kind: SyntaxKind.ParenthesizedType;
type: TypeNode;
}
interface TypeOperatorNode extends TypeNode {
kind: SyntaxKind.TypeOperator;
operator: SyntaxKind.KeyOfKeyword;
type: TypeNode;
}
interface IndexedAccessTypeNode extends TypeNode {
kind: SyntaxKind.IndexedAccessType;
objectType: TypeNode;
indexType: TypeNode;
}
interface MappedTypeNode extends TypeNode, Declaration {
kind: SyntaxKind.MappedType;
readonlyToken?: ReadonlyToken;
typeParameter: TypeParameterDeclaration;
questionToken?: QuestionToken;
type?: TypeNode;
}
interface LiteralTypeNode extends TypeNode {
kind: SyntaxKind.LiteralType;
literal: Expression;
@@ -709,9 +741,6 @@ declare namespace ts {
operand: LeftHandSideExpression;
operator: PostfixUnaryOperator;
}
interface PostfixExpression extends UnaryExpression {
_postfixExpressionBrand: any;
}
interface LeftHandSideExpression extends IncrementExpression {
_leftHandSideExpressionBrand: any;
}
@@ -780,6 +809,17 @@ declare namespace ts {
operatorToken: BinaryOperatorToken;
right: Expression;
}
interface AssignmentExpression extends BinaryExpression {
left: LeftHandSideExpression;
operatorToken: Token<SyntaxKind.EqualsToken>;
}
interface ObjectDestructuringAssignment extends AssignmentExpression {
left: ObjectLiteralExpression;
}
interface ArrayDestructuringAssignment extends AssignmentExpression {
left: ArrayLiteralExpression;
}
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
interface ConditionalExpression extends Expression {
kind: SyntaxKind.ConditionalExpression;
condition: Expression;
@@ -846,8 +886,8 @@ declare namespace ts {
kind: SyntaxKind.ArrayLiteralExpression;
elements: NodeArray<Expression>;
}
interface SpreadElementExpression extends Expression {
kind: SyntaxKind.SpreadElementExpression;
interface SpreadElement extends Expression {
kind: SyntaxKind.SpreadElement;
expression: Expression;
}
/**
@@ -1141,12 +1181,16 @@ declare namespace ts {
interface ModuleDeclaration extends DeclarationStatement {
kind: SyntaxKind.ModuleDeclaration;
name: Identifier | LiteralExpression;
body?: ModuleBlock | NamespaceDeclaration;
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
}
interface NamespaceDeclaration extends ModuleDeclaration {
name: Identifier;
body: ModuleBlock | NamespaceDeclaration;
}
interface JSDocNamespaceDeclaration extends ModuleDeclaration {
name: Identifier;
body: JSDocNamespaceDeclaration | Identifier;
}
interface ModuleBlock extends Node, Statement {
kind: SyntaxKind.ModuleBlock;
statements: NodeArray<Statement>;
@@ -1318,6 +1362,7 @@ declare namespace ts {
}
interface JSDocTypedefTag extends JSDocTag, Declaration {
kind: SyntaxKind.JSDocTypedefTag;
fullName?: JSDocNamespaceDeclaration | Identifier;
name?: Identifier;
typeExpression?: JSDocTypeExpression;
jsDocTypeLiteral?: JSDocTypeLiteral;
@@ -1708,14 +1753,11 @@ declare namespace ts {
Null = 4096,
Never = 8192,
TypeParameter = 16384,
Class = 32768,
Interface = 65536,
Reference = 131072,
Tuple = 262144,
Union = 524288,
Intersection = 1048576,
Anonymous = 2097152,
Instantiated = 4194304,
Object = 32768,
Union = 65536,
Intersection = 131072,
Index = 262144,
IndexedAccess = 524288,
Literal = 480,
StringOrNumberLiteral = 96,
PossiblyFalsy = 7406,
@@ -1723,12 +1765,11 @@ declare namespace ts {
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
ObjectType = 2588672,
UnionOrIntersection = 1572864,
StructuredType = 4161536,
StructuredOrTypeParameter = 4177920,
Narrowable = 4178943,
NotUnionOrUnit = 2589185,
UnionOrIntersection = 196608,
StructuredType = 229376,
StructuredOrTypeParameter = 507904,
Narrowable = 1033215,
NotUnionOrUnit = 33281,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@@ -1749,8 +1790,21 @@ declare namespace ts {
interface EnumLiteralType extends LiteralType {
baseType: EnumType & UnionType;
}
enum ObjectFlags {
Class = 1,
Interface = 2,
Reference = 4,
Tuple = 8,
Anonymous = 16,
Mapped = 32,
Instantiated = 64,
ObjectLiteral = 128,
EvolvingArray = 256,
ObjectLiteralPatternWithComputedProperties = 512,
ClassOrInterface = 3,
}
interface ObjectType extends Type {
isObjectLiteralPatternWithComputedProperties?: boolean;
objectFlags: ObjectFlags;
}
interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[];
@@ -1778,9 +1832,21 @@ declare namespace ts {
}
interface IntersectionType extends UnionOrIntersectionType {
}
type StructuredType = ObjectType | UnionType | IntersectionType;
interface EvolvingArrayType extends ObjectType {
elementType: Type;
finalArrayType?: Type;
}
interface TypeParameter extends Type {
constraint: Type;
}
interface IndexType extends Type {
type: TypeParameter;
}
interface IndexedAccessType extends Type {
objectType: Type;
indexType: TypeParameter;
}
enum SignatureKind {
Call = 0,
Construct = 1,
@@ -1882,6 +1948,7 @@ declare namespace ts {
preserveConstEnums?: boolean;
project?: string;
reactNamespace?: string;
jsxFactory?: string;
removeComments?: boolean;
rootDir?: string;
rootDirs?: string[];
@@ -1912,6 +1979,7 @@ declare namespace ts {
packageNameToTypingLocation: Map<string>;
typingOptions: TypingOptions;
compilerOptions: CompilerOptions;
unresolvedImports: ReadonlyArray<string>;
}
enum ModuleKind {
None = 0,
@@ -1947,12 +2015,14 @@ declare namespace ts {
ES2015 = 2,
ES2016 = 3,
ES2017 = 4,
Latest = 4,
ESNext = 5,
Latest = 5,
}
enum LanguageVariant {
Standard = 0,
JSX = 1,
}
/** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
options: CompilerOptions;
typingOptions?: TypingOptions;
@@ -1979,12 +2049,45 @@ declare namespace ts {
getCurrentDirectory?(): string;
getDirectories?(path: string): string[];
}
/**
* Represents the result of module resolution.
* Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
* The Program will then filter results based on these flags.
*
* Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
*/
interface ResolvedModule {
/** Path of the file the module was resolved to. */
resolvedFileName: string;
/**
* Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module:
* - be a .d.ts file
* - use top level imports\exports
* - don't use tripleslash references
*/
isExternalLibraryImport?: boolean;
}
/**
* ResolvedModule with an explicitly provided `extension` property.
* Prefer this over `ResolvedModule`.
*/
interface ResolvedModuleFull extends ResolvedModule {
/**
* Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
* This is optional for backwards-compatibility, but will be added if not provided.
*/
extension: Extension;
}
enum Extension {
Ts = 0,
Tsx = 1,
Dts = 2,
Js = 3,
Jsx = 4,
LastTypeScriptExtension = 2,
}
interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
resolvedModule: ResolvedModuleFull | undefined;
failedLookupLocations: string[];
}
interface ResolvedTypeReferenceDirective {
@@ -2042,7 +2145,11 @@ declare namespace ts {
readFile(path: string, encoding?: string): string;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
/**
* @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
* use native OS file watching
*/
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
@@ -2057,6 +2164,8 @@ declare namespace ts {
getMemoryUsage?(): number;
exit(exitCode?: number): void;
realpath?(path: string): string;
setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
clearTimeout?(timeoutId: any): void;
}
interface FileWatcher {
close(): void;
@@ -2159,6 +2268,7 @@ declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
function isExternalModule(file: SourceFile): boolean;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
@@ -2172,7 +2282,7 @@ declare namespace ts {
* This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
* is assumed to be the same as root directory of the project.
*/
function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
/**
* Given a set of options, returns the set of type directive names
* that should be included for this program automatically.
@@ -2188,7 +2298,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the TypeScript compiler release */
const version = "2.1.0";
const version = "2.2.0";
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
+11985 -9262
View File
File diff suppressed because it is too large Load Diff
+323 -213
View File
@@ -163,170 +163,177 @@ declare namespace ts {
DeclareKeyword = 123,
GetKeyword = 124,
IsKeyword = 125,
ModuleKeyword = 126,
NamespaceKeyword = 127,
NeverKeyword = 128,
ReadonlyKeyword = 129,
RequireKeyword = 130,
NumberKeyword = 131,
SetKeyword = 132,
StringKeyword = 133,
SymbolKeyword = 134,
TypeKeyword = 135,
UndefinedKeyword = 136,
FromKeyword = 137,
GlobalKeyword = 138,
OfKeyword = 139,
QualifiedName = 140,
ComputedPropertyName = 141,
TypeParameter = 142,
Parameter = 143,
Decorator = 144,
PropertySignature = 145,
PropertyDeclaration = 146,
MethodSignature = 147,
MethodDeclaration = 148,
Constructor = 149,
GetAccessor = 150,
SetAccessor = 151,
CallSignature = 152,
ConstructSignature = 153,
IndexSignature = 154,
TypePredicate = 155,
TypeReference = 156,
FunctionType = 157,
ConstructorType = 158,
TypeQuery = 159,
TypeLiteral = 160,
ArrayType = 161,
TupleType = 162,
UnionType = 163,
IntersectionType = 164,
ParenthesizedType = 165,
ThisType = 166,
LiteralType = 167,
ObjectBindingPattern = 168,
ArrayBindingPattern = 169,
BindingElement = 170,
ArrayLiteralExpression = 171,
ObjectLiteralExpression = 172,
PropertyAccessExpression = 173,
ElementAccessExpression = 174,
CallExpression = 175,
NewExpression = 176,
TaggedTemplateExpression = 177,
TypeAssertionExpression = 178,
ParenthesizedExpression = 179,
FunctionExpression = 180,
ArrowFunction = 181,
DeleteExpression = 182,
TypeOfExpression = 183,
VoidExpression = 184,
AwaitExpression = 185,
PrefixUnaryExpression = 186,
PostfixUnaryExpression = 187,
BinaryExpression = 188,
ConditionalExpression = 189,
TemplateExpression = 190,
YieldExpression = 191,
SpreadElementExpression = 192,
ClassExpression = 193,
OmittedExpression = 194,
ExpressionWithTypeArguments = 195,
AsExpression = 196,
NonNullExpression = 197,
TemplateSpan = 198,
SemicolonClassElement = 199,
Block = 200,
VariableStatement = 201,
EmptyStatement = 202,
ExpressionStatement = 203,
IfStatement = 204,
DoStatement = 205,
WhileStatement = 206,
ForStatement = 207,
ForInStatement = 208,
ForOfStatement = 209,
ContinueStatement = 210,
BreakStatement = 211,
ReturnStatement = 212,
WithStatement = 213,
SwitchStatement = 214,
LabeledStatement = 215,
ThrowStatement = 216,
TryStatement = 217,
DebuggerStatement = 218,
VariableDeclaration = 219,
VariableDeclarationList = 220,
FunctionDeclaration = 221,
ClassDeclaration = 222,
InterfaceDeclaration = 223,
TypeAliasDeclaration = 224,
EnumDeclaration = 225,
ModuleDeclaration = 226,
ModuleBlock = 227,
CaseBlock = 228,
NamespaceExportDeclaration = 229,
ImportEqualsDeclaration = 230,
ImportDeclaration = 231,
ImportClause = 232,
NamespaceImport = 233,
NamedImports = 234,
ImportSpecifier = 235,
ExportAssignment = 236,
ExportDeclaration = 237,
NamedExports = 238,
ExportSpecifier = 239,
MissingDeclaration = 240,
ExternalModuleReference = 241,
JsxElement = 242,
JsxSelfClosingElement = 243,
JsxOpeningElement = 244,
JsxClosingElement = 245,
JsxAttribute = 246,
JsxSpreadAttribute = 247,
JsxExpression = 248,
CaseClause = 249,
DefaultClause = 250,
HeritageClause = 251,
CatchClause = 252,
PropertyAssignment = 253,
ShorthandPropertyAssignment = 254,
EnumMember = 255,
SourceFile = 256,
JSDocTypeExpression = 257,
JSDocAllType = 258,
JSDocUnknownType = 259,
JSDocArrayType = 260,
JSDocUnionType = 261,
JSDocTupleType = 262,
JSDocNullableType = 263,
JSDocNonNullableType = 264,
JSDocRecordType = 265,
JSDocRecordMember = 266,
JSDocTypeReference = 267,
JSDocOptionalType = 268,
JSDocFunctionType = 269,
JSDocVariadicType = 270,
JSDocConstructorType = 271,
JSDocThisType = 272,
JSDocComment = 273,
JSDocTag = 274,
JSDocParameterTag = 275,
JSDocReturnTag = 276,
JSDocTypeTag = 277,
JSDocTemplateTag = 278,
JSDocTypedefTag = 279,
JSDocPropertyTag = 280,
JSDocTypeLiteral = 281,
JSDocLiteralType = 282,
JSDocNullKeyword = 283,
JSDocUndefinedKeyword = 284,
JSDocNeverKeyword = 285,
SyntaxList = 286,
NotEmittedStatement = 287,
PartiallyEmittedExpression = 288,
Count = 289,
KeyOfKeyword = 126,
ModuleKeyword = 127,
NamespaceKeyword = 128,
NeverKeyword = 129,
ReadonlyKeyword = 130,
RequireKeyword = 131,
NumberKeyword = 132,
SetKeyword = 133,
StringKeyword = 134,
SymbolKeyword = 135,
TypeKeyword = 136,
UndefinedKeyword = 137,
FromKeyword = 138,
GlobalKeyword = 139,
OfKeyword = 140,
QualifiedName = 141,
ComputedPropertyName = 142,
TypeParameter = 143,
Parameter = 144,
Decorator = 145,
PropertySignature = 146,
PropertyDeclaration = 147,
MethodSignature = 148,
MethodDeclaration = 149,
Constructor = 150,
GetAccessor = 151,
SetAccessor = 152,
CallSignature = 153,
ConstructSignature = 154,
IndexSignature = 155,
TypePredicate = 156,
TypeReference = 157,
FunctionType = 158,
ConstructorType = 159,
TypeQuery = 160,
TypeLiteral = 161,
ArrayType = 162,
TupleType = 163,
UnionType = 164,
IntersectionType = 165,
ParenthesizedType = 166,
ThisType = 167,
TypeOperator = 168,
IndexedAccessType = 169,
MappedType = 170,
LiteralType = 171,
ObjectBindingPattern = 172,
ArrayBindingPattern = 173,
BindingElement = 174,
ArrayLiteralExpression = 175,
ObjectLiteralExpression = 176,
PropertyAccessExpression = 177,
ElementAccessExpression = 178,
CallExpression = 179,
NewExpression = 180,
TaggedTemplateExpression = 181,
TypeAssertionExpression = 182,
ParenthesizedExpression = 183,
FunctionExpression = 184,
ArrowFunction = 185,
DeleteExpression = 186,
TypeOfExpression = 187,
VoidExpression = 188,
AwaitExpression = 189,
PrefixUnaryExpression = 190,
PostfixUnaryExpression = 191,
BinaryExpression = 192,
ConditionalExpression = 193,
TemplateExpression = 194,
YieldExpression = 195,
SpreadElement = 196,
ClassExpression = 197,
OmittedExpression = 198,
ExpressionWithTypeArguments = 199,
AsExpression = 200,
NonNullExpression = 201,
TemplateSpan = 202,
SemicolonClassElement = 203,
Block = 204,
VariableStatement = 205,
EmptyStatement = 206,
ExpressionStatement = 207,
IfStatement = 208,
DoStatement = 209,
WhileStatement = 210,
ForStatement = 211,
ForInStatement = 212,
ForOfStatement = 213,
ContinueStatement = 214,
BreakStatement = 215,
ReturnStatement = 216,
WithStatement = 217,
SwitchStatement = 218,
LabeledStatement = 219,
ThrowStatement = 220,
TryStatement = 221,
DebuggerStatement = 222,
VariableDeclaration = 223,
VariableDeclarationList = 224,
FunctionDeclaration = 225,
ClassDeclaration = 226,
InterfaceDeclaration = 227,
TypeAliasDeclaration = 228,
EnumDeclaration = 229,
ModuleDeclaration = 230,
ModuleBlock = 231,
CaseBlock = 232,
NamespaceExportDeclaration = 233,
ImportEqualsDeclaration = 234,
ImportDeclaration = 235,
ImportClause = 236,
NamespaceImport = 237,
NamedImports = 238,
ImportSpecifier = 239,
ExportAssignment = 240,
ExportDeclaration = 241,
NamedExports = 242,
ExportSpecifier = 243,
MissingDeclaration = 244,
ExternalModuleReference = 245,
JsxElement = 246,
JsxSelfClosingElement = 247,
JsxOpeningElement = 248,
JsxClosingElement = 249,
JsxAttribute = 250,
JsxSpreadAttribute = 251,
JsxExpression = 252,
CaseClause = 253,
DefaultClause = 254,
HeritageClause = 255,
CatchClause = 256,
PropertyAssignment = 257,
ShorthandPropertyAssignment = 258,
SpreadAssignment = 259,
EnumMember = 260,
SourceFile = 261,
JSDocTypeExpression = 262,
JSDocAllType = 263,
JSDocUnknownType = 264,
JSDocArrayType = 265,
JSDocUnionType = 266,
JSDocTupleType = 267,
JSDocNullableType = 268,
JSDocNonNullableType = 269,
JSDocRecordType = 270,
JSDocRecordMember = 271,
JSDocTypeReference = 272,
JSDocOptionalType = 273,
JSDocFunctionType = 274,
JSDocVariadicType = 275,
JSDocConstructorType = 276,
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
JSDocParameterTag = 280,
JSDocReturnTag = 281,
JSDocTypeTag = 282,
JSDocTemplateTag = 283,
JSDocTypedefTag = 284,
JSDocPropertyTag = 285,
JSDocTypeLiteral = 286,
JSDocLiteralType = 287,
JSDocNullKeyword = 288,
JSDocUndefinedKeyword = 289,
JSDocNeverKeyword = 290,
SyntaxList = 291,
NotEmittedStatement = 292,
PartiallyEmittedExpression = 293,
MergeDeclarationMarker = 294,
EndOfDeclarationMarker = 295,
Count = 296,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
@@ -334,15 +341,15 @@ declare namespace ts {
FirstReservedWord = 71,
LastReservedWord = 106,
FirstKeyword = 71,
LastKeyword = 139,
LastKeyword = 140,
FirstFutureReservedWord = 107,
LastFutureReservedWord = 115,
FirstTypeNode = 155,
LastTypeNode = 167,
FirstTypeNode = 156,
LastTypeNode = 171,
FirstPunctuation = 16,
LastPunctuation = 69,
FirstToken = 0,
LastToken = 139,
LastToken = 140,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -351,11 +358,11 @@ declare namespace ts {
LastTemplateToken = 15,
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
FirstNode = 140,
FirstJSDocNode = 257,
LastJSDocNode = 282,
FirstJSDocTagNode = 273,
LastJSDocTagNode = 285,
FirstNode = 141,
FirstJSDocNode = 262,
LastJSDocNode = 287,
FirstJSDocTagNode = 278,
LastJSDocTagNode = 290,
}
enum NodeFlags {
None = 0,
@@ -373,21 +380,22 @@ declare namespace ts {
HasDecorators = 2048,
HasParamDecorators = 4096,
HasAsyncFunctions = 8192,
HasJsxSpreadAttributes = 16384,
DisallowInContext = 32768,
YieldContext = 65536,
DecoratorContext = 131072,
AwaitContext = 262144,
ThisNodeHasError = 524288,
JavaScriptFile = 1048576,
ThisNodeOrAnySubNodesHasError = 2097152,
HasAggregatedChildData = 4194304,
HasSpreadAttribute = 16384,
HasRestAttribute = 32768,
DisallowInContext = 65536,
YieldContext = 131072,
DecoratorContext = 262144,
AwaitContext = 524288,
ThisNodeHasError = 1048576,
JavaScriptFile = 2097152,
ThisNodeOrAnySubNodesHasError = 4194304,
HasAggregatedChildData = 8388608,
BlockScoped = 3,
ReachabilityCheckFlags = 384,
EmitHelperFlags = 31744,
ReachabilityAndEmitFlags = 32128,
ContextFlags = 1540096,
TypeExcludesFlags = 327680,
EmitHelperFlags = 64512,
ReachabilityAndEmitFlags = 64896,
ContextFlags = 3080192,
TypeExcludesFlags = 655360,
}
enum ModifierFlags {
None = 0,
@@ -407,6 +415,7 @@ declare namespace ts {
ParameterPropertyModifier = 92,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
ExportDefault = 513,
}
enum JsxFlags {
None = 0,
@@ -437,12 +446,14 @@ declare namespace ts {
type EqualsGreaterThanToken = Token<SyntaxKind.EqualsGreaterThanToken>;
type EndOfFileToken = Token<SyntaxKind.EndOfFileToken>;
type AtToken = Token<SyntaxKind.AtToken>;
type ReadonlyToken = Token<SyntaxKind.ReadonlyKeyword>;
type Modifier = Token<SyntaxKind.AbstractKeyword> | Token<SyntaxKind.AsyncKeyword> | Token<SyntaxKind.ConstKeyword> | Token<SyntaxKind.DeclareKeyword> | Token<SyntaxKind.DefaultKeyword> | Token<SyntaxKind.ExportKeyword> | Token<SyntaxKind.PublicKeyword> | Token<SyntaxKind.PrivateKeyword> | Token<SyntaxKind.ProtectedKeyword> | Token<SyntaxKind.ReadonlyKeyword> | Token<SyntaxKind.StaticKeyword>;
type ModifiersArray = NodeArray<Modifier>;
interface Identifier extends PrimaryExpression {
kind: SyntaxKind.Identifier;
text: string;
originalKeywordKind?: SyntaxKind;
isInJSDocNamespace?: boolean;
}
interface TransientIdentifier extends Identifier {
resolvedSymbol: Symbol;
@@ -533,7 +544,7 @@ declare namespace ts {
_objectLiteralBrandBrand: any;
name?: PropertyName;
}
type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration;
type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment;
interface PropertyAssignment extends ObjectLiteralElement {
kind: SyntaxKind.PropertyAssignment;
name: PropertyName;
@@ -547,6 +558,10 @@ declare namespace ts {
equalsToken?: Token<SyntaxKind.EqualsToken>;
objectAssignmentInitializer?: Expression;
}
interface SpreadAssignment extends ObjectLiteralElement {
kind: SyntaxKind.SpreadAssignment;
expression: Expression;
}
interface VariableLikeDeclaration extends Declaration {
propertyName?: PropertyName;
dotDotDotToken?: DotDotDotToken;
@@ -677,6 +692,23 @@ declare namespace ts {
kind: SyntaxKind.ParenthesizedType;
type: TypeNode;
}
interface TypeOperatorNode extends TypeNode {
kind: SyntaxKind.TypeOperator;
operator: SyntaxKind.KeyOfKeyword;
type: TypeNode;
}
interface IndexedAccessTypeNode extends TypeNode {
kind: SyntaxKind.IndexedAccessType;
objectType: TypeNode;
indexType: TypeNode;
}
interface MappedTypeNode extends TypeNode, Declaration {
kind: SyntaxKind.MappedType;
readonlyToken?: ReadonlyToken;
typeParameter: TypeParameterDeclaration;
questionToken?: QuestionToken;
type?: TypeNode;
}
interface LiteralTypeNode extends TypeNode {
kind: SyntaxKind.LiteralType;
literal: Expression;
@@ -709,9 +741,6 @@ declare namespace ts {
operand: LeftHandSideExpression;
operator: PostfixUnaryOperator;
}
interface PostfixExpression extends UnaryExpression {
_postfixExpressionBrand: any;
}
interface LeftHandSideExpression extends IncrementExpression {
_leftHandSideExpressionBrand: any;
}
@@ -780,6 +809,17 @@ declare namespace ts {
operatorToken: BinaryOperatorToken;
right: Expression;
}
interface AssignmentExpression extends BinaryExpression {
left: LeftHandSideExpression;
operatorToken: Token<SyntaxKind.EqualsToken>;
}
interface ObjectDestructuringAssignment extends AssignmentExpression {
left: ObjectLiteralExpression;
}
interface ArrayDestructuringAssignment extends AssignmentExpression {
left: ArrayLiteralExpression;
}
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
interface ConditionalExpression extends Expression {
kind: SyntaxKind.ConditionalExpression;
condition: Expression;
@@ -846,8 +886,8 @@ declare namespace ts {
kind: SyntaxKind.ArrayLiteralExpression;
elements: NodeArray<Expression>;
}
interface SpreadElementExpression extends Expression {
kind: SyntaxKind.SpreadElementExpression;
interface SpreadElement extends Expression {
kind: SyntaxKind.SpreadElement;
expression: Expression;
}
/**
@@ -1141,12 +1181,16 @@ declare namespace ts {
interface ModuleDeclaration extends DeclarationStatement {
kind: SyntaxKind.ModuleDeclaration;
name: Identifier | LiteralExpression;
body?: ModuleBlock | NamespaceDeclaration;
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
}
interface NamespaceDeclaration extends ModuleDeclaration {
name: Identifier;
body: ModuleBlock | NamespaceDeclaration;
}
interface JSDocNamespaceDeclaration extends ModuleDeclaration {
name: Identifier;
body: JSDocNamespaceDeclaration | Identifier;
}
interface ModuleBlock extends Node, Statement {
kind: SyntaxKind.ModuleBlock;
statements: NodeArray<Statement>;
@@ -1318,6 +1362,7 @@ declare namespace ts {
}
interface JSDocTypedefTag extends JSDocTag, Declaration {
kind: SyntaxKind.JSDocTypedefTag;
fullName?: JSDocNamespaceDeclaration | Identifier;
name?: Identifier;
typeExpression?: JSDocTypeExpression;
jsDocTypeLiteral?: JSDocTypeLiteral;
@@ -1708,14 +1753,11 @@ declare namespace ts {
Null = 4096,
Never = 8192,
TypeParameter = 16384,
Class = 32768,
Interface = 65536,
Reference = 131072,
Tuple = 262144,
Union = 524288,
Intersection = 1048576,
Anonymous = 2097152,
Instantiated = 4194304,
Object = 32768,
Union = 65536,
Intersection = 131072,
Index = 262144,
IndexedAccess = 524288,
Literal = 480,
StringOrNumberLiteral = 96,
PossiblyFalsy = 7406,
@@ -1723,12 +1765,11 @@ declare namespace ts {
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
ObjectType = 2588672,
UnionOrIntersection = 1572864,
StructuredType = 4161536,
StructuredOrTypeParameter = 4177920,
Narrowable = 4178943,
NotUnionOrUnit = 2589185,
UnionOrIntersection = 196608,
StructuredType = 229376,
StructuredOrTypeParameter = 507904,
Narrowable = 1033215,
NotUnionOrUnit = 33281,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@@ -1749,8 +1790,21 @@ declare namespace ts {
interface EnumLiteralType extends LiteralType {
baseType: EnumType & UnionType;
}
enum ObjectFlags {
Class = 1,
Interface = 2,
Reference = 4,
Tuple = 8,
Anonymous = 16,
Mapped = 32,
Instantiated = 64,
ObjectLiteral = 128,
EvolvingArray = 256,
ObjectLiteralPatternWithComputedProperties = 512,
ClassOrInterface = 3,
}
interface ObjectType extends Type {
isObjectLiteralPatternWithComputedProperties?: boolean;
objectFlags: ObjectFlags;
}
interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[];
@@ -1778,9 +1832,21 @@ declare namespace ts {
}
interface IntersectionType extends UnionOrIntersectionType {
}
type StructuredType = ObjectType | UnionType | IntersectionType;
interface EvolvingArrayType extends ObjectType {
elementType: Type;
finalArrayType?: Type;
}
interface TypeParameter extends Type {
constraint: Type;
}
interface IndexType extends Type {
type: TypeParameter;
}
interface IndexedAccessType extends Type {
objectType: Type;
indexType: TypeParameter;
}
enum SignatureKind {
Call = 0,
Construct = 1,
@@ -1882,6 +1948,7 @@ declare namespace ts {
preserveConstEnums?: boolean;
project?: string;
reactNamespace?: string;
jsxFactory?: string;
removeComments?: boolean;
rootDir?: string;
rootDirs?: string[];
@@ -1912,6 +1979,7 @@ declare namespace ts {
packageNameToTypingLocation: Map<string>;
typingOptions: TypingOptions;
compilerOptions: CompilerOptions;
unresolvedImports: ReadonlyArray<string>;
}
enum ModuleKind {
None = 0,
@@ -1947,12 +2015,14 @@ declare namespace ts {
ES2015 = 2,
ES2016 = 3,
ES2017 = 4,
Latest = 4,
ESNext = 5,
Latest = 5,
}
enum LanguageVariant {
Standard = 0,
JSX = 1,
}
/** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
options: CompilerOptions;
typingOptions?: TypingOptions;
@@ -1979,12 +2049,45 @@ declare namespace ts {
getCurrentDirectory?(): string;
getDirectories?(path: string): string[];
}
/**
* Represents the result of module resolution.
* Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
* The Program will then filter results based on these flags.
*
* Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
*/
interface ResolvedModule {
/** Path of the file the module was resolved to. */
resolvedFileName: string;
/**
* Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module:
* - be a .d.ts file
* - use top level imports\exports
* - don't use tripleslash references
*/
isExternalLibraryImport?: boolean;
}
/**
* ResolvedModule with an explicitly provided `extension` property.
* Prefer this over `ResolvedModule`.
*/
interface ResolvedModuleFull extends ResolvedModule {
/**
* Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
* This is optional for backwards-compatibility, but will be added if not provided.
*/
extension: Extension;
}
enum Extension {
Ts = 0,
Tsx = 1,
Dts = 2,
Js = 3,
Jsx = 4,
LastTypeScriptExtension = 2,
}
interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
resolvedModule: ResolvedModuleFull | undefined;
failedLookupLocations: string[];
}
interface ResolvedTypeReferenceDirective {
@@ -2042,7 +2145,11 @@ declare namespace ts {
readFile(path: string, encoding?: string): string;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
/**
* @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
* use native OS file watching
*/
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
@@ -2057,6 +2164,8 @@ declare namespace ts {
getMemoryUsage?(): number;
exit(exitCode?: number): void;
realpath?(path: string): string;
setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
clearTimeout?(timeoutId: any): void;
}
interface FileWatcher {
close(): void;
@@ -2159,6 +2268,7 @@ declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
function isExternalModule(file: SourceFile): boolean;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
@@ -2172,7 +2282,7 @@ declare namespace ts {
* This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
* is assumed to be the same as root directory of the project.
*/
function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
/**
* Given a set of options, returns the set of type directive names
* that should be included for this program automatically.
@@ -2188,7 +2298,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the TypeScript compiler release */
const version = "2.1.0";
const version = "2.2.0";
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
+11985 -9262
View File
File diff suppressed because it is too large Load Diff
+756 -1380
View File
File diff suppressed because it is too large Load Diff
+12 -6
View File
@@ -7536,7 +7536,8 @@ namespace ts {
return Ternary.False;
}
result &= related;
if (sourceProp.flags & SymbolFlags.Optional && !(targetProp.flags & SymbolFlags.Optional)) {
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & SymbolFlags.Optional && !(targetProp.flags & SymbolFlags.Optional)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
// S is a subtype of a type T, and T is a supertype of S if ...
// S' and T are object types and, for each member M in T..
@@ -9935,8 +9936,7 @@ namespace ts {
// Due to the emit for class decorators, any reference to the class from inside of the class body
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
if (languageVersion === ScriptTarget.ES2015
&& declaration.kind === SyntaxKind.ClassDeclaration
if (declaration.kind === SyntaxKind.ClassDeclaration
&& nodeIsDecorated(declaration)) {
let container = getContainingClass(node);
while (container !== undefined) {
@@ -14505,6 +14505,8 @@ namespace ts {
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
if (checkForDisallowedESSymbolOperand(operator)) {
leftType = getBaseTypeOfLiteralType(leftType);
rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -17259,11 +17261,15 @@ namespace ts {
function checkElementTypeOfArrayOrString(arrayOrStringType: Type, errorNode: Node): Type {
Debug.assert(languageVersion < ScriptTarget.ES2015);
// After we remove all types that are StringLike, we will know if there was a string constituent
// based on whether the remaining type is the same as the initial type.
let arrayType = arrayOrStringType;
if (arrayOrStringType.flags & TypeFlags.Union) {
arrayType = getUnionType(filter((arrayOrStringType as UnionType).types, t => !(t.flags & TypeFlags.StringLike)), /*subtypeReduction*/ true);
// After we remove all types that are StringLike, we will know if there was a string constituent
// based on whether the result of filter is a new array.
const arrayTypes = (arrayOrStringType as UnionType).types;
const filteredTypes = filter(arrayTypes, t => !(t.flags & TypeFlags.StringLike));
if (filteredTypes !== arrayTypes) {
arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true);
}
}
else if (arrayOrStringType.flags & TypeFlags.StringLike) {
arrayType = neverType;
+4
View File
@@ -3089,6 +3089,10 @@
"category": "Error",
"code": 9003
},
"Language service is disabled.": {
"category": "Error",
"code": 9004
},
"JSX attributes must only be assigned a non-empty 'expression'.": {
"category": "Error",
"code": 17000
+1
View File
@@ -6304,6 +6304,7 @@ namespace ts {
}
if (token() === SyntaxKind.NewLineTrivia) {
state = JSDocState.BeginningOfLine;
indent = 0;
nextJSDocToken();
}
while (token() !== SyntaxKind.EndOfFileToken) {
+15 -2
View File
@@ -279,7 +279,7 @@ namespace ts {
else if (node.transformFlags & TransformFlags.ContainsES2015 || (isInConstructorWithCapturedSuper && !isExpression(node))) {
// we want to dive in this branch either if node has children with ES2015 specific syntax
// or we are inside constructor that captures result of the super call so all returns without expression should be
// rewritten. Note: we skip expressions since returns should never appear there
// rewritten. Note: we skip expressions since returns should never appear there
return visitEachChild(node, visitor, context);
}
else {
@@ -1011,7 +1011,20 @@ namespace ts {
// Return the result if we have an immediate super() call on the last statement.
if (superCallExpression && statementOffset === ctorStatements.length - 1) {
statements.push(createReturn(superCallExpression));
const returnStatement = createReturn(superCallExpression);
if (superCallExpression.kind !== SyntaxKind.BinaryExpression
|| (superCallExpression as BinaryExpression).left.kind !== SyntaxKind.CallExpression) {
Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
}
// Shift comments from the original super call to the return statement.
setCommentRange(returnStatement, getCommentRange(
setEmitFlags(
(superCallExpression as BinaryExpression).left,
EmitFlags.NoComments)));
statements.push(returnStatement);
return SuperCaptureResult.ReplaceWithReturn;
}
+10 -6
View File
@@ -92,11 +92,15 @@ namespace ts {
// { a, ...o, b } => __assign({a}, o, {b});
// If the first element is a spread element, then the first argument to __assign is {}:
// { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
const objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== SyntaxKind.ObjectLiteralExpression) {
objects.unshift(createObjectLiteral());
if (forEach(node.properties, p => p.kind === SyntaxKind.SpreadAssignment)) {
const objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== SyntaxKind.ObjectLiteralExpression) {
objects.unshift(createObjectLiteral());
}
return aggregateTransformFlags(createCall(createIdentifier("__assign"), undefined, objects));
}
return createCall(createIdentifier("__assign"), undefined, objects);
return visitEachChild(node, visitor, context);
}
/**
@@ -235,7 +239,7 @@ namespace ts {
visitEachChild(node.body, visitor, context);
const func = setOriginalNode(
createArrowFunction(
/*modifiers*/ undefined,
node.modifiers,
/*typeParameters*/ undefined,
visitNodes(node.parameters, visitor, isParameter),
/*type*/ undefined,
@@ -256,7 +260,7 @@ namespace ts {
visitEachChild(node.body, visitor, context);
return setOriginalNode(
createFunctionExpression(
/*modifiers*/ undefined,
node.modifiers,
node.asteriskToken,
name,
/*typeParameters*/ undefined,
+2 -2
View File
@@ -2013,13 +2013,13 @@ namespace FourSlash {
this.raiseError("Errors expected.");
}
if (diagnostics.length > 1 && errorCode !== undefined) {
if (diagnostics.length > 1 && errorCode === undefined) {
this.raiseError("When there's more than one error, you must specify the errror to fix.");
}
const diagnostic = !errorCode ? diagnostics[0] : ts.find(diagnostics, d => d.code == errorCode);
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]);
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.start + diagnostic.length, [diagnostic.code]);
}
public verifyCodeFixAtPosition(expectedText: string, errorCode?: number) {
+100 -2
View File
@@ -154,7 +154,6 @@ namespace ts.projectSystem {
params.executingFilePath || getExecutingFilePathFromLibFile(),
params.currentDirectory || "/",
fileOrFolderList);
host.createFileOrFolder(safeList, /*createParentDirectory*/ true);
return host;
}
@@ -355,7 +354,8 @@ namespace ts.projectSystem {
reloadFS(filesOrFolders: FileOrFolder[]) {
this.filesOrFolders = filesOrFolders;
this.fs = createFileMap<FSEntry>();
for (const fileOrFolder of filesOrFolders) {
// always inject safelist file in the list of files
for (const fileOrFolder of filesOrFolders.concat(safeList)) {
const path = this.toPath(fileOrFolder.path);
const fullPath = getNormalizedAbsolutePath(fileOrFolder.path, this.currentDirectory);
if (typeof fileOrFolder.content === "string") {
@@ -1585,6 +1585,104 @@ namespace ts.projectSystem {
projectService.closeClientFile(file1.path);
checkNumberOfProjects(projectService, { configuredProjects: 0 });
});
it("language service disabled events are triggered", () => {
const f1 = {
path: "/a/app.js",
content: "let x = 1;"
};
const f2 = {
path: "/a/largefile.js",
content: ""
};
const config = {
path: "/a/jsconfig.json",
content: "{}"
};
const configWithExclude = {
path: config.path,
content: JSON.stringify({ exclude: ["largefile.js"] })
};
const host = createServerHost([f1, f2, config]);
const originalGetFileSize = host.getFileSize;
host.getFileSize = (filePath: string) =>
filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath);
let lastEvent: server.ProjectLanguageServiceStateEvent;
const session = createSession(host, /*typingsInstaller*/ undefined, e => {
if (e.eventName === server.ConfigFileDiagEvent || e.eventName === server.ContextEvent) {
return;
}
assert.equal(e.eventName, server.ProjectLanguageServiceStateEvent);
lastEvent = <server.ProjectLanguageServiceStateEvent>e;
});
session.executeCommand(<protocol.OpenRequest>{
seq: 0,
type: "request",
command: "open",
arguments: { file: f1.path }
});
const projectService = session.getProjectService();
checkNumberOfProjects(projectService, { configuredProjects: 1 });
const project = projectService.configuredProjects[0];
assert.isFalse(project.languageServiceEnabled, "Language service enabled");
assert.isTrue(!!lastEvent, "should receive event");
assert.equal(lastEvent.data.project, project, "project name");
assert.isFalse(lastEvent.data.languageServiceEnabled, "Language service state");
host.reloadFS([f1, f2, configWithExclude]);
host.triggerFileWatcherCallback(config.path, /*removed*/ false);
checkNumberOfProjects(projectService, { configuredProjects: 1 });
assert.isTrue(project.languageServiceEnabled, "Language service enabled");
assert.equal(lastEvent.data.project, project, "project");
assert.isTrue(lastEvent.data.languageServiceEnabled, "Language service state");
});
it("syntactic features work even if language service is disabled", () => {
const f1 = {
path: "/a/app.js",
content: "let x = 1;"
};
const f2 = {
path: "/a/largefile.js",
content: ""
};
const config = {
path: "/a/jsconfig.json",
content: "{}"
};
const host = createServerHost([f1, f2, config]);
const originalGetFileSize = host.getFileSize;
host.getFileSize = (filePath: string) =>
filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath);
let lastEvent: server.ProjectLanguageServiceStateEvent;
const session = createSession(host, /*typingsInstaller*/ undefined, e => {
if (e.eventName === server.ConfigFileDiagEvent) {
return;
}
assert.equal(e.eventName, server.ProjectLanguageServiceStateEvent);
lastEvent = <server.ProjectLanguageServiceStateEvent>e;
});
session.executeCommand(<protocol.OpenRequest>{
seq: 0,
type: "request",
command: "open",
arguments: { file: f1.path }
});
const projectService = session.getProjectService();
checkNumberOfProjects(projectService, { configuredProjects: 1 });
const project = projectService.configuredProjects[0];
assert.isFalse(project.languageServiceEnabled, "Language service enabled");
assert.isTrue(!!lastEvent, "should receive event");
assert.equal(lastEvent.data.project, project, "project name");
assert.isFalse(lastEvent.data.languageServiceEnabled, "Language service state");
const options = projectService.getFormatCodeOptions();
const edits = project.getLanguageService().getFormattingEditsForDocument(f1.path, options);
assert.deepEqual(edits, [{ span: createTextSpan(/*start*/ 7, /*length*/ 3), newText: " " }]);
});
});
describe("Proper errors", () => {
+2 -2
View File
@@ -9,6 +9,6 @@ interface ObjectConstructor {
* Returns an array of key/values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
entries<T>(o: { [s: string]: T }): [string, T][];
entries<T extends { [key: string]: any }, K extends keyof T>(o: T): [keyof T, T[K]][];
entries(o: any): [string, any][];
}
}
+37 -6
View File
@@ -10,8 +10,26 @@
namespace ts.server {
export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
export type ProjectServiceEvent =
{ eventName: "context", data: { project: Project, fileName: NormalizedPath } } | { eventName: "configFileDiag", data: { triggerFile: string, configFileName: string, diagnostics: Diagnostic[] } };
export const ContextEvent = "context";
export const ConfigFileDiagEvent = "configFileDiag";
export const ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
export interface ContextEvent {
eventName: typeof ContextEvent;
data: { project: Project; fileName: NormalizedPath };
}
export interface ConfigFileDiagEvent {
eventName: typeof ConfigFileDiagEvent;
data: { triggerFile: string, configFileName: string, diagnostics: Diagnostic[] };
}
export interface ProjectLanguageServiceStateEvent {
eventName: typeof ProjectLanguageServiceStateEvent;
data: { project: Project, languageServiceEnabled: boolean };
}
export type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent;
export interface ProjectServiceEventHandler {
(event: ProjectServiceEvent): void;
@@ -282,6 +300,16 @@ namespace ts.server {
return this.compilerOptionsForInferredProjects;
}
onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean) {
if (!this.eventHandler) {
return;
}
this.eventHandler(<ProjectLanguageServiceStateEvent>{
eventName: ProjectLanguageServiceStateEvent,
data: { project, languageServiceEnabled }
});
}
updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void {
const project = this.findProject(response.projectName);
if (!project) {
@@ -430,7 +458,10 @@ namespace ts.server {
}
for (const openFile of this.openFiles) {
this.eventHandler({ eventName: "context", data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } });
this.eventHandler(<ContextEvent>{
eventName: ContextEvent,
data: { project: openFile.getDefaultProject(), fileName: openFile.fileName }
});
}
}
@@ -834,8 +865,8 @@ namespace ts.server {
return;
}
this.eventHandler({
eventName: "configFileDiag",
this.eventHandler(<ConfigFileDiagEvent>{
eventName: ConfigFileDiagEvent,
data: { configFileName, diagnostics: diagnostics || [], triggerFile }
});
}
@@ -1013,7 +1044,7 @@ namespace ts.server {
const useExistingProject = this.useSingleInferredProject && this.inferredProjects.length;
const project = useExistingProject
? this.inferredProjects[0]
: new InferredProject(this, this.documentRegistry, /*languageServiceEnabled*/ true, this.compilerOptionsForInferredProjects);
: new InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects);
project.addRoot(root);
+2 -2
View File
@@ -3,9 +3,9 @@
/// <reference path="scriptInfo.ts" />
namespace ts.server {
export class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost, ServerLanguageServiceHost {
export class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost {
private compilationSettings: ts.CompilerOptions;
private readonly resolvedModuleNames= createFileMap<Map<ResolvedModuleWithFailedLookupLocations>>();
private readonly resolvedModuleNames = createFileMap<Map<ResolvedModuleWithFailedLookupLocations>>();
private readonly resolvedTypeReferenceDirectives = createFileMap<Map<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>>();
private readonly getCanonicalFileName: (fileName: string) => string;
+110 -17
View File
@@ -90,16 +90,102 @@ namespace ts.server {
}
}
const emptyResult: any[] = [];
const getEmptyResult = () => emptyResult;
const getUndefined = () => <any>undefined;
const emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: EndOfLineState.None };
export function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService {
return {
cleanupSemanticCache: noop,
getSyntacticDiagnostics: (fileName) =>
fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult,
getSemanticDiagnostics: getEmptyResult,
getCompilerOptionsDiagnostics: () =>
realLanguageService.getCompilerOptionsDiagnostics(),
getSyntacticClassifications: (fileName, span) =>
realLanguageService.getSyntacticClassifications(fileName, span),
getEncodedSyntacticClassifications: (fileName, span) =>
realLanguageService.getEncodedSyntacticClassifications(fileName, span),
getSemanticClassifications: getEmptyResult,
getEncodedSemanticClassifications: () =>
emptyEncodedSemanticClassifications,
getCompletionsAtPosition: getUndefined,
findReferences: getEmptyResult,
getCompletionEntryDetails: getUndefined,
getQuickInfoAtPosition: getUndefined,
findRenameLocations: getEmptyResult,
getNameOrDottedNameSpan: (fileName, startPos, endPos) =>
realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos),
getBreakpointStatementAtPosition: (fileName, position) =>
realLanguageService.getBreakpointStatementAtPosition(fileName, position),
getBraceMatchingAtPosition: (fileName, position) =>
realLanguageService.getBraceMatchingAtPosition(fileName, position),
getSignatureHelpItems: getUndefined,
getDefinitionAtPosition: getEmptyResult,
getRenameInfo: () => ({
canRename: false,
localizedErrorMessage: getLocaleSpecificMessage(Diagnostics.Language_service_is_disabled),
displayName: undefined,
fullDisplayName: undefined,
kind: undefined,
kindModifiers: undefined,
triggerSpan: undefined
}),
getTypeDefinitionAtPosition: getUndefined,
getReferencesAtPosition: getEmptyResult,
getDocumentHighlights: getEmptyResult,
getOccurrencesAtPosition: getEmptyResult,
getNavigateToItems: getEmptyResult,
getNavigationBarItems: fileName =>
realLanguageService.getNavigationBarItems(fileName),
getNavigationTree: fileName =>
realLanguageService.getNavigationTree(fileName),
getOutliningSpans: fileName =>
realLanguageService.getOutliningSpans(fileName),
getTodoComments: getEmptyResult,
getIndentationAtPosition: (fileName, position, options) =>
realLanguageService.getIndentationAtPosition(fileName, position, options),
getFormattingEditsForRange: (fileName, start, end, options) =>
realLanguageService.getFormattingEditsForRange(fileName, start, end, options),
getFormattingEditsForDocument: (fileName, options) =>
realLanguageService.getFormattingEditsForDocument(fileName, options),
getFormattingEditsAfterKeystroke: (fileName, position, key, options) =>
realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options),
getDocCommentTemplateAtPosition: (fileName, position) =>
realLanguageService.getDocCommentTemplateAtPosition(fileName, position),
isValidBraceCompletionAtPosition: (fileName, position, openingBrace) =>
realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace),
getEmitOutput: getUndefined,
getProgram: () =>
realLanguageService.getProgram(),
getNonBoundSourceFile: fileName =>
realLanguageService.getNonBoundSourceFile(fileName),
dispose: () =>
realLanguageService.dispose(),
getCompletionEntrySymbol: getUndefined,
getImplementationAtPosition: getEmptyResult,
getSourceFile: fileName =>
realLanguageService.getSourceFile(fileName),
getCodeFixesAtPosition: getEmptyResult
};
}
export abstract class Project {
private rootFiles: ScriptInfo[] = [];
private rootFilesMap: FileMap<ScriptInfo> = createFileMap<ScriptInfo>();
private lsHost: ServerLanguageServiceHost;
private lsHost: LSHost;
private program: ts.Program;
private cachedUnresolvedImportsPerFile = new UnresolvedImportsMap();
private lastCachedUnresolvedImportsList: SortedReadonlyArray<string>;
private languageService: LanguageService;
private readonly languageService: LanguageService;
// wrapper over the real language service that will suppress all semantic operations
private readonly noSemanticFeaturesLanguageService: LanguageService;
public languageServiceEnabled = true;
builder: Builder;
/**
* Set of files that was returned from the last call to getChangesSinceVersion.
@@ -147,7 +233,7 @@ namespace ts.server {
readonly projectService: ProjectService,
private documentRegistry: ts.DocumentRegistry,
hasExplicitListOfFiles: boolean,
public languageServiceEnabled: boolean,
languageServiceEnabled: boolean,
private compilerOptions: CompilerOptions,
public compileOnSaveEnabled: boolean) {
@@ -165,10 +251,13 @@ namespace ts.server {
this.compilerOptions.noEmitForJsFiles = true;
}
if (languageServiceEnabled) {
this.enableLanguageService();
}
else {
this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken);
this.lsHost.setCompilationSettings(this.compilerOptions);
this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry);
this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService);
if (!languageServiceEnabled) {
this.disableLanguageService();
}
@@ -184,7 +273,9 @@ namespace ts.server {
if (ensureSynchronized) {
this.updateGraph();
}
return this.languageService;
return this.languageServiceEnabled
? this.languageService
: this.noSemanticFeaturesLanguageService;
}
getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[] {
@@ -200,18 +291,20 @@ namespace ts.server {
}
enableLanguageService() {
const lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken);
lsHost.setCompilationSettings(this.compilerOptions);
this.languageService = ts.createLanguageService(lsHost, this.documentRegistry);
this.lsHost = lsHost;
if (this.languageServiceEnabled) {
return;
}
this.languageServiceEnabled = true;
this.projectService.onUpdateLanguageServiceStateForProject(this, /*languageServiceEnabled*/ true);
}
disableLanguageService() {
this.languageService = nullLanguageService;
this.lsHost = nullLanguageServiceHost;
if (!this.languageServiceEnabled) {
return;
}
this.languageService.cleanupSemanticCache();
this.languageServiceEnabled = false;
this.projectService.onUpdateLanguageServiceStateForProject(this, /*languageServiceEnabled*/ false);
}
abstract getProjectName(): string;
@@ -676,12 +769,12 @@ namespace ts.server {
// Used to keep track of what directories are watched for this project
directoriesWatchedForTsconfig: string[] = [];
constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, languageServiceEnabled: boolean, compilerOptions: CompilerOptions) {
constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions) {
super(ProjectKind.Inferred,
projectService,
documentRegistry,
/*files*/ undefined,
languageServiceEnabled,
/*languageServiceEnabled*/ true,
compilerOptions,
/*compileOnSaveEnabled*/ false);
+25
View File
@@ -1814,6 +1814,27 @@ namespace ts.server.protocol {
event: "configFileDiag";
}
export type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
export interface ProjectLanguageServiceStateEvent extends Event {
event: ProjectLanguageServiceStateEventName;
body?: ProjectLanguageServiceStateEventBody;
}
export interface ProjectLanguageServiceStateEventBody {
/**
* Project name that has changes in the state of language service.
* For configured projects this will be the config file path.
* For external projects this will be the name of the projects specified when project was open.
* For inferred projects this event is not raised.
*/
projectName: string;
/**
* True if language service state switched from disabled to enabled
* and false otherwise.
*/
languageServiceEnabled: boolean;
}
/**
* Arguments for reload request.
*/
@@ -2081,6 +2102,10 @@ namespace ts.server.protocol {
* Comma separated list of installed typing packages
*/
installedPackages: string;
/**
* true if install request succeeded, otherwise - false
*/
installSuccess: boolean;
}
export interface NavBarResponse extends Response {
+2 -1
View File
@@ -299,7 +299,8 @@ namespace ts.server {
const body: protocol.TypingsInstalledTelemetryEventBody = {
telemetryEventName: "typingsInstalled",
payload: {
installedPackages: response.packagesToInstall.join(",")
installedPackages: response.packagesToInstall.join(","),
installSuccess: response.installSuccess
}
};
const eventName: protocol.TelemetryEventName = "telemetry";
+10 -2
View File
@@ -199,15 +199,23 @@ namespace ts.server {
private defaultEventHandler(event: ProjectServiceEvent) {
switch (event.eventName) {
case "context":
case ContextEvent:
const { project, fileName } = event.data;
this.projectService.logger.info(`got context event, updating diagnostics for ${fileName}`);
this.updateErrorCheck([{ fileName, project }], this.changeSeq,
(n) => n === this.changeSeq, 100);
break;
case "configFileDiag":
case ConfigFileDiagEvent:
const { triggerFile, configFileName, diagnostics } = event.data;
this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics);
break;
case ProjectLanguageServiceStateEvent:
const eventName: protocol.ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
this.event(<protocol.ProjectLanguageServiceStateEventBody>{
projectName: event.data.project.getProjectName(),
languageServiceEnabled: event.data.languageServiceEnabled
}, eventName);
break;
}
}
+1
View File
@@ -68,6 +68,7 @@ declare namespace ts.server {
export interface TypingsInstallEvent extends TypingInstallerResponse {
readonly packagesToInstall: ReadonlyArray<string>;
readonly kind: EventInstall;
readonly installSuccess: boolean;
}
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
@@ -135,12 +135,12 @@ namespace ts.server.typingsInstaller {
}
const command = `${this.npmPath} install ${args.join(" ")} --save-dev`;
const start = Date.now();
this.exec(command, { cwd }, (_err, stdout, stderr) => {
this.exec(command, { cwd }, (err, stdout, stderr) => {
if (this.log.isEnabled()) {
this.log.writeLine(`npm install #${requestId} took: ${Date.now() - start} ms${sys.newLine}stdout: ${stdout}${sys.newLine}stderr: ${stderr}`);
}
// treat any output on stdout as success
onRequestCompleted(!!stdout);
// treat absence of error as success
onRequestCompleted(!err);
});
}
}
@@ -218,7 +218,7 @@ namespace ts.server.typingsInstaller {
this.knownCachesSet[cacheLocation] = true;
}
private filterAndMapToScopedName(typingsToInstall: string[]) {
private filterTypings(typingsToInstall: string[]) {
if (typingsToInstall.length === 0) {
return typingsToInstall;
}
@@ -230,7 +230,7 @@ namespace ts.server.typingsInstaller {
const validationResult = validatePackageName(typing);
if (validationResult === PackageNameValidationResult.Ok) {
if (typing in this.typesRegistry) {
result.push(`@types/${typing}`);
result.push(typing);
}
else {
if (this.log.isEnabled()) {
@@ -286,7 +286,8 @@ namespace ts.server.typingsInstaller {
if (this.log.isEnabled()) {
this.log.writeLine(`Installing typings ${JSON.stringify(typingsToInstall)}`);
}
const scopedTypings = this.filterAndMapToScopedName(typingsToInstall);
const filteredTypings = this.filterTypings(typingsToInstall);
const scopedTypings = filteredTypings.map(x => `@types/${x}`);
if (scopedTypings.length === 0) {
if (this.log.isEnabled()) {
this.log.writeLine(`All typings are known to be missing or invalid - no need to go any further`);
@@ -303,11 +304,18 @@ namespace ts.server.typingsInstaller {
if (this.telemetryEnabled) {
this.sendResponse(<TypingsInstallEvent>{
kind: EventInstall,
packagesToInstall: scopedTypings
packagesToInstall: scopedTypings,
installSuccess: ok
});
}
if (!ok) {
if (this.log.isEnabled()) {
this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`);
}
for (const typing of filteredTypings) {
this.missingTypingsSet[typing] = true;
}
return;
}
-63
View File
@@ -11,7 +11,6 @@ namespace ts.server {
export const emptyArray: ReadonlyArray<any> = [];
export interface Logger {
close(): void;
hasLevel(level: LogLevel): boolean;
@@ -160,68 +159,6 @@ namespace ts.server {
}
};
}
function throwLanguageServiceIsDisabledError(): never {
throw new Error("LanguageService is disabled");
}
export const nullLanguageService: LanguageService = {
cleanupSemanticCache: throwLanguageServiceIsDisabledError,
getSyntacticDiagnostics: throwLanguageServiceIsDisabledError,
getSemanticDiagnostics: throwLanguageServiceIsDisabledError,
getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError,
getSyntacticClassifications: throwLanguageServiceIsDisabledError,
getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError,
getSemanticClassifications: throwLanguageServiceIsDisabledError,
getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError,
getCompletionsAtPosition: throwLanguageServiceIsDisabledError,
findReferences: throwLanguageServiceIsDisabledError,
getCompletionEntryDetails: throwLanguageServiceIsDisabledError,
getQuickInfoAtPosition: throwLanguageServiceIsDisabledError,
findRenameLocations: throwLanguageServiceIsDisabledError,
getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError,
getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError,
getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError,
getSignatureHelpItems: throwLanguageServiceIsDisabledError,
getDefinitionAtPosition: throwLanguageServiceIsDisabledError,
getRenameInfo: throwLanguageServiceIsDisabledError,
getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError,
getReferencesAtPosition: throwLanguageServiceIsDisabledError,
getDocumentHighlights: throwLanguageServiceIsDisabledError,
getOccurrencesAtPosition: throwLanguageServiceIsDisabledError,
getNavigateToItems: throwLanguageServiceIsDisabledError,
getNavigationBarItems: throwLanguageServiceIsDisabledError,
getNavigationTree: throwLanguageServiceIsDisabledError,
getOutliningSpans: throwLanguageServiceIsDisabledError,
getTodoComments: throwLanguageServiceIsDisabledError,
getIndentationAtPosition: throwLanguageServiceIsDisabledError,
getFormattingEditsForRange: throwLanguageServiceIsDisabledError,
getFormattingEditsForDocument: throwLanguageServiceIsDisabledError,
getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError,
getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError,
isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError,
getEmitOutput: throwLanguageServiceIsDisabledError,
getProgram: throwLanguageServiceIsDisabledError,
getNonBoundSourceFile: throwLanguageServiceIsDisabledError,
dispose: throwLanguageServiceIsDisabledError,
getCompletionEntrySymbol: throwLanguageServiceIsDisabledError,
getImplementationAtPosition: throwLanguageServiceIsDisabledError,
getSourceFile: throwLanguageServiceIsDisabledError,
getCodeFixesAtPosition: throwLanguageServiceIsDisabledError
};
export interface ServerLanguageServiceHost {
setCompilationSettings(options: CompilerOptions): void;
notifyFileRemoved(info: ScriptInfo): void;
startRecordingFilesWithChangedResolutions(): void;
finishRecordingFilesWithChangedResolutions(): Path[];
}
export const nullLanguageServiceHost: ServerLanguageServiceHost = {
setCompilationSettings: () => undefined,
notifyFileRemoved: () => undefined,
startRecordingFilesWithChangedResolutions: () => undefined,
finishRecordingFilesWithChangedResolutions: () => undefined
};
export interface ProjectOptions {
/**
+1
View File
@@ -1 +1,2 @@
///<reference path='superFixes.ts' />
///<reference path='unusedIdentifierFixes.ts' />
@@ -0,0 +1,167 @@
/* @internal */
namespace ts.codefix {
registerCodeFix({
errorCodes: [
Diagnostics._0_is_declared_but_never_used.code,
Diagnostics.Property_0_is_declared_but_never_used.code
],
getCodeActions: (context: CodeFixContext) => {
const sourceFile = context.sourceFile;
const start = context.span.start;
let token = getTokenAtPosition(sourceFile, start);
// this handles var ["computed"] = 12;
if (token.kind === SyntaxKind.OpenBracketToken) {
token = getTokenAtPosition(sourceFile, start + 1);
}
switch (token.kind) {
case ts.SyntaxKind.Identifier:
switch (token.parent.kind) {
case ts.SyntaxKind.VariableDeclaration:
switch (token.parent.parent.parent.kind) {
case SyntaxKind.ForStatement:
const forStatement = <ForStatement>token.parent.parent.parent;
const forInitializer = <VariableDeclarationList>forStatement.initializer;
if (forInitializer.declarations.length === 1) {
return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos);
}
else {
return removeSingleItem(forInitializer.declarations, token);
}
case SyntaxKind.ForOfStatement:
const forOfStatement = <ForOfStatement>token.parent.parent.parent;
if (forOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
const forOfInitializer = <VariableDeclarationList>forOfStatement.initializer;
return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);
}
break;
case SyntaxKind.ForInStatement:
// There is no valid fix in the case of:
// for .. in
return undefined;
case SyntaxKind.CatchClause:
const catchClause = <CatchClause>token.parent.parent;
const parameter = catchClause.variableDeclaration.getChildren()[0];
return createCodeFix("", parameter.pos, parameter.end - parameter.pos);
default:
const variableStatement = <VariableStatement>token.parent.parent.parent;
if (variableStatement.declarationList.declarations.length === 1) {
return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos);
}
else {
const declarations = variableStatement.declarationList.declarations;
return removeSingleItem(declarations, token);
}
}
case SyntaxKind.TypeParameter:
const typeParameters = (<DeclarationWithTypeParameters>token.parent.parent).typeParameters;
if (typeParameters.length === 1) {
return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);
}
else {
return removeSingleItem(typeParameters, token);
}
case ts.SyntaxKind.Parameter:
const functionDeclaration = <FunctionDeclaration>token.parent.parent;
if (functionDeclaration.parameters.length === 1) {
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
}
else {
return removeSingleItem(functionDeclaration.parameters, token);
}
// handle case where 'import a = A;'
case SyntaxKind.ImportEqualsDeclaration:
const importEquals = findImportDeclaration(token);
return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
case SyntaxKind.ImportSpecifier:
const namedImports = <NamedImports>token.parent.parent;
if (namedImports.elements.length === 1) {
// Only 1 import and it is unused. So the entire declaration should be removed.
const importSpec = findImportDeclaration(token);
return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
}
else {
return removeSingleItem(namedImports.elements, token);
}
// handle case where "import d, * as ns from './file'"
// or "'import {a, b as ns} from './file'"
case SyntaxKind.ImportClause: // this covers both 'import |d|' and 'import |d,| *'
const importClause = <ImportClause>token.parent;
if (!importClause.namedBindings) { // |import d from './file'| or |import * as ns from './file'|
const importDecl = findImportDeclaration(importClause);
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
}
else { // import |d,| * as ns from './file'
return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);
}
case SyntaxKind.NamespaceImport:
const namespaceImport = <NamespaceImport>token.parent;
if (namespaceImport.name == token && !(<ImportClause>namespaceImport.parent).name) {
const importDecl = findImportDeclaration(namespaceImport);
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
}
else {
const start = (<ImportClause>namespaceImport.parent).name.end;
return createCodeFix("", start, (<ImportClause>namespaceImport.parent).namedBindings.end - start);
}
}
break;
case SyntaxKind.PropertyDeclaration:
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
case SyntaxKind.NamespaceImport:
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
}
if (isDeclarationName(token)) {
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
}
else if (isLiteralComputedPropertyDeclarationName(token)) {
return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);
}
else {
return undefined;
}
function findImportDeclaration(token: Node): Node {
let importDecl = token;
while (importDecl.kind != SyntaxKind.ImportDeclaration && importDecl.parent) {
importDecl = importDecl.parent;
}
return importDecl;
}
function createCodeFix(newText: string, start: number, length: number): CodeAction[] {
return [{
description: getLocaleSpecificMessage(Diagnostics.Remove_unused_identifiers),
changes: [{
fileName: sourceFile.fileName,
textChanges: [{ newText, span: { start, length } }]
}]
}];
}
function removeSingleItem<T extends Node>(elements: NodeArray<T>, token: T): CodeAction[] {
if (elements[0] === token.parent) {
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1);
}
else {
return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);
}
}
}
});
}
+1 -1
View File
@@ -1205,7 +1205,7 @@ namespace ts {
}
function cleanupSemanticCache(): void {
// TODO: Should we jettison the program (or it's type checker) here?
program = undefined;
}
function dispose(): void {
+8 -1
View File
@@ -1060,8 +1060,15 @@ namespace ts {
return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => {
const compilerOptions = <CompilerOptions>JSON.parse(compilerOptionsJson);
const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
const resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined;
if (resolvedFileName && !compilerOptions.allowJs && fileExtensionIs(resolvedFileName, ".js")) {
return {
resolvedFileName: undefined,
failedLookupLocations: []
};
}
return {
resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined,
resolvedFileName,
failedLookupLocations: result.failedLookupLocations
};
});
+3 -2
View File
@@ -1,4 +1,4 @@
{
{
"compilerOptions": {
"noImplicitAny": true,
"noImplicitThis": true,
@@ -12,7 +12,8 @@
"declaration": true,
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true
"noUnusedParameters": true,
"types": []
},
"files": [
"../compiler/core.ts",
@@ -1,128 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop1.ts(69,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop1.ts(86,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop1.ts(92,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop1.ts(109,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop1.ts (4 errors) ====
//==== let
for (let x in {}) {
(function() { return x});
(() => x);
}
for (let x of []) {
(function() { return x});
(() => x);
}
for (let x = 0; x < 1; ++x) {
(function() { return x});
(() => x);
}
while (1 === 1) {
let x;
(function() { return x});
(() => x);
}
do {
let x;
(function() { return x});
(() => x);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
(function() { return x});
(() => x);
}
for (let x = 0, y = 1; x < 1; ++x) {
(function() { return x + y});
(() => x + y);
}
while (1 === 1) {
let x, y;
(function() { return x + y});
(() => x + y);
}
do {
let x, y;
(function() { return x + y});
(() => x + y);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
(function() { return x + y});
(() => x + y);
}
//=========const
for (const x in {}) {
(function() { return x});
(() => x);
}
for (const x of []) {
(function() { return x});
(() => x);
}
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x});
(() => x);
}
while (1 === 1) {
const x = 1;
(function() { return x});
(() => x);
}
do {
const x = 1;
(function() { return x});
(() => x);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x});
(() => x);
}
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y});
(() => x + y);
}
while (1 === 1) {
const x = 1, y = 1;
(function() { return x + y});
(() => x + y);
}
do {
const x = 1, y = 1;
(function() { return x + y});
(() => x + y);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x + y});
(() => x + y);
}
@@ -32,10 +32,10 @@ for (let x of []) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -90,16 +90,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
@@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -188,16 +188,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
@@ -246,21 +246,21 @@ for (const x of []) {
}
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 0
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 0
}
while (1 === 1) {
@@ -269,34 +269,34 @@ while (1 === 1) {
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 1
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 1
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -304,49 +304,49 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 1
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
}
while (1 === 1) {
@@ -355,46 +355,46 @@ while (1 === 1) {
>1 : 1
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
}
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -402,27 +402,27 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
}
@@ -1,128 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(69,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(86,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(92,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(109,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop1_ES6.ts (4 errors) ====
//==== let
for (let x in {}) {
(function() { return x});
(() => x);
}
for (let x of []) {
(function() { return x});
(() => x);
}
for (let x = 0; x < 1; ++x) {
(function() { return x});
(() => x);
}
while (1 === 1) {
let x;
(function() { return x});
(() => x);
}
do {
let x;
(function() { return x});
(() => x);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
(function() { return x});
(() => x);
}
for (let x = 0, y = 1; x < 1; ++x) {
(function() { return x + y});
(() => x + y);
}
while (1 === 1) {
let x, y;
(function() { return x + y});
(() => x + y);
}
do {
let x, y;
(function() { return x + y});
(() => x + y);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
(function() { return x + y});
(() => x + y);
}
//=========const
for (const x in {}) {
(function() { return x});
(() => x);
}
for (const x of []) {
(function() { return x});
(() => x);
}
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x});
(() => x);
}
while (1 === 1) {
const x = 1;
(function() { return x});
(() => x);
}
do {
const x = 1;
(function() { return x});
(() => x);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x});
(() => x);
}
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y});
(() => x + y);
}
while (1 === 1) {
const x = 1, y = 1;
(function() { return x + y});
(() => x + y);
}
do {
const x = 1, y = 1;
(function() { return x + y});
(() => x + y);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x + y});
(() => x + y);
}
@@ -32,10 +32,10 @@ for (let x of []) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -90,16 +90,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
@@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -188,16 +188,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
@@ -246,21 +246,21 @@ for (const x of []) {
}
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 0
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 0
}
while (1 === 1) {
@@ -269,34 +269,34 @@ while (1 === 1) {
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 1
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 1
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -304,49 +304,49 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x});
>(function() { return x}) : () => number
>function() { return x} : () => number
>x : number
>x : 1
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
}
while (1 === 1) {
@@ -355,46 +355,46 @@ while (1 === 1) {
>1 : 1
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
}
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -402,27 +402,27 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x + y});
>(function() { return x + y}) : () => number
>function() { return x + y} : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
}
@@ -1,191 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop2.ts(108,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop2.ts(133,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop2.ts(142,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop2.ts(170,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop2.ts (4 errors) ====
// ========let
function foo0(x) {
for (let x of []) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo0_1(x) {
for (let x in []) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo1(x) {
for (let x = 0; x < 1; ++x) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo2(x) {
while (1 === 1) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo3(x) {
do {
let x;
let a = arguments.length;
(function() { return x + a });
(() => x + a);
} while (1 === 1)
}
function foo4(x) {
for (let y = 0; y < 1; ++y) {
let a = arguments.length;
let x = 1;
(function() { return x + a });
(() => x + a);
}
}
function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo6(x) {
while (1 === 1) {
let x, y;
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo7(x) {
do {
let x, y;
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
} while (1 === 1)
}
function foo8(x) {
for (let y = 0; y < 1; ++y) {
let x = 1;
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
///=======const
function foo0_c(x) {
for (const x of []) {
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo0_1_c(x) {
for (const x in []) {
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo1_c(x) {
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo2_c(x) {
while (1 === 1) {
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo3_c(x) {
do {
const x = 1;
const a = arguments.length;
(function() { return x + a });
(() => x + a);
} while (1 === 1)
}
function foo4_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const a = arguments.length;
const x = 1;
(function() { return x + a });
(() => x + a);
}
}
function foo5_c(x) {
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo6_c(x) {
while (1 === 1) {
const x = 1, y =1 ;
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo7_c(x) {
do {
const x = 1, y = 1;
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
} while (1 === 1)
}
function foo8_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
@@ -68,10 +68,10 @@ function foo1(x) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -168,10 +168,10 @@ function foo4(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
@@ -183,7 +183,7 @@ function foo4(x) {
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x + a });
>(function() { return x + a }) : () => number
@@ -207,12 +207,12 @@ function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -328,16 +328,16 @@ function foo8(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
let a = arguments.length;
>a : number
@@ -430,11 +430,11 @@ function foo1_c(x) {
>x : any
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
const a = arguments.length;
>a : number
@@ -446,14 +446,14 @@ function foo1_c(x) {
>(function() { return x + a }) : () => number
>function() { return x + a } : () => number
>x + a : number
>x : number
>x : 0
>a : number
(() => x + a);
>(() => x + a) : () => number
>() => x + a : () => number
>x + a : number
>x : number
>x : 0
>a : number
}
}
@@ -495,8 +495,8 @@ function foo3_c(x) {
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -508,14 +508,14 @@ function foo3_c(x) {
>(function() { return x + a }) : () => number
>function() { return x + a } : () => number
>x + a : number
>x : number
>x : 1
>a : number
(() => x + a);
>(() => x + a) : () => number
>() => x + a : () => number
>x + a : number
>x : number
>x : 1
>a : number
} while (1 === 1)
@@ -529,11 +529,11 @@ function foo4_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const a = arguments.length;
>a : number
@@ -542,21 +542,21 @@ function foo4_c(x) {
>length : number
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x + a });
>(function() { return x + a }) : () => number
>function() { return x + a } : () => number
>x + a : number
>x : number
>x : 1
>a : number
(() => x + a);
>(() => x + a) : () => number
>() => x + a : () => number
>x + a : number
>x : number
>x : 1
>a : number
}
}
@@ -566,13 +566,13 @@ function foo5_c(x) {
>x : any
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
const a = arguments.length;
>a : number
@@ -585,8 +585,8 @@ function foo5_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>a : number
(() => x + y + a);
@@ -594,8 +594,8 @@ function foo5_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>a : number
}
}
@@ -611,10 +611,10 @@ function foo6_c(x) {
>1 : 1
const x = 1, y =1 ;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -627,8 +627,8 @@ function foo6_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
(() => x + y + a);
@@ -636,8 +636,8 @@ function foo6_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
}
}
@@ -648,10 +648,10 @@ function foo7_c(x) {
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -664,8 +664,8 @@ function foo7_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
(() => x + y + a);
@@ -673,8 +673,8 @@ function foo7_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
} while (1 === 1)
@@ -689,15 +689,15 @@ function foo8_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -710,8 +710,8 @@ function foo8_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>a : number
(() => x + y + a);
@@ -719,8 +719,8 @@ function foo8_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>a : number
}
}
@@ -1,190 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(107,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(132,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(141,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(169,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop2_ES6.ts (4 errors) ====
// ========let
function foo0(x) {
for (let x of []) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo0_1(x) {
for (let x in []) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo1(x) {
for (let x = 0; x < 1; ++x) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo2(x) {
while (1 === 1) {
let a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo3(x) {
do {
let x;
let a = arguments.length;
(function() { return x + a });
(() => x + a);
} while (1 === 1)
}
function foo4(x) {
for (let y = 0; y < 1; ++y) {
let a = arguments.length;
let x = 1;
(function() { return x + a });
(() => x + a);
}
}
function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo6(x) {
while (1 === 1) {
let x, y;
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo7(x) {
do {
let x, y;
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
} while (1 === 1)
}
function foo8(x) {
for (let y = 0; y < 1; ++y) {
let x = 1;
let a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
///=======const
function foo0_c(x) {
for (const x of []) {
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo0_1_c(x) {
for (const x in []) {
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo1_c(x) {
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo2_c(x) {
while (1 === 1) {
const a = arguments.length;
(function() { return x + a });
(() => x + a);
}
}
function foo3_c(x) {
do {
const x = 1;
const a = arguments.length;
(function() { return x + a });
(() => x + a);
} while (1 === 1)
}
function foo4_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const a = arguments.length;
const x = 1;
(function() { return x + a });
(() => x + a);
}
}
function foo5_c(x) {
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo6_c(x) {
while (1 === 1) {
const x = 1, y =1 ;
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
function foo7_c(x) {
do {
const x = 1, y = 1;
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
} while (1 === 1)
}
function foo8_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
const a = arguments.length;
(function() { return x + y + a });
(() => x + y + a);
}
}
@@ -67,10 +67,10 @@ function foo1(x) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -167,10 +167,10 @@ function foo4(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
@@ -182,7 +182,7 @@ function foo4(x) {
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x + a });
>(function() { return x + a }) : () => number
@@ -206,12 +206,12 @@ function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -327,16 +327,16 @@ function foo8(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
let a = arguments.length;
>a : number
@@ -429,11 +429,11 @@ function foo1_c(x) {
>x : any
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
const a = arguments.length;
>a : number
@@ -445,14 +445,14 @@ function foo1_c(x) {
>(function() { return x + a }) : () => number
>function() { return x + a } : () => number
>x + a : number
>x : number
>x : 0
>a : number
(() => x + a);
>(() => x + a) : () => number
>() => x + a : () => number
>x + a : number
>x : number
>x : 0
>a : number
}
}
@@ -494,8 +494,8 @@ function foo3_c(x) {
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -507,14 +507,14 @@ function foo3_c(x) {
>(function() { return x + a }) : () => number
>function() { return x + a } : () => number
>x + a : number
>x : number
>x : 1
>a : number
(() => x + a);
>(() => x + a) : () => number
>() => x + a : () => number
>x + a : number
>x : number
>x : 1
>a : number
} while (1 === 1)
@@ -528,11 +528,11 @@ function foo4_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const a = arguments.length;
>a : number
@@ -541,21 +541,21 @@ function foo4_c(x) {
>length : number
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x + a });
>(function() { return x + a }) : () => number
>function() { return x + a } : () => number
>x + a : number
>x : number
>x : 1
>a : number
(() => x + a);
>(() => x + a) : () => number
>() => x + a : () => number
>x + a : number
>x : number
>x : 1
>a : number
}
}
@@ -565,13 +565,13 @@ function foo5_c(x) {
>x : any
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
const a = arguments.length;
>a : number
@@ -584,8 +584,8 @@ function foo5_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>a : number
(() => x + y + a);
@@ -593,8 +593,8 @@ function foo5_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>a : number
}
}
@@ -610,10 +610,10 @@ function foo6_c(x) {
>1 : 1
const x = 1, y =1 ;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -626,8 +626,8 @@ function foo6_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
(() => x + y + a);
@@ -635,8 +635,8 @@ function foo6_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
}
}
@@ -647,10 +647,10 @@ function foo7_c(x) {
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -663,8 +663,8 @@ function foo7_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
(() => x + y + a);
@@ -672,8 +672,8 @@ function foo7_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>a : number
} while (1 === 1)
@@ -688,15 +688,15 @@ function foo8_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
const a = arguments.length;
>a : number
@@ -709,8 +709,8 @@ function foo8_c(x) {
>function() { return x + y + a } : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>a : number
(() => x + y + a);
@@ -718,8 +718,8 @@ function foo8_c(x) {
>() => x + y + a : () => number
>x + y + a : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>a : number
}
}
@@ -1,232 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop3.ts(132,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop3.ts(164,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop3.ts(175,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop3.ts(209,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop3.ts (4 errors) ====
///=========let
declare function use(a: any);
function foo0(x) {
for (let x of []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo0_1(x) {
for (let x in []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo1(x) {
for (let x = 0; x < 1; ++x) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo2(x) {
while (1 === 1) {
let x = 1;
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo3(x) {
do {
let x;
var v;
(function() { return x + v });
(() => x + v);
} while (1 === 1);
use(v);
}
function foo4(x) {
for (let y = 0; y < 1; ++y) {
var v = y;
let x = 1;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
function foo6(x) {
while (1 === 1) {
let x, y;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v)
}
function foo7(x) {
do {
let x, y;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
} while (1 === 1);
use(v);
}
function foo8(x) {
for (let y = 0; y < 1; ++y) {
let x = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
//===const
function foo0_c(x) {
for (const x of []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo0_1_c(x) {
for (const x in []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo1_c(x) {
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo2_c(x) {
while (1 === 1) {
const x = 1;
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo3_c(x) {
do {
const x = 1;
var v;
(function() { return x + v });
(() => x + v);
} while (1 === 1);
use(v);
}
function foo4_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = y;
const x = 1;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo5_c(x) {
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
function foo6_c(x) {
while (1 === 1) {
const x = 1, y = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v)
}
function foo7_c(x) {
do {
const x = 1, y = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
} while (1 === 1);
use(v);
}
function foo8_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
@@ -76,10 +76,10 @@ function foo1(x) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -119,7 +119,7 @@ function foo2(x) {
let x = 1;
>x : number
>1 : number
>1 : 1
var v = x;
>v : number
@@ -179,7 +179,7 @@ function foo3(x) {
use(v);
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
function foo4(x) {
@@ -188,10 +188,10 @@ function foo4(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
@@ -201,7 +201,7 @@ function foo4(x) {
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x + v });
>(function() { return x + v }) : () => number
@@ -230,12 +230,12 @@ function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -283,8 +283,8 @@ function foo6(x) {
>y : any
var v = x;
>v : any
>x : any
>v : undefined
>x : undefined
(function() { return x + y + v });
>(function() { return x + y + v }) : () => any
@@ -293,7 +293,7 @@ function foo6(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
(() => x + y + v);
>(() => x + y + v) : () => any
@@ -302,13 +302,13 @@ function foo6(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
}
use(v)
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
function foo7(x) {
@@ -321,8 +321,8 @@ function foo7(x) {
>y : any
var v = x;
>v : any
>x : any
>v : undefined
>x : undefined
(function() { return x + y + v });
>(function() { return x + y + v }) : () => any
@@ -331,7 +331,7 @@ function foo7(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
(() => x + y + v);
>(() => x + y + v) : () => any
@@ -340,7 +340,7 @@ function foo7(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
} while (1 === 1);
>1 === 1 : boolean
@@ -350,7 +350,7 @@ function foo7(x) {
use(v);
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
@@ -360,16 +360,16 @@ function foo8(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
var v = x;
>v : number
@@ -471,28 +471,28 @@ function foo1_c(x) {
>x : any
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v = x;
>v : number
>x : number
>x : 0
(function() { return x + v });
>(function() { return x + v }) : () => number
>function() { return x + v } : () => number
>x + v : number
>x : number
>x : 0
>v : number
(() => x + v);
>(() => x + v) : () => number
>() => x + v : () => number
>x + v : number
>x : number
>x : 0
>v : number
}
@@ -512,25 +512,25 @@ function foo2_c(x) {
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + v });
>(function() { return x + v }) : () => number
>function() { return x + v } : () => number
>x + v : number
>x : number
>x : 1
>v : number
(() => x + v);
>(() => x + v) : () => number
>() => x + v : () => number
>x + v : number
>x : number
>x : 1
>v : number
}
@@ -546,8 +546,8 @@ function foo3_c(x) {
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v;
>v : any
@@ -556,14 +556,14 @@ function foo3_c(x) {
>(function() { return x + v }) : () => any
>function() { return x + v } : () => any
>x + v : any
>x : number
>x : 1
>v : any
(() => x + v);
>(() => x + v) : () => any
>() => x + v : () => any
>x + v : any
>x : number
>x : 1
>v : any
} while (1 === 1);
@@ -574,7 +574,7 @@ function foo3_c(x) {
use(v);
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
function foo4_c(x) {
@@ -582,32 +582,32 @@ function foo4_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
var v = y;
>v : number
>y : number
>y : 0
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x + v });
>(function() { return x + v }) : () => number
>function() { return x + v } : () => number
>x + v : number
>x : number
>x : 1
>v : number
(() => x + v);
>(() => x + v) : () => number
>() => x + v : () => number
>x + v : number
>x : number
>x : 1
>v : number
}
@@ -622,25 +622,25 @@ function foo5_c(x) {
>x : any
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v = x;
>v : number
>x : number
>x : 0
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>v : number
(() => x + y + v);
@@ -648,8 +648,8 @@ function foo5_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>v : number
}
@@ -670,22 +670,22 @@ function foo6_c(x) {
>1 : 1
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
(() => x + y + v);
@@ -693,8 +693,8 @@ function foo6_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
}
@@ -710,22 +710,22 @@ function foo7_c(x) {
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
(() => x + y + v);
@@ -733,8 +733,8 @@ function foo7_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
} while (1 === 1);
@@ -754,27 +754,27 @@ function foo8_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>v : number
(() => x + y + v);
@@ -782,8 +782,8 @@ function foo8_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>v : number
}
@@ -1,233 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(133,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(165,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(176,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(210,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop3_ES6.ts (4 errors) ====
///=========let
declare function use(a: any);
function foo0(x) {
for (let x of []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo0_1(x) {
for (let x in []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo1(x) {
for (let x = 0; x < 1; ++x) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo2(x) {
while (1 === 1) {
let x = 1;
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo3(x) {
do {
let x;
var v;
(function() { return x + v });
(() => x + v);
} while (1 === 1);
use(v);
}
function foo4(x) {
for (let y = 0; y < 1; ++y) {
var v = y;
let x = 1;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
function foo6(x) {
while (1 === 1) {
let x, y;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v)
}
function foo7(x) {
do {
let x, y;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
} while (1 === 1);
use(v);
}
function foo8(x) {
for (let y = 0; y < 1; ++y) {
let x = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
//===const
function foo0_c(x) {
for (const x of []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo0_1_c(x) {
for (const x in []) {
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo1_c(x) {
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo2_c(x) {
while (1 === 1) {
const x = 1;
var v = x;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo3_c(x) {
do {
const x = 1;
var v;
(function() { return x + v });
(() => x + v);
} while (1 === 1);
use(v);
}
function foo4_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = y;
const x = 1;
(function() { return x + v });
(() => x + v);
}
use(v);
}
function foo5_c(x) {
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
function foo6_c(x) {
while (1 === 1) {
const x = 1, y = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v)
}
function foo7_c(x) {
do {
const x = 1, y = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
} while (1 === 1);
use(v);
}
function foo8_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v = x;
(function() { return x + y + v });
(() => x + y + v);
}
use(v);
}
@@ -77,10 +77,10 @@ function foo1(x) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -120,7 +120,7 @@ function foo2(x) {
let x = 1;
>x : number
>1 : number
>1 : 1
var v = x;
>v : number
@@ -180,7 +180,7 @@ function foo3(x) {
use(v);
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
function foo4(x) {
@@ -189,10 +189,10 @@ function foo4(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
@@ -202,7 +202,7 @@ function foo4(x) {
let x = 1;
>x : number
>1 : number
>1 : 1
(function() { return x + v });
>(function() { return x + v }) : () => number
@@ -231,12 +231,12 @@ function foo5(x) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -284,8 +284,8 @@ function foo6(x) {
>y : any
var v = x;
>v : any
>x : any
>v : undefined
>x : undefined
(function() { return x + y + v });
>(function() { return x + y + v }) : () => any
@@ -294,7 +294,7 @@ function foo6(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
(() => x + y + v);
>(() => x + y + v) : () => any
@@ -303,13 +303,13 @@ function foo6(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
}
use(v)
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
function foo7(x) {
@@ -322,8 +322,8 @@ function foo7(x) {
>y : any
var v = x;
>v : any
>x : any
>v : undefined
>x : undefined
(function() { return x + y + v });
>(function() { return x + y + v }) : () => any
@@ -332,7 +332,7 @@ function foo7(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
(() => x + y + v);
>(() => x + y + v) : () => any
@@ -341,7 +341,7 @@ function foo7(x) {
>x + y : any
>x : any
>y : any
>v : any
>v : undefined
} while (1 === 1);
>1 === 1 : boolean
@@ -351,7 +351,7 @@ function foo7(x) {
use(v);
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
@@ -361,16 +361,16 @@ function foo8(x) {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
var v = x;
>v : number
@@ -472,28 +472,28 @@ function foo1_c(x) {
>x : any
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v = x;
>v : number
>x : number
>x : 0
(function() { return x + v });
>(function() { return x + v }) : () => number
>function() { return x + v } : () => number
>x + v : number
>x : number
>x : 0
>v : number
(() => x + v);
>(() => x + v) : () => number
>() => x + v : () => number
>x + v : number
>x : number
>x : 0
>v : number
}
@@ -513,25 +513,25 @@ function foo2_c(x) {
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + v });
>(function() { return x + v }) : () => number
>function() { return x + v } : () => number
>x + v : number
>x : number
>x : 1
>v : number
(() => x + v);
>(() => x + v) : () => number
>() => x + v : () => number
>x + v : number
>x : number
>x : 1
>v : number
}
@@ -547,8 +547,8 @@ function foo3_c(x) {
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v;
>v : any
@@ -557,14 +557,14 @@ function foo3_c(x) {
>(function() { return x + v }) : () => any
>function() { return x + v } : () => any
>x + v : any
>x : number
>x : 1
>v : any
(() => x + v);
>(() => x + v) : () => any
>() => x + v : () => any
>x + v : any
>x : number
>x : 1
>v : any
} while (1 === 1);
@@ -575,7 +575,7 @@ function foo3_c(x) {
use(v);
>use(v) : any
>use : (a: any) => any
>v : any
>v : undefined
}
function foo4_c(x) {
@@ -583,32 +583,32 @@ function foo4_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
var v = y;
>v : number
>y : number
>y : 0
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
(function() { return x + v });
>(function() { return x + v }) : () => number
>function() { return x + v } : () => number
>x + v : number
>x : number
>x : 1
>v : number
(() => x + v);
>(() => x + v) : () => number
>() => x + v : () => number
>x + v : number
>x : number
>x : 1
>v : number
}
@@ -623,25 +623,25 @@ function foo5_c(x) {
>x : any
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v = x;
>v : number
>x : number
>x : 0
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>v : number
(() => x + y + v);
@@ -649,8 +649,8 @@ function foo5_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>v : number
}
@@ -671,22 +671,22 @@ function foo6_c(x) {
>1 : 1
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
(() => x + y + v);
@@ -694,8 +694,8 @@ function foo6_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
}
@@ -711,22 +711,22 @@ function foo7_c(x) {
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
(() => x + y + v);
@@ -734,8 +734,8 @@ function foo7_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v : number
} while (1 === 1);
@@ -755,27 +755,27 @@ function foo8_c(x) {
>x : any
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v = x;
>v : number
>x : number
>x : 1
(function() { return x + y + v });
>(function() { return x + y + v }) : () => number
>function() { return x + y + v } : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>v : number
(() => x + y + v);
@@ -783,8 +783,8 @@ function foo8_c(x) {
>() => x + y + v : () => number
>x + y + v : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>v : number
}
@@ -1,158 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop4.ts(90,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop4.ts(110,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop4.ts(117,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop4.ts(137,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop4.ts (4 errors) ====
//======let
export function exportedFoo() {
return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8;
}
for (let x of []) {
var v0 = x;
(function() { return x + v0});
(() => x);
}
for (let x in []) {
var v00 = x;
(function() { return x + v00});
(() => x);
}
for (let x = 0; x < 1; ++x) {
var v1 = x;
(function() { return x + v1});
(() => x);
}
while (1 === 1) {
let x;
var v2 = x;
(function() { return x + v2});
(() => x);
}
do {
let x;
var v3 = x;
(function() { return x + v3});
(() => x);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
var v4 = x;
(function() { return x + v4});
(() => x);
}
for (let x = 0, y = 1; x < 1; ++x) {
var v5 = x;
(function() { return x + y + v5});
(() => x + y);
}
while (1 === 1) {
let x, y;
var v6 = x;
(function() { return x + y + v6});
(() => x + y);
}
do {
let x, y;
var v7 = x;
(function() { return x + y + v7});
(() => x + y);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
var v8 = x;
(function() { return x + y + v8});
(() => x + y);
}
//======const
export function exportedFoo2() {
return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c;
}
for (const x of []) {
var v0_c = x;
(function() { return x + v0_c});
(() => x);
}
for (const x in []) {
var v00_c = x;
(function() { return x + v00});
(() => x);
}
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v1_c = x;
(function() { return x + v1_c});
(() => x);
}
while (1 === 1) {
const x =1;
var v2_c = x;
(function() { return x + v2_c});
(() => x);
}
do {
const x = 1;
var v3_c = x;
(function() { return x + v3_c});
(() => x);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v4_c = x;
(function() { return x + v4_c});
(() => x);
}
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v5_c = x;
(function() { return x + y + v5_c});
(() => x + y);
}
while (1 === 1) {
const x = 1, y = 1;
var v6_c = x;
(function() { return x + y + v6_c});
(() => x + y);
}
do {
const x = 1, y = 1;
var v7_c = x;
(function() { return x + y + v7_c});
(() => x + y);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v8_c = x;
(function() { return x + y + v8_c});
(() => x + y);
}
@@ -17,12 +17,12 @@ export function exportedFoo() {
>v0 : any
>v00 : string
>v1 : number
>v2 : any
>v3 : any
>v2 : undefined
>v3 : undefined
>v4 : number
>v5 : number
>v6 : any
>v7 : any
>v6 : undefined
>v7 : undefined
>v8 : number
}
@@ -70,10 +70,10 @@ for (let x in []) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -103,15 +103,15 @@ while (1 === 1) {
>x : any
var v2 = x;
>v2 : any
>x : any
>v2 : undefined
>x : undefined
(function() { return x + v2});
>(function() { return x + v2}) : () => any
>function() { return x + v2} : () => any
>x + v2 : any
>x : any
>v2 : any
>v2 : undefined
(() => x);
>(() => x) : () => any
@@ -124,15 +124,15 @@ do {
>x : any
var v3 = x;
>v3 : any
>x : any
>v3 : undefined
>x : undefined
(function() { return x + v3});
>(function() { return x + v3}) : () => any
>function() { return x + v3} : () => any
>x + v3 : any
>x : any
>v3 : any
>v3 : undefined
(() => x);
>(() => x) : () => any
@@ -146,16 +146,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
var v4 = x;
>v4 : number
@@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -216,8 +216,8 @@ while (1 === 1) {
>y : any
var v6 = x;
>v6 : any
>x : any
>v6 : undefined
>x : undefined
(function() { return x + y + v6});
>(function() { return x + y + v6}) : () => any
@@ -226,7 +226,7 @@ while (1 === 1) {
>x + y : any
>x : any
>y : any
>v6 : any
>v6 : undefined
(() => x + y);
>(() => x + y) : () => any
@@ -242,8 +242,8 @@ do {
>y : any
var v7 = x;
>v7 : any
>x : any
>v7 : undefined
>x : undefined
(function() { return x + y + v7});
>(function() { return x + y + v7}) : () => any
@@ -252,7 +252,7 @@ do {
>x + y : any
>x : any
>y : any
>v7 : any
>v7 : undefined
(() => x + y);
>(() => x + y) : () => any
@@ -268,16 +268,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
var v8 = x;
>v8 : number
@@ -369,27 +369,27 @@ for (const x in []) {
}
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v1_c = x;
>v1_c : number
>x : number
>x : 0
(function() { return x + v1_c});
>(function() { return x + v1_c}) : () => number
>function() { return x + v1_c} : () => number
>x + v1_c : number
>x : number
>x : 0
>v1_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 0
}
while (1 === 1) {
@@ -398,46 +398,46 @@ while (1 === 1) {
>1 : 1
const x =1;
>x : number
>1 : number
>x : 1
>1 : 1
var v2_c = x;
>v2_c : number
>x : number
>x : 1
(function() { return x + v2_c});
>(function() { return x + v2_c}) : () => number
>function() { return x + v2_c} : () => number
>x + v2_c : number
>x : number
>x : 1
>v2_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v3_c = x;
>v3_c : number
>x : number
>x : 1
(function() { return x + v3_c});
>(function() { return x + v3_c}) : () => number
>function() { return x + v3_c} : () => number
>x + v3_c : number
>x : number
>x : 1
>v3_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -445,61 +445,61 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v4_c = x;
>v4_c : number
>x : number
>x : 1
(function() { return x + v4_c});
>(function() { return x + v4_c}) : () => number
>function() { return x + v4_c} : () => number
>x + v4_c : number
>x : number
>x : 1
>v4_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v5_c = x;
>v5_c : number
>x : number
>x : 0
(function() { return x + y + v5_c});
>(function() { return x + y + v5_c}) : () => number
>function() { return x + y + v5_c} : () => number
>x + y + v5_c : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>v5_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
}
while (1 === 1) {
@@ -508,58 +508,58 @@ while (1 === 1) {
>1 : 1
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v6_c = x;
>v6_c : number
>x : number
>x : 1
(function() { return x + y + v6_c});
>(function() { return x + y + v6_c}) : () => number
>function() { return x + y + v6_c} : () => number
>x + y + v6_c : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v6_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
}
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v7_c = x;
>v7_c : number
>x : number
>x : 1
(function() { return x + y + v7_c});
>(function() { return x + y + v7_c}) : () => number
>function() { return x + y + v7_c} : () => number
>x + y + v7_c : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v7_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -567,34 +567,34 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v8_c = x;
>v8_c : number
>x : number
>x : 1
(function() { return x + y + v8_c});
>(function() { return x + y + v8_c}) : () => number
>function() { return x + y + v8_c} : () => number
>x + y + v8_c : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>v8_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
}
@@ -1,158 +0,0 @@
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(90,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(110,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(117,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(137,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop4_ES6.ts (4 errors) ====
//======let
export function exportedFoo() {
return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8;
}
for (let x of []) {
var v0 = x;
(function() { return x + v0});
(() => x);
}
for (let x in []) {
var v00 = x;
(function() { return x + v00});
(() => x);
}
for (let x = 0; x < 1; ++x) {
var v1 = x;
(function() { return x + v1});
(() => x);
}
while (1 === 1) {
let x;
var v2 = x;
(function() { return x + v2});
(() => x);
}
do {
let x;
var v3 = x;
(function() { return x + v3});
(() => x);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
var v4 = x;
(function() { return x + v4});
(() => x);
}
for (let x = 0, y = 1; x < 1; ++x) {
var v5 = x;
(function() { return x + y + v5});
(() => x + y);
}
while (1 === 1) {
let x, y;
var v6 = x;
(function() { return x + y + v6});
(() => x + y);
}
do {
let x, y;
var v7 = x;
(function() { return x + y + v7});
(() => x + y);
} while (1 === 1)
for (let y = 0; y < 1; ++y) {
let x = 1;
var v8 = x;
(function() { return x + y + v8});
(() => x + y);
}
//======const
export function exportedFoo2() {
return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c;
}
for (const x of []) {
var v0_c = x;
(function() { return x + v0_c});
(() => x);
}
for (const x in []) {
var v00_c = x;
(function() { return x + v00});
(() => x);
}
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v1_c = x;
(function() { return x + v1_c});
(() => x);
}
while (1 === 1) {
const x =1;
var v2_c = x;
(function() { return x + v2_c});
(() => x);
}
do {
const x = 1;
var v3_c = x;
(function() { return x + v3_c});
(() => x);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v4_c = x;
(function() { return x + v4_c});
(() => x);
}
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v5_c = x;
(function() { return x + y + v5_c});
(() => x + y);
}
while (1 === 1) {
const x = 1, y = 1;
var v6_c = x;
(function() { return x + y + v6_c});
(() => x + y);
}
do {
const x = 1, y = 1;
var v7_c = x;
(function() { return x + y + v7_c});
(() => x + y);
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v8_c = x;
(function() { return x + y + v8_c});
(() => x + y);
}
@@ -17,12 +17,12 @@ export function exportedFoo() {
>v0 : any
>v00 : string
>v1 : number
>v2 : any
>v3 : any
>v2 : undefined
>v3 : undefined
>v4 : number
>v5 : number
>v6 : any
>v7 : any
>v6 : undefined
>v7 : undefined
>v8 : number
}
@@ -70,10 +70,10 @@ for (let x in []) {
for (let x = 0; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -103,15 +103,15 @@ while (1 === 1) {
>x : any
var v2 = x;
>v2 : any
>x : any
>v2 : undefined
>x : undefined
(function() { return x + v2});
>(function() { return x + v2}) : () => any
>function() { return x + v2} : () => any
>x + v2 : any
>x : any
>v2 : any
>v2 : undefined
(() => x);
>(() => x) : () => any
@@ -124,15 +124,15 @@ do {
>x : any
var v3 = x;
>v3 : any
>x : any
>v3 : undefined
>x : undefined
(function() { return x + v3});
>(function() { return x + v3}) : () => any
>function() { return x + v3} : () => any
>x + v3 : any
>x : any
>v3 : any
>v3 : undefined
(() => x);
>(() => x) : () => any
@@ -146,16 +146,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
var v4 = x;
>v4 : number
@@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) {
for (let x = 0, y = 1; x < 1; ++x) {
>x : number
>0 : number
>0 : 0
>y : number
>1 : number
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>1 : 1
>++x : number
>x : number
@@ -216,8 +216,8 @@ while (1 === 1) {
>y : any
var v6 = x;
>v6 : any
>x : any
>v6 : undefined
>x : undefined
(function() { return x + y + v6});
>(function() { return x + y + v6}) : () => any
@@ -226,7 +226,7 @@ while (1 === 1) {
>x + y : any
>x : any
>y : any
>v6 : any
>v6 : undefined
(() => x + y);
>(() => x + y) : () => any
@@ -242,8 +242,8 @@ do {
>y : any
var v7 = x;
>v7 : any
>x : any
>v7 : undefined
>x : undefined
(function() { return x + y + v7});
>(function() { return x + y + v7}) : () => any
@@ -252,7 +252,7 @@ do {
>x + y : any
>x : any
>y : any
>v7 : any
>v7 : undefined
(() => x + y);
>(() => x + y) : () => any
@@ -268,16 +268,16 @@ do {
for (let y = 0; y < 1; ++y) {
>y : number
>0 : number
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>1 : 1
>++y : number
>y : number
let x = 1;
>x : number
>1 : number
>1 : 1
var v8 = x;
>v8 : number
@@ -369,27 +369,27 @@ for (const x in []) {
}
for (const x = 0; x < 1;) {
>x : number
>0 : number
>x : 0
>0 : 0
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v1_c = x;
>v1_c : number
>x : number
>x : 0
(function() { return x + v1_c});
>(function() { return x + v1_c}) : () => number
>function() { return x + v1_c} : () => number
>x + v1_c : number
>x : number
>x : 0
>v1_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 0
}
while (1 === 1) {
@@ -398,46 +398,46 @@ while (1 === 1) {
>1 : 1
const x =1;
>x : number
>1 : number
>x : 1
>1 : 1
var v2_c = x;
>v2_c : number
>x : number
>x : 1
(function() { return x + v2_c});
>(function() { return x + v2_c}) : () => number
>function() { return x + v2_c} : () => number
>x + v2_c : number
>x : number
>x : 1
>v2_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
do {
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v3_c = x;
>v3_c : number
>x : number
>x : 1
(function() { return x + v3_c});
>(function() { return x + v3_c}) : () => number
>function() { return x + v3_c} : () => number
>x + v3_c : number
>x : number
>x : 1
>v3_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -445,61 +445,61 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v4_c = x;
>v4_c : number
>x : number
>x : 1
(function() { return x + v4_c});
>(function() { return x + v4_c}) : () => number
>function() { return x + v4_c} : () => number
>x + v4_c : number
>x : number
>x : 1
>v4_c : number
(() => x);
>(() => x) : () => number
>() => x : () => number
>x : number
>x : 1
}
for (const x = 0, y = 1; x < 1;) {
>x : number
>0 : number
>y : number
>1 : number
>x : 0
>0 : 0
>y : 1
>1 : 1
>x < 1 : boolean
>x : number
>1 : number
>x : 0
>1 : 1
var v5_c = x;
>v5_c : number
>x : number
>x : 0
(function() { return x + y + v5_c});
>(function() { return x + y + v5_c}) : () => number
>function() { return x + y + v5_c} : () => number
>x + y + v5_c : number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
>v5_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 0
>y : 1
}
while (1 === 1) {
@@ -508,58 +508,58 @@ while (1 === 1) {
>1 : 1
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v6_c = x;
>v6_c : number
>x : number
>x : 1
(function() { return x + y + v6_c});
>(function() { return x + y + v6_c}) : () => number
>function() { return x + y + v6_c} : () => number
>x + y + v6_c : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v6_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
}
do {
const x = 1, y = 1;
>x : number
>1 : number
>y : number
>1 : number
>x : 1
>1 : 1
>y : 1
>1 : 1
var v7_c = x;
>v7_c : number
>x : number
>x : 1
(function() { return x + y + v7_c});
>(function() { return x + y + v7_c}) : () => number
>function() { return x + y + v7_c} : () => number
>x + y + v7_c : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
>v7_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 1
} while (1 === 1)
>1 === 1 : boolean
@@ -567,34 +567,34 @@ do {
>1 : 1
for (const y = 0; y < 1;) {
>y : number
>0 : number
>y : 0
>0 : 0
>y < 1 : boolean
>y : number
>1 : number
>y : 0
>1 : 1
const x = 1;
>x : number
>1 : number
>x : 1
>1 : 1
var v8_c = x;
>v8_c : number
>x : number
>x : 1
(function() { return x + y + v8_c});
>(function() { return x + y + v8_c}) : () => number
>function() { return x + y + v8_c} : () => number
>x + y + v8_c : number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
>v8_c : number
(() => x + y);
>(() => x + y) : () => number
>() => x + y : () => number
>x + y : number
>x : number
>y : number
>x : 1
>y : 0
}
@@ -1,12 +1,8 @@
tests/cases/compiler/capturedLetConstInLoop5.ts(170,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5.ts(174,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5.ts(211,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5.ts(225,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5.ts(229,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop5.ts (6 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop5.ts (2 errors) ====
declare function use(a: any);
//====let
@@ -177,8 +173,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
function foo1_c(x) {
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + v });
(() => x + v);
@@ -222,8 +216,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
function foo4_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = y;
let x = 1;
(function() { return x + v });
@@ -238,8 +230,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
function foo5_c(x) {
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + y + v });
(() => x + y + v);
@@ -285,8 +275,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
function foo8_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v = x;
(function() { return x + y + v });
@@ -1,12 +1,8 @@
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(171,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(175,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(212,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(226,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(230,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop5_ES6.ts (6 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop5_ES6.ts (2 errors) ====
declare function use(a: any);
@@ -178,8 +174,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
function foo1_c(x) {
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + v });
(() => x + v);
@@ -223,8 +217,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
function foo4_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = y;
let x = 1;
(function() { return x + v });
@@ -239,8 +231,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
function foo5_c(x) {
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
var v = x;
(function() { return x + y + v });
(() => x + y + v);
@@ -286,8 +276,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
function foo8_c(x) {
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
var v = x;
(function() { return x + y + v });
@@ -1,14 +1,10 @@
tests/cases/compiler/capturedLetConstInLoop6.ts(144,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6.ts(147,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6.ts(150,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop6.ts(179,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6.ts(191,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6.ts(194,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6.ts(197,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop6.ts (8 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop6.ts (4 errors) ====
// ====let
for (let x of []) {
(function() { return x});
@@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x});
(() => x);
if (x == 1) {
@@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x});
(() => x);
@@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
}
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y});
(() => x + y);
if (x == 1) {
@@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x + y});
(() => x + y);
@@ -1,14 +1,10 @@
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(144,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(147,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(150,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(179,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(191,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(194,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(197,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop6_ES6.ts (8 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop6_ES6.ts (4 errors) ====
// ====let
for (let x of []) {
(function() { return x});
@@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x});
(() => x);
if (x == 1) {
@@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x});
(() => x);
@@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
}
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y});
(() => x + y);
if (x == 1) {
@@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
} while (1 === 1)
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x + y});
(() => x + y);
@@ -1,18 +1,14 @@
tests/cases/compiler/capturedLetConstInLoop7.ts(227,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(230,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(233,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(236,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7.ts(239,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7.ts(283,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(302,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(305,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(308,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7.ts(311,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7.ts(314,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop7.ts (12 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop7.ts (8 errors) ====
//===let
l0:
for (let x of []) {
@@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
l1_c:
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x});
(() => x);
if (x == 1) {
@@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
l4_c:
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x});
(() => x);
@@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
l5_c:
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y});
(() => x + y);
if (x == 1) {
@@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
l8_c:
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x + y});
(() => x + y);
@@ -1,18 +1,14 @@
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(227,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(230,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(233,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(236,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(239,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(283,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(302,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(305,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(308,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(311,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(314,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'.
tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/capturedLetConstInLoop7_ES6.ts (12 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop7_ES6.ts (8 errors) ====
//===let
l0:
for (let x of []) {
@@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
l1_c:
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x});
(() => x);
if (x == 1) {
@@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
l4_c:
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x});
(() => x);
@@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
l5_c:
for (const x = 0, y = 1; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y});
(() => x + y);
if (x == 1) {
@@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
l8_c:
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
const x = 1;
(function() { return x + y});
(() => x + y);
@@ -1,6 +1,3 @@
tests/cases/compiler/capturedLetConstInLoop8.ts(66,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8.ts(68,27): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8.ts(70,31): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8.ts(73,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8.ts(76,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8.ts(79,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
@@ -19,7 +16,7 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(117,17): error TS2365: Operator
tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator '==' cannot be applied to types '0' and '3'.
==== tests/cases/compiler/capturedLetConstInLoop8.ts (19 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop8.ts (16 errors) ====
function foo() {
l0:
for (let z = 0; z < 1; ++z) {
@@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator
function foo_c() {
l0:
for (const z = 0; z < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
l1:
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
ll1:
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y });
(() => x + y);
if (y == 1) {
@@ -1,6 +1,3 @@
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(66,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(68,27): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(70,31): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(73,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(76,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(79,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'.
@@ -19,7 +16,7 @@ tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(117,17): error TS2365: Opera
tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(120,17): error TS2365: Operator '==' cannot be applied to types '0' and '3'.
==== tests/cases/compiler/capturedLetConstInLoop8_ES6.ts (19 errors) ====
==== tests/cases/compiler/capturedLetConstInLoop8_ES6.ts (16 errors) ====
function foo() {
l0:
for (let z = 0; z < 1; ++z) {
@@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(120,17): error TS2365: Opera
function foo_c() {
l0:
for (const z = 0; z < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
l1:
for (const x = 0; x < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
ll1:
for (const y = 0; y < 1;) {
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
(function() { return x + y });
(() => x + y);
if (y == 1) {
@@ -1,58 +0,0 @@
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(5,1): error TS2365: Operator '>' cannot be applied to types 'BrandedNum' and '0'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(10,1): error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(15,1): error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(20,1): error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'.
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts (4 errors) ====
type BrandedNum = number & { __numberBrand: any };
var x : BrandedNum;
// operator >
x > 0;
~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'BrandedNum' and '0'.
x > <number>0;
x > <BrandedNum>0;
// operator <
x < 0;
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'.
x < <number>0;
x < <BrandedNum>0;
// operator >=
x >= 0;
~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'.
x >= <number>0;
x >= <BrandedNum>0;
// operator <=
x <= 0;
~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'.
x <= <number>0;
x <= <BrandedNum>0;
// operator ==
x == 0;
x == <number>0;
x == <BrandedNum>0;
// operator !=
x != 0;
x != <number>0;
x != <BrandedNum>0;
// operator ===
x === 0;
x === <number>0;
x === <BrandedNum>0;
// operator !==
x !== 0;
x !== <number>0;
x !== <BrandedNum>0;
@@ -0,0 +1,97 @@
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts ===
type BrandedNum = number & { __numberBrand: any };
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
>__numberBrand : Symbol(__numberBrand, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 28))
var x : BrandedNum;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator >
x > 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x > <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x > <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator <
x < 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x < <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x < <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator >=
x >= 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x >= <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x >= <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator <=
x <= 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x <= <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x <= <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator ==
x == 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x == <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x == <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator !=
x != 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x != <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x != <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator ===
x === 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x === <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x === <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
// operator !==
x !== 0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x !== <number>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
x !== <BrandedNum>0;
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
@@ -0,0 +1,161 @@
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts ===
type BrandedNum = number & { __numberBrand: any };
>BrandedNum : BrandedNum
>__numberBrand : any
var x : BrandedNum;
>x : BrandedNum
>BrandedNum : BrandedNum
// operator >
x > 0;
>x > 0 : boolean
>x : BrandedNum
>0 : 0
x > <number>0;
>x > <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x > <BrandedNum>0;
>x > <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator <
x < 0;
>x < 0 : boolean
>x : BrandedNum
>0 : 0
x < <number>0;
>x < <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x < <BrandedNum>0;
>x < <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator >=
x >= 0;
>x >= 0 : boolean
>x : BrandedNum
>0 : 0
x >= <number>0;
>x >= <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x >= <BrandedNum>0;
>x >= <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator <=
x <= 0;
>x <= 0 : boolean
>x : BrandedNum
>0 : 0
x <= <number>0;
>x <= <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x <= <BrandedNum>0;
>x <= <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator ==
x == 0;
>x == 0 : boolean
>x : BrandedNum
>0 : 0
x == <number>0;
>x == <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x == <BrandedNum>0;
>x == <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator !=
x != 0;
>x != 0 : boolean
>x : BrandedNum
>0 : 0
x != <number>0;
>x != <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x != <BrandedNum>0;
>x != <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator ===
x === 0;
>x === 0 : boolean
>x : BrandedNum
>0 : 0
x === <number>0;
>x === <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x === <BrandedNum>0;
>x === <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
// operator !==
x !== 0;
>x !== 0 : boolean
>x : BrandedNum
>0 : 0
x !== <number>0;
>x !== <number>0 : boolean
>x : BrandedNum
><number>0 : number
>0 : 0
x !== <BrandedNum>0;
>x !== <BrandedNum>0 : boolean
>x : BrandedNum
><BrandedNum>0 : BrandedNum
>BrandedNum : BrandedNum
>0 : 0
@@ -1,71 +0,0 @@
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts(35,1): error TS2365: Operator '>' cannot be applied to types '2' and '1'.
tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts(58,23): error TS2365: Operator '>' cannot be applied to types '2' and '1'.
==== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts (2 errors) ====
//Cond ? Expr1 : Expr2, Cond is of boolean type, Expr1 and Expr2 have the same type
var condBoolean: boolean;
var exprAny1: any;
var exprBoolean1: boolean;
var exprNumber1: number;
var exprString1: string;
var exprIsObject1: Object;
var exprAny2: any;
var exprBoolean2: boolean;
var exprNumber2: number;
var exprString2: string;
var exprIsObject2: Object;
//Cond is a boolean type variable
condBoolean ? exprAny1 : exprAny2;
condBoolean ? exprBoolean1 : exprBoolean2;
condBoolean ? exprNumber1 : exprNumber2;
condBoolean ? exprString1 : exprString2;
condBoolean ? exprIsObject1 : exprIsObject2;
condBoolean ? exprString1 : exprBoolean1; // union
//Cond is a boolean type literal
true ? exprAny1 : exprAny2;
false ? exprBoolean1 : exprBoolean2;
true ? exprNumber1 : exprNumber2;
false ? exprString1 : exprString2;
true ? exprIsObject1 : exprIsObject2;
true ? exprString1 : exprBoolean1; // union
//Cond is a boolean type expression
!true ? exprAny1 : exprAny2;
typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
2 > 1 ? exprNumber1 : exprNumber2;
~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '2' and '1'.
null === undefined ? exprString1 : exprString2;
true || false ? exprIsObject1 : exprIsObject2;
null === undefined ? exprString1 : exprBoolean1; // union
//Results shoud be same as Expr1 and Expr2
var resultIsAny1 = condBoolean ? exprAny1 : exprAny2;
var resultIsBoolean1 = condBoolean ? exprBoolean1 : exprBoolean2;
var resultIsNumber1 = condBoolean ? exprNumber1 : exprNumber2;
var resultIsString1 = condBoolean ? exprString1 : exprString2;
var resultIsObject1 = condBoolean ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // union
var resultIsAny2 = true ? exprAny1 : exprAny2;
var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2;
var resultIsNumber2 = true ? exprNumber1 : exprNumber2;
var resultIsString2 = false ? exprString1 : exprString2;
var resultIsObject2 = true ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union
var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union
var resultIsAny3 = !true ? exprAny1 : exprAny2;
var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2;
~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '2' and '1'.
var resultIsString3 = null === undefined ? exprString1 : exprString2;
var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoolean1; // union
@@ -75,37 +75,37 @@ condBoolean ? exprString1 : exprBoolean1; // union
//Cond is a boolean type literal
true ? exprAny1 : exprAny2;
>true ? exprAny1 : exprAny2 : any
>true : boolean
>true : true
>exprAny1 : any
>exprAny2 : any
false ? exprBoolean1 : exprBoolean2;
>false ? exprBoolean1 : exprBoolean2 : boolean
>false : boolean
>false : false
>exprBoolean1 : boolean
>exprBoolean2 : boolean
true ? exprNumber1 : exprNumber2;
>true ? exprNumber1 : exprNumber2 : number
>true : boolean
>true : true
>exprNumber1 : number
>exprNumber2 : number
false ? exprString1 : exprString2;
>false ? exprString1 : exprString2 : string
>false : boolean
>false : false
>exprString1 : string
>exprString2 : string
true ? exprIsObject1 : exprIsObject2;
>true ? exprIsObject1 : exprIsObject2 : Object
>true : boolean
>true : true
>exprIsObject1 : Object
>exprIsObject2 : Object
true ? exprString1 : exprBoolean1; // union
>true ? exprString1 : exprBoolean1 : string | boolean
>true : boolean
>true : true
>exprString1 : string
>exprBoolean1 : boolean
@@ -113,7 +113,7 @@ true ? exprString1 : exprBoolean1; // union
!true ? exprAny1 : exprAny2;
>!true ? exprAny1 : exprAny2 : any
>!true : boolean
>true : boolean
>true : true
>exprAny1 : any
>exprAny2 : any
@@ -121,7 +121,7 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
>typeof "123" == "string" : boolean
>typeof "123" : string
>"123" : string
>"123" : "123"
>"string" : "string"
>exprBoolean1 : boolean
>exprBoolean2 : boolean
@@ -129,8 +129,8 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
2 > 1 ? exprNumber1 : exprNumber2;
>2 > 1 ? exprNumber1 : exprNumber2 : number
>2 > 1 : boolean
>2 : number
>1 : number
>2 : 2
>1 : 1
>exprNumber1 : number
>exprNumber2 : number
@@ -145,7 +145,7 @@ null === undefined ? exprString1 : exprString2;
true || false ? exprIsObject1 : exprIsObject2;
>true || false ? exprIsObject1 : exprIsObject2 : Object
>true || false : boolean
>true : boolean
>true : true
>false : false
>exprIsObject1 : Object
>exprIsObject2 : Object
@@ -204,49 +204,49 @@ var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // unio
var resultIsAny2 = true ? exprAny1 : exprAny2;
>resultIsAny2 : any
>true ? exprAny1 : exprAny2 : any
>true : boolean
>true : true
>exprAny1 : any
>exprAny2 : any
var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2;
>resultIsBoolean2 : boolean
>false ? exprBoolean1 : exprBoolean2 : boolean
>false : boolean
>false : false
>exprBoolean1 : boolean
>exprBoolean2 : boolean
var resultIsNumber2 = true ? exprNumber1 : exprNumber2;
>resultIsNumber2 : number
>true ? exprNumber1 : exprNumber2 : number
>true : boolean
>true : true
>exprNumber1 : number
>exprNumber2 : number
var resultIsString2 = false ? exprString1 : exprString2;
>resultIsString2 : string
>false ? exprString1 : exprString2 : string
>false : boolean
>false : false
>exprString1 : string
>exprString2 : string
var resultIsObject2 = true ? exprIsObject1 : exprIsObject2;
>resultIsObject2 : Object
>true ? exprIsObject1 : exprIsObject2 : Object
>true : boolean
>true : true
>exprIsObject1 : Object
>exprIsObject2 : Object
var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union
>resultIsStringOrBoolean2 : string | boolean
>true ? exprString1 : exprBoolean1 : string | boolean
>true : boolean
>true : true
>exprString1 : string
>exprBoolean1 : boolean
var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union
>resultIsStringOrBoolean3 : string | boolean
>false ? exprString1 : exprBoolean1 : string | boolean
>false : boolean
>false : false
>exprString1 : string
>exprBoolean1 : boolean
@@ -254,7 +254,7 @@ var resultIsAny3 = !true ? exprAny1 : exprAny2;
>resultIsAny3 : any
>!true ? exprAny1 : exprAny2 : any
>!true : boolean
>true : boolean
>true : true
>exprAny1 : any
>exprAny2 : any
@@ -263,7 +263,7 @@ var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
>typeof "123" == "string" : boolean
>typeof "123" : string
>"123" : string
>"123" : "123"
>"string" : "string"
>exprBoolean1 : boolean
>exprBoolean2 : boolean
@@ -272,8 +272,8 @@ var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2;
>resultIsNumber3 : number
>2 > 1 ? exprNumber1 : exprNumber2 : number
>2 > 1 : boolean
>2 : number
>1 : number
>2 : 2
>1 : 1
>exprNumber1 : number
>exprNumber2 : number
@@ -290,7 +290,7 @@ var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2;
>resultIsObject3 : Object
>true || false ? exprIsObject1 : exprIsObject2 : Object
>true || false : boolean
>true : boolean
>true : true
>false : false
>exprIsObject1 : Object
>exprIsObject2 : Object
@@ -300,7 +300,7 @@ var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoo
>typeof "123" === "string" ? exprString1 : exprBoolean1 : string | boolean
>typeof "123" === "string" : boolean
>typeof "123" : string
>"123" : string
>"123" : "123"
>"string" : "string"
>exprString1 : string
>exprBoolean1 : boolean
@@ -4,14 +4,12 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec
tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(10,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator '<' cannot be applied to types '0' and '1'.
==== tests/cases/compiler/constDeclarations-errors.ts (11 errors) ====
==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ====
// error, missing intialicer
const c1;
@@ -34,8 +32,6 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator
// error, assigning to a const
for(const c8 = 0; c8 < 1; c8++) { }
~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
~~
!!! error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property.
@@ -47,6 +43,4 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator
// error, can not be unintalized
for(const c10 = 0, c11; c10 < 1;) { }
~~~
!!! error TS1155: 'const' declarations must be initialized
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
!!! error TS1155: 'const' declarations must be initialized
@@ -1,21 +0,0 @@
tests/cases/compiler/constDeclarations-scopes2.ts(9,19): error TS2365: Operator '<' cannot be applied to types '0' and '10'.
==== tests/cases/compiler/constDeclarations-scopes2.ts (1 errors) ====
// global
const c = "string";
var n: number;
var b: boolean;
// for scope
for (const c = 0; c < 10; n = c ) {
~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '10'.
// for block
const c = false;
b = c;
}
@@ -2,8 +2,8 @@
// global
const c = "string";
>c : string
>"string" : string
>c : "string"
>"string" : "string"
var n: number;
>n : number
@@ -13,24 +13,24 @@ var b: boolean;
// for scope
for (const c = 0; c < 10; n = c ) {
>c : number
>0 : number
>c : 0
>0 : 0
>c < 10 : boolean
>c : number
>10 : number
>n = c : number
>c : 0
>10 : 10
>n = c : 0
>n : number
>c : number
>c : 0
// for block
const c = false;
>c : boolean
>false : boolean
>c : false
>false : false
b = c;
>b = c : boolean
>b = c : false
>b : boolean
>c : boolean
>c : false
}
@@ -1,17 +0,0 @@
tests/cases/compiler/constDeclarations.ts(8,19): error TS2365: Operator '<' cannot be applied to types '0' and '9'.
==== tests/cases/compiler/constDeclarations.ts (1 errors) ====
// No error
const c1 = false;
const c2: number = 23;
const c3 = 0, c4 :string = "", c5 = null;
for(const c4 = 0; c4 < 9; ) { break; }
~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '0' and '9'.
for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
@@ -2,36 +2,36 @@
// No error
const c1 = false;
>c1 : boolean
>false : boolean
>c1 : false
>false : false
const c2: number = 23;
>c2 : number
>23 : number
>23 : 23
const c3 = 0, c4 :string = "", c5 = null;
>c3 : number
>0 : number
>c3 : 0
>0 : 0
>c4 : string
>"" : string
>"" : ""
>c5 : any
>null : null
for(const c4 = 0; c4 < 9; ) { break; }
>c4 : number
>0 : number
>c4 : 0
>0 : 0
>c4 < 9 : boolean
>c4 : number
>9 : number
>c4 : 0
>9 : 9
for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
>c5 : number
>0 : number
>c6 : number
>0 : number
>c5 : 0
>0 : 0
>c6 : 0
>0 : 0
>c5 < c6 : boolean
>c5 : number
>c6 : number
>c5 : 0
>c6 : 0
@@ -2,7 +2,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected
tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected.
tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'.
tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
@@ -203,7 +203,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithm
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
bytes.push(fb.readByte());
@@ -1,5 +1,5 @@
tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
@@ -34,7 +34,7 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithme
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'.
~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'string' and '14'.
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
bytes.push(fb.readByte());
@@ -16,16 +16,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
var C = C_1 = (function () {
function C() {
this.p = 1;
}
C.x = function () { return C.y; };
C.x = function () { return C_1.y; };
C.prototype.method = function () { };
return C;
}());
C.y = 1;
C = __decorate([
C = C_1 = __decorate([
foo
], C);
export default C;
var C_1;
@@ -0,0 +1,15 @@
//// [forOfStringConstituents.ts]
interface A { x: 0; y: C[]; }
interface B { x: 1; y: CD[]; }
interface C { x: 2; }
interface D { x: 3; }
type AB = A | B;
type CD = C | D;
declare let x: AB, y: CD;
for (y of x.y);
//// [forOfStringConstituents.js]
for (var _i = 0, _a = x.y; _i < _a.length; _i++) {
y = _a[_i];
;
}
@@ -0,0 +1,43 @@
=== tests/cases/compiler/forOfStringConstituents.ts ===
interface A { x: 0; y: C[]; }
>A : Symbol(A, Decl(forOfStringConstituents.ts, 0, 0))
>x : Symbol(A.x, Decl(forOfStringConstituents.ts, 0, 13))
>y : Symbol(A.y, Decl(forOfStringConstituents.ts, 0, 19))
>C : Symbol(C, Decl(forOfStringConstituents.ts, 1, 30))
interface B { x: 1; y: CD[]; }
>B : Symbol(B, Decl(forOfStringConstituents.ts, 0, 29))
>x : Symbol(B.x, Decl(forOfStringConstituents.ts, 1, 13))
>y : Symbol(B.y, Decl(forOfStringConstituents.ts, 1, 19))
>CD : Symbol(CD, Decl(forOfStringConstituents.ts, 4, 16))
interface C { x: 2; }
>C : Symbol(C, Decl(forOfStringConstituents.ts, 1, 30))
>x : Symbol(C.x, Decl(forOfStringConstituents.ts, 2, 13))
interface D { x: 3; }
>D : Symbol(D, Decl(forOfStringConstituents.ts, 2, 21))
>x : Symbol(D.x, Decl(forOfStringConstituents.ts, 3, 13))
type AB = A | B;
>AB : Symbol(AB, Decl(forOfStringConstituents.ts, 3, 21))
>A : Symbol(A, Decl(forOfStringConstituents.ts, 0, 0))
>B : Symbol(B, Decl(forOfStringConstituents.ts, 0, 29))
type CD = C | D;
>CD : Symbol(CD, Decl(forOfStringConstituents.ts, 4, 16))
>C : Symbol(C, Decl(forOfStringConstituents.ts, 1, 30))
>D : Symbol(D, Decl(forOfStringConstituents.ts, 2, 21))
declare let x: AB, y: CD;
>x : Symbol(x, Decl(forOfStringConstituents.ts, 6, 11))
>AB : Symbol(AB, Decl(forOfStringConstituents.ts, 3, 21))
>y : Symbol(y, Decl(forOfStringConstituents.ts, 6, 18))
>CD : Symbol(CD, Decl(forOfStringConstituents.ts, 4, 16))
for (y of x.y);
>y : Symbol(y, Decl(forOfStringConstituents.ts, 6, 18))
>x.y : Symbol(y, Decl(forOfStringConstituents.ts, 0, 19), Decl(forOfStringConstituents.ts, 1, 19))
>x : Symbol(x, Decl(forOfStringConstituents.ts, 6, 11))
>y : Symbol(y, Decl(forOfStringConstituents.ts, 0, 19), Decl(forOfStringConstituents.ts, 1, 19))
@@ -0,0 +1,43 @@
=== tests/cases/compiler/forOfStringConstituents.ts ===
interface A { x: 0; y: C[]; }
>A : A
>x : 0
>y : C[]
>C : C
interface B { x: 1; y: CD[]; }
>B : B
>x : 1
>y : CD[]
>CD : CD
interface C { x: 2; }
>C : C
>x : 2
interface D { x: 3; }
>D : D
>x : 3
type AB = A | B;
>AB : AB
>A : A
>B : B
type CD = C | D;
>CD : CD
>C : C
>D : D
declare let x: AB, y: CD;
>x : AB
>AB : AB
>y : CD
>CD : CD
for (y of x.y);
>y : CD
>x.y : C[] | CD[]
>x : AB
>y : C[] | CD[]
@@ -1,6 +1,6 @@
tests/cases/compiler/grammarAmbiguities1.ts(8,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and '7'.
tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
tests/cases/compiler/grammarAmbiguities1.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
@@ -20,7 +20,7 @@ tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' ca
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and '7'.
!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
f(g < A, B > +(7));
~~~~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
+42
View File
@@ -0,0 +1,42 @@
//// [objectRest2.ts]
// test for #12203
declare function connectionFromArray(objects: number, args: any): {};
function rootConnection(name: string) {
return {
resolve: async (context, args) => {
const { objects } = await { objects: 12 };
return {
...connectionFromArray(objects, args)
};
}
};
}
rootConnection('test');
//// [objectRest2.js]
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
function rootConnection(name) {
return {
resolve: (context, args) => __awaiter(this, void 0, void 0, function* () {
const { objects } = yield { objects: 12 };
return __assign({}, connectionFromArray(objects, args));
})
};
}
rootConnection('test');
@@ -0,0 +1,34 @@
=== tests/cases/conformance/types/rest/objectRest2.ts ===
// test for #12203
declare function connectionFromArray(objects: number, args: any): {};
>connectionFromArray : Symbol(connectionFromArray, Decl(objectRest2.ts, 0, 0))
>objects : Symbol(objects, Decl(objectRest2.ts, 1, 37))
>args : Symbol(args, Decl(objectRest2.ts, 1, 53))
function rootConnection(name: string) {
>rootConnection : Symbol(rootConnection, Decl(objectRest2.ts, 1, 69))
>name : Symbol(name, Decl(objectRest2.ts, 2, 24))
return {
resolve: async (context, args) => {
>resolve : Symbol(resolve, Decl(objectRest2.ts, 3, 10))
>context : Symbol(context, Decl(objectRest2.ts, 4, 20))
>args : Symbol(args, Decl(objectRest2.ts, 4, 28))
const { objects } = await { objects: 12 };
>objects : Symbol(objects, Decl(objectRest2.ts, 5, 15))
>objects : Symbol(objects, Decl(objectRest2.ts, 5, 35))
return {
...connectionFromArray(objects, args)
>connectionFromArray : Symbol(connectionFromArray, Decl(objectRest2.ts, 0, 0))
>objects : Symbol(objects, Decl(objectRest2.ts, 5, 15))
>args : Symbol(args, Decl(objectRest2.ts, 4, 28))
};
}
};
}
rootConnection('test');
>rootConnection : Symbol(rootConnection, Decl(objectRest2.ts, 1, 69))
@@ -0,0 +1,45 @@
=== tests/cases/conformance/types/rest/objectRest2.ts ===
// test for #12203
declare function connectionFromArray(objects: number, args: any): {};
>connectionFromArray : (objects: number, args: any) => {}
>objects : number
>args : any
function rootConnection(name: string) {
>rootConnection : (name: string) => { resolve: (context: any, args: any) => Promise<{}>; }
>name : string
return {
>{ resolve: async (context, args) => { const { objects } = await { objects: 12 }; return { ...connectionFromArray(objects, args) }; } } : { resolve: (context: any, args: any) => Promise<{}>; }
resolve: async (context, args) => {
>resolve : (context: any, args: any) => Promise<{}>
>async (context, args) => { const { objects } = await { objects: 12 }; return { ...connectionFromArray(objects, args) }; } : (context: any, args: any) => Promise<{}>
>context : any
>args : any
const { objects } = await { objects: 12 };
>objects : number
>await { objects: 12 } : { objects: number; }
>{ objects: 12 } : { objects: number; }
>objects : number
>12 : 12
return {
>{ ...connectionFromArray(objects, args) } : {}
...connectionFromArray(objects, args)
>connectionFromArray(objects, args) : {}
>connectionFromArray : (objects: number, args: any) => {}
>objects : number
>args : any
};
}
};
}
rootConnection('test');
>rootConnection('test') : { resolve: (context: any, args: any) => Promise<{}>; }
>rootConnection : (name: string) => { resolve: (context: any, args: any) => Promise<{}>; }
>'test' : "test"
+1 -1
View File
@@ -108,7 +108,7 @@ var combinedMid = __assign({}, o, { b: 'ok' }, o2);
var combinedAfter = __assign({}, o, o2, { b: 'ok' });
var combinedNested = __assign({}, __assign({ a: 4 }, { b: false, c: 'overriden' }), { d: 'actually new' }, { a: 5, d: 'maybe new' });
var combinedNestedChangeType = __assign({}, __assign({ a: 1 }, { b: false, c: 'overriden' }), { c: -1 });
var propertyNested = __assign({ a: __assign({}, o) });
var propertyNested = { a: __assign({}, o) };
// accessors don't copy the descriptor
// (which means that readonly getters become read/write properties)
var op = { get a() { return 6; } };
@@ -0,0 +1,25 @@
//// [optionalProperties01.ts]
interface Foo {
required1: string;
required2: string;
optional?: string;
}
const foo1 = { required1: "hello" } as Foo;
const foo2 = { required1: "hello", optional: "bar" } as Foo;
//// [optionalProperties01.js]
var foo1 = { required1: "hello" };
var foo2 = { required1: "hello", optional: "bar" };
//// [optionalProperties01.d.ts]
interface Foo {
required1: string;
required2: string;
optional?: string;
}
declare const foo1: Foo;
declare const foo2: Foo;
@@ -0,0 +1,26 @@
=== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(optionalProperties01.ts, 0, 0))
required1: string;
>required1 : Symbol(Foo.required1, Decl(optionalProperties01.ts, 1, 15))
required2: string;
>required2 : Symbol(Foo.required2, Decl(optionalProperties01.ts, 2, 20))
optional?: string;
>optional : Symbol(Foo.optional, Decl(optionalProperties01.ts, 3, 20))
}
const foo1 = { required1: "hello" } as Foo;
>foo1 : Symbol(foo1, Decl(optionalProperties01.ts, 7, 5))
>required1 : Symbol(required1, Decl(optionalProperties01.ts, 7, 14))
>Foo : Symbol(Foo, Decl(optionalProperties01.ts, 0, 0))
const foo2 = { required1: "hello", optional: "bar" } as Foo;
>foo2 : Symbol(foo2, Decl(optionalProperties01.ts, 8, 5))
>required1 : Symbol(required1, Decl(optionalProperties01.ts, 8, 14))
>optional : Symbol(optional, Decl(optionalProperties01.ts, 8, 34))
>Foo : Symbol(Foo, Decl(optionalProperties01.ts, 0, 0))
@@ -0,0 +1,33 @@
=== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts ===
interface Foo {
>Foo : Foo
required1: string;
>required1 : string
required2: string;
>required2 : string
optional?: string;
>optional : string | undefined
}
const foo1 = { required1: "hello" } as Foo;
>foo1 : Foo
>{ required1: "hello" } as Foo : Foo
>{ required1: "hello" } : { required1: string; }
>required1 : string
>"hello" : "hello"
>Foo : Foo
const foo2 = { required1: "hello", optional: "bar" } as Foo;
>foo2 : Foo
>{ required1: "hello", optional: "bar" } as Foo : Foo
>{ required1: "hello", optional: "bar" } : { required1: string; optional: string; }
>required1 : string
>"hello" : "hello"
>optional : string
>"bar" : "bar"
>Foo : Foo
@@ -0,0 +1,18 @@
//// [optionalProperties02.ts]
interface Foo {
a?: string;
b: string;
}
<Foo>{ a: undefined };
//// [optionalProperties02.js]
({ a: undefined });
//// [optionalProperties02.d.ts]
interface Foo {
a?: string;
b: string;
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(optionalProperties02.ts, 0, 0))
a?: string;
>a : Symbol(Foo.a, Decl(optionalProperties02.ts, 1, 15))
b: string;
>b : Symbol(Foo.b, Decl(optionalProperties02.ts, 2, 15))
}
<Foo>{ a: undefined };
>Foo : Symbol(Foo, Decl(optionalProperties02.ts, 0, 0))
>a : Symbol(a, Decl(optionalProperties02.ts, 6, 6))
>undefined : Symbol(undefined)
@@ -0,0 +1,19 @@
=== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts ===
interface Foo {
>Foo : Foo
a?: string;
>a : string | undefined
b: string;
>b : string
}
<Foo>{ a: undefined };
><Foo>{ a: undefined } : Foo
>Foo : Foo
>{ a: undefined } : { a: undefined; }
>a : undefined
>undefined : undefined
@@ -1,10 +1,10 @@
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,5): error TS1109: Expression expected.
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts (2 errors) ====
1 > > 2;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
~
!!! error TS1109: Expression expected.
@@ -1,10 +1,10 @@
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,8): error TS1109: Expression expected.
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts (2 errors) ====
1 >/**/> 2;
~~~~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
~
!!! error TS1109: Expression expected.
@@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(2,1): error TS1109: Expression expected.
@@ -7,6 +7,6 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbigu
~~~
> 2;
~~~
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'.
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
~
!!! error TS1109: Expression expected.
@@ -0,0 +1,40 @@
tests/cases/compiler/relationalOperatorComparable.ts(5,14): error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/relationalOperatorComparable.ts(6,14): error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/relationalOperatorComparable.ts(7,14): error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/relationalOperatorComparable.ts(8,14): error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/relationalOperatorComparable.ts(9,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
tests/cases/compiler/relationalOperatorComparable.ts(10,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
tests/cases/compiler/relationalOperatorComparable.ts(11,14): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
==== tests/cases/compiler/relationalOperatorComparable.ts (7 errors) ====
function f(onethree: 1 | 3, two: 2) {
const t = true;
const f = false;
let a1 = onethree < two; // ok
let a2 = onethree < true; // error, number and boolean
~~~~~~~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'.
let a3 = onethree <= false; // error, number and boolean
~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'.
let a4 = onethree >= t; // error, number and boolean
~~~~~~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'.
let a5 = onethree > f; // error, number and boolean
~~~~~~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'.
let a6 = true < onethree; // error, boolean and number
~~~~~~~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
let a7 = false < two; // error, boolean and number
~~~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'.
let a8 = 'foo' < onethree; // error, string and number
~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
let a9 = onethree < 1; // ok
let a10 = 1 < two; // ok
let a11 = 2 < 1; // ok
}
@@ -0,0 +1,34 @@
//// [relationalOperatorComparable.ts]
function f(onethree: 1 | 3, two: 2) {
const t = true;
const f = false;
let a1 = onethree < two; // ok
let a2 = onethree < true; // error, number and boolean
let a3 = onethree <= false; // error, number and boolean
let a4 = onethree >= t; // error, number and boolean
let a5 = onethree > f; // error, number and boolean
let a6 = true < onethree; // error, boolean and number
let a7 = false < two; // error, boolean and number
let a8 = 'foo' < onethree; // error, string and number
let a9 = onethree < 1; // ok
let a10 = 1 < two; // ok
let a11 = 2 < 1; // ok
}
//// [relationalOperatorComparable.js]
function f(onethree, two) {
var t = true;
var f = false;
var a1 = onethree < two; // ok
var a2 = onethree < true; // error, number and boolean
var a3 = onethree <= false; // error, number and boolean
var a4 = onethree >= t; // error, number and boolean
var a5 = onethree > f; // error, number and boolean
var a6 = true < onethree; // error, boolean and number
var a7 = false < two; // error, boolean and number
var a8 = 'foo' < onethree; // error, string and number
var a9 = onethree < 1; // ok
var a10 = 1 < two; // ok
var a11 = 2 < 1; // ok
}
@@ -7,12 +7,11 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ====
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (11 errors) ====
let abc: "ABC" = "ABC";
let xyz: "XYZ" = "XYZ";
@@ -47,8 +46,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato
~~~~~~~~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
let j = abc < xyz;
~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
let k = abc === xyz;
~~~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.

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