Merge pull request #12245 from Microsoft/fix12244

Fix string constituent check in checkElementTypeOfArrayOrString
This commit is contained in:
Ron Buckton
2016-11-14 15:27:45 -08:00
committed by GitHub
25 changed files with 73243 additions and 58274 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
+757 -1381
View File
File diff suppressed because it is too large Load Diff
+7 -3
View File
@@ -17257,11 +17257,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;
@@ -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[]
@@ -0,0 +1,8 @@
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);