diff options
Diffstat (limited to 'node_modules/typescript/lib/tsserverlibrary.d.ts')
-rw-r--r-- | node_modules/typescript/lib/tsserverlibrary.d.ts | 4029 |
1 files changed, 2772 insertions, 1257 deletions
diff --git a/node_modules/typescript/lib/tsserverlibrary.d.ts b/node_modules/typescript/lib/tsserverlibrary.d.ts index 3104e2410..16d810866 100644 --- a/node_modules/typescript/lib/tsserverlibrary.d.ts +++ b/node_modules/typescript/lib/tsserverlibrary.d.ts @@ -1,5 +1,4 @@ /// <reference path="../../src/server/types.d.ts" /> -/// <reference types="node" /> declare namespace ts.server.protocol { namespace CommandTypes { type Brace = "brace"; @@ -15,6 +14,8 @@ declare namespace ts.server.protocol { type Configure = "configure"; type Definition = "definition"; type DefinitionFull = "definition-full"; + type Implementation = "implementation"; + type ImplementationFull = "implementation-full"; type Exit = "exit"; type Format = "format"; type Formatonkey = "formatonkey"; @@ -65,6 +66,9 @@ declare namespace ts.server.protocol { type NameOrDottedNameSpan = "nameOrDottedNameSpan"; type BreakpointStatement = "breakpointStatement"; type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; + type GetCodeFixes = "getCodeFixes"; + type GetCodeFixesFull = "getCodeFixes-full"; + type GetSupportedCodeFixes = "getSupportedCodeFixes"; } interface Message { seq: number; @@ -166,9 +170,31 @@ declare namespace ts.server.protocol { offset: number; position?: number; } + interface CodeFixRequest extends Request { + command: CommandTypes.GetCodeFixes; + arguments: CodeFixRequestArgs; + } + interface CodeFixRequestArgs extends FileRequestArgs { + startLine: number; + startOffset: number; + startPosition?: number; + endLine: number; + endOffset: number; + endPosition?: number; + errorCodes?: number[]; + } + interface GetCodeFixesResponse extends Response { + body?: CodeAction[]; + } interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } + interface GetSupportedCodeFixesRequest extends Request { + command: CommandTypes.GetSupportedCodeFixes; + } + interface GetSupportedCodeFixesResponse extends Response { + body?: string[]; + } interface EncodedSemanticClassificationsRequest extends FileRequest { arguments: EncodedSemanticClassificationsRequestArgs; } @@ -185,6 +211,9 @@ declare namespace ts.server.protocol { interface TypeDefinitionRequest extends FileLocationRequest { command: CommandTypes.TypeDefinition; } + interface ImplementationRequest extends FileLocationRequest { + command: CommandTypes.Implementation; + } interface Location { line: number; offset: number; @@ -437,6 +466,17 @@ declare namespace ts.server.protocol { end: Location; newText: string; } + interface FileCodeEdits { + fileName: string; + textChanges: CodeEdit[]; + } + interface CodeFixResponse extends Response { + body?: CodeAction[]; + } + interface CodeAction { + description: string; + changes: FileCodeEdits[]; + } interface FormatResponse extends Response { body?: CodeEdit[]; } @@ -556,6 +596,7 @@ declare namespace ts.server.protocol { start: Location; end: Location; text: string; + code?: number; } interface DiagnosticEventBody { file: string; @@ -573,6 +614,15 @@ declare namespace ts.server.protocol { body?: ConfigFileDiagnosticEventBody; event: "configFileDiag"; } + type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; + interface ProjectLanguageServiceStateEvent extends Event { + event: ProjectLanguageServiceStateEventName; + body?: ProjectLanguageServiceStateEventBody; + } + interface ProjectLanguageServiceStateEventBody { + projectName: string; + languageServiceEnabled: boolean; + } interface ReloadRequestArgs extends FileRequestArgs { tmpfile: string; } @@ -592,6 +642,7 @@ declare namespace ts.server.protocol { interface NavtoRequestArgs extends FileRequestArgs { searchValue: string; maxResultCount?: number; + currentFileOnly?: boolean; projectFileName?: string; } interface NavtoRequest extends FileRequest { @@ -647,6 +698,24 @@ 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 { + installedPackages: string; + installSuccess: boolean; + } interface NavBarResponse extends Response { body?: NavigationBarItem[]; } @@ -809,314 +878,358 @@ declare namespace ts { ConflictMarkerTrivia = 7, NumericLiteral = 8, StringLiteral = 9, - RegularExpressionLiteral = 10, - NoSubstitutionTemplateLiteral = 11, - TemplateHead = 12, - TemplateMiddle = 13, - TemplateTail = 14, - OpenBraceToken = 15, - CloseBraceToken = 16, - OpenParenToken = 17, - CloseParenToken = 18, - OpenBracketToken = 19, - CloseBracketToken = 20, - DotToken = 21, - DotDotDotToken = 22, - SemicolonToken = 23, - CommaToken = 24, - LessThanToken = 25, - LessThanSlashToken = 26, - GreaterThanToken = 27, - LessThanEqualsToken = 28, - GreaterThanEqualsToken = 29, - EqualsEqualsToken = 30, - ExclamationEqualsToken = 31, - EqualsEqualsEqualsToken = 32, - ExclamationEqualsEqualsToken = 33, - EqualsGreaterThanToken = 34, - PlusToken = 35, - MinusToken = 36, - AsteriskToken = 37, - AsteriskAsteriskToken = 38, - SlashToken = 39, - PercentToken = 40, - PlusPlusToken = 41, - MinusMinusToken = 42, - LessThanLessThanToken = 43, - GreaterThanGreaterThanToken = 44, - GreaterThanGreaterThanGreaterThanToken = 45, - AmpersandToken = 46, - BarToken = 47, - CaretToken = 48, - ExclamationToken = 49, - TildeToken = 50, - AmpersandAmpersandToken = 51, - BarBarToken = 52, - QuestionToken = 53, - ColonToken = 54, - AtToken = 55, - EqualsToken = 56, - PlusEqualsToken = 57, - MinusEqualsToken = 58, - AsteriskEqualsToken = 59, - AsteriskAsteriskEqualsToken = 60, - SlashEqualsToken = 61, - PercentEqualsToken = 62, - LessThanLessThanEqualsToken = 63, - GreaterThanGreaterThanEqualsToken = 64, - GreaterThanGreaterThanGreaterThanEqualsToken = 65, - AmpersandEqualsToken = 66, - BarEqualsToken = 67, - CaretEqualsToken = 68, - Identifier = 69, - BreakKeyword = 70, - CaseKeyword = 71, - CatchKeyword = 72, - ClassKeyword = 73, - ConstKeyword = 74, - ContinueKeyword = 75, - DebuggerKeyword = 76, - DefaultKeyword = 77, - DeleteKeyword = 78, - DoKeyword = 79, - ElseKeyword = 80, - EnumKeyword = 81, - ExportKeyword = 82, - ExtendsKeyword = 83, - FalseKeyword = 84, - FinallyKeyword = 85, - ForKeyword = 86, - FunctionKeyword = 87, - IfKeyword = 88, - ImportKeyword = 89, - InKeyword = 90, - InstanceOfKeyword = 91, - NewKeyword = 92, - NullKeyword = 93, - ReturnKeyword = 94, - SuperKeyword = 95, - SwitchKeyword = 96, - ThisKeyword = 97, - ThrowKeyword = 98, - TrueKeyword = 99, - TryKeyword = 100, - TypeOfKeyword = 101, - VarKeyword = 102, - VoidKeyword = 103, - WhileKeyword = 104, - WithKeyword = 105, - ImplementsKeyword = 106, - InterfaceKeyword = 107, - LetKeyword = 108, - PackageKeyword = 109, - PrivateKeyword = 110, - ProtectedKeyword = 111, - PublicKeyword = 112, - StaticKeyword = 113, - YieldKeyword = 114, - AbstractKeyword = 115, - AsKeyword = 116, - AnyKeyword = 117, - AsyncKeyword = 118, - AwaitKeyword = 119, - BooleanKeyword = 120, - ConstructorKeyword = 121, - DeclareKeyword = 122, - GetKeyword = 123, - IsKeyword = 124, - ModuleKeyword = 125, - NamespaceKeyword = 126, - NeverKeyword = 127, - ReadonlyKeyword = 128, - RequireKeyword = 129, - NumberKeyword = 130, - SetKeyword = 131, - StringKeyword = 132, - SymbolKeyword = 133, - TypeKeyword = 134, - UndefinedKeyword = 135, - FromKeyword = 136, - GlobalKeyword = 137, - OfKeyword = 138, - QualifiedName = 139, - ComputedPropertyName = 140, - TypeParameter = 141, - Parameter = 142, - Decorator = 143, - PropertySignature = 144, - PropertyDeclaration = 145, - MethodSignature = 146, - MethodDeclaration = 147, - Constructor = 148, - GetAccessor = 149, - SetAccessor = 150, - CallSignature = 151, - ConstructSignature = 152, - IndexSignature = 153, - TypePredicate = 154, - TypeReference = 155, - FunctionType = 156, - ConstructorType = 157, - TypeQuery = 158, - TypeLiteral = 159, - ArrayType = 160, - TupleType = 161, - UnionType = 162, - IntersectionType = 163, - ParenthesizedType = 164, - ThisType = 165, - LiteralType = 166, - ObjectBindingPattern = 167, - ArrayBindingPattern = 168, - BindingElement = 169, - ArrayLiteralExpression = 170, - ObjectLiteralExpression = 171, - PropertyAccessExpression = 172, - ElementAccessExpression = 173, - CallExpression = 174, - NewExpression = 175, - TaggedTemplateExpression = 176, - TypeAssertionExpression = 177, - ParenthesizedExpression = 178, - FunctionExpression = 179, - ArrowFunction = 180, - DeleteExpression = 181, - TypeOfExpression = 182, - VoidExpression = 183, - AwaitExpression = 184, - PrefixUnaryExpression = 185, - PostfixUnaryExpression = 186, - BinaryExpression = 187, - ConditionalExpression = 188, - TemplateExpression = 189, - YieldExpression = 190, - SpreadElementExpression = 191, - ClassExpression = 192, - OmittedExpression = 193, - ExpressionWithTypeArguments = 194, - AsExpression = 195, - NonNullExpression = 196, - TemplateSpan = 197, - SemicolonClassElement = 198, - Block = 199, - VariableStatement = 200, - EmptyStatement = 201, - ExpressionStatement = 202, - IfStatement = 203, - DoStatement = 204, - WhileStatement = 205, - ForStatement = 206, - ForInStatement = 207, - ForOfStatement = 208, - ContinueStatement = 209, - BreakStatement = 210, - ReturnStatement = 211, - WithStatement = 212, - SwitchStatement = 213, - LabeledStatement = 214, - ThrowStatement = 215, - TryStatement = 216, - DebuggerStatement = 217, - VariableDeclaration = 218, - VariableDeclarationList = 219, - FunctionDeclaration = 220, - ClassDeclaration = 221, - InterfaceDeclaration = 222, - TypeAliasDeclaration = 223, - EnumDeclaration = 224, - ModuleDeclaration = 225, - ModuleBlock = 226, - CaseBlock = 227, - NamespaceExportDeclaration = 228, - ImportEqualsDeclaration = 229, - ImportDeclaration = 230, - ImportClause = 231, - NamespaceImport = 232, - NamedImports = 233, - ImportSpecifier = 234, - ExportAssignment = 235, - ExportDeclaration = 236, - NamedExports = 237, - ExportSpecifier = 238, - MissingDeclaration = 239, - ExternalModuleReference = 240, - JsxElement = 241, - JsxSelfClosingElement = 242, - JsxOpeningElement = 243, - JsxText = 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, - Count = 287, - FirstAssignment = 56, - LastAssignment = 68, - FirstReservedWord = 70, - LastReservedWord = 105, - FirstKeyword = 70, - LastKeyword = 138, - FirstFutureReservedWord = 106, - LastFutureReservedWord = 114, - FirstTypeNode = 154, - LastTypeNode = 166, - FirstPunctuation = 15, - LastPunctuation = 68, + JsxText = 10, + RegularExpressionLiteral = 11, + NoSubstitutionTemplateLiteral = 12, + TemplateHead = 13, + TemplateMiddle = 14, + TemplateTail = 15, + OpenBraceToken = 16, + CloseBraceToken = 17, + OpenParenToken = 18, + CloseParenToken = 19, + OpenBracketToken = 20, + CloseBracketToken = 21, + DotToken = 22, + DotDotDotToken = 23, + SemicolonToken = 24, + CommaToken = 25, + LessThanToken = 26, + LessThanSlashToken = 27, + GreaterThanToken = 28, + LessThanEqualsToken = 29, + GreaterThanEqualsToken = 30, + EqualsEqualsToken = 31, + ExclamationEqualsToken = 32, + EqualsEqualsEqualsToken = 33, + ExclamationEqualsEqualsToken = 34, + EqualsGreaterThanToken = 35, + PlusToken = 36, + MinusToken = 37, + AsteriskToken = 38, + AsteriskAsteriskToken = 39, + SlashToken = 40, + PercentToken = 41, + PlusPlusToken = 42, + MinusMinusToken = 43, + LessThanLessThanToken = 44, + GreaterThanGreaterThanToken = 45, + GreaterThanGreaterThanGreaterThanToken = 46, + AmpersandToken = 47, + BarToken = 48, + CaretToken = 49, + ExclamationToken = 50, + TildeToken = 51, + AmpersandAmpersandToken = 52, + BarBarToken = 53, + QuestionToken = 54, + ColonToken = 55, + AtToken = 56, + EqualsToken = 57, + PlusEqualsToken = 58, + MinusEqualsToken = 59, + AsteriskEqualsToken = 60, + AsteriskAsteriskEqualsToken = 61, + SlashEqualsToken = 62, + PercentEqualsToken = 63, + LessThanLessThanEqualsToken = 64, + GreaterThanGreaterThanEqualsToken = 65, + GreaterThanGreaterThanGreaterThanEqualsToken = 66, + AmpersandEqualsToken = 67, + BarEqualsToken = 68, + CaretEqualsToken = 69, + Identifier = 70, + BreakKeyword = 71, + CaseKeyword = 72, + CatchKeyword = 73, + ClassKeyword = 74, + ConstKeyword = 75, + ContinueKeyword = 76, + DebuggerKeyword = 77, + DefaultKeyword = 78, + DeleteKeyword = 79, + DoKeyword = 80, + ElseKeyword = 81, + EnumKeyword = 82, + ExportKeyword = 83, + ExtendsKeyword = 84, + FalseKeyword = 85, + FinallyKeyword = 86, + ForKeyword = 87, + FunctionKeyword = 88, + IfKeyword = 89, + ImportKeyword = 90, + InKeyword = 91, + InstanceOfKeyword = 92, + NewKeyword = 93, + NullKeyword = 94, + ReturnKeyword = 95, + SuperKeyword = 96, + SwitchKeyword = 97, + ThisKeyword = 98, + ThrowKeyword = 99, + TrueKeyword = 100, + TryKeyword = 101, + TypeOfKeyword = 102, + VarKeyword = 103, + VoidKeyword = 104, + WhileKeyword = 105, + WithKeyword = 106, + ImplementsKeyword = 107, + InterfaceKeyword = 108, + LetKeyword = 109, + PackageKeyword = 110, + PrivateKeyword = 111, + ProtectedKeyword = 112, + PublicKeyword = 113, + StaticKeyword = 114, + YieldKeyword = 115, + AbstractKeyword = 116, + AsKeyword = 117, + AnyKeyword = 118, + AsyncKeyword = 119, + AwaitKeyword = 120, + BooleanKeyword = 121, + ConstructorKeyword = 122, + DeclareKeyword = 123, + GetKeyword = 124, + IsKeyword = 125, + 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, + LastCompoundAssignment = 69, + FirstReservedWord = 71, + LastReservedWord = 106, + FirstKeyword = 71, + LastKeyword = 140, + FirstFutureReservedWord = 107, + LastFutureReservedWord = 115, + FirstTypeNode = 156, + LastTypeNode = 171, + FirstPunctuation = 16, + LastPunctuation = 69, FirstToken = 0, - LastToken = 138, + LastToken = 140, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, - LastLiteralToken = 11, - FirstTemplateToken = 11, - LastTemplateToken = 14, - FirstBinaryOperator = 25, - LastBinaryOperator = 68, - FirstNode = 139, - FirstJSDocNode = 257, - LastJSDocNode = 282, - FirstJSDocTagNode = 273, - LastJSDocTagNode = 285, + LastLiteralToken = 12, + FirstTemplateToken = 12, + LastTemplateToken = 15, + FirstBinaryOperator = 26, + LastBinaryOperator = 69, + FirstNode = 141, + FirstJSDocNode = 262, + LastJSDocNode = 287, + FirstJSDocTagNode = 278, + LastJSDocTagNode = 290, } const enum NodeFlags { None = 0, + Let = 1, + Const = 2, + NestedNamespace = 4, + Synthesized = 8, + Namespace = 16, + ExportContext = 32, + ContainsThis = 64, + HasImplicitReturn = 128, + HasExplicitReturn = 256, + GlobalAugmentation = 512, + HasClassExtends = 1024, + HasDecorators = 2048, + HasParamDecorators = 4096, + HasAsyncFunctions = 8192, + 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 = 64512, + ReachabilityAndEmitFlags = 64896, + ContextFlags = 3080192, + TypeExcludesFlags = 655360, + } + const enum ModifierFlags { + None = 0, Export = 1, Ambient = 2, Public = 4, @@ -1127,36 +1240,13 @@ declare namespace ts { Abstract = 128, Async = 256, Default = 512, - Let = 1024, Const = 2048, - Namespace = 4096, - ExportContext = 8192, - ContainsThis = 16384, - HasImplicitReturn = 32768, - HasExplicitReturn = 65536, - GlobalAugmentation = 131072, - HasClassExtends = 262144, - HasDecorators = 524288, - HasParamDecorators = 1048576, - HasAsyncFunctions = 2097152, - DisallowInContext = 4194304, - YieldContext = 8388608, - DecoratorContext = 16777216, - AwaitContext = 33554432, - ThisNodeHasError = 67108864, - JavaScriptFile = 134217728, - ThisNodeOrAnySubNodesHasError = 268435456, - HasAggregatedChildData = 536870912, - HasJsxSpreadAttribute = 1073741824, - Modifier = 1023, + HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, - BlockScoped = 3072, - ReachabilityCheckFlags = 98304, - EmitHelperFlags = 3932160, - ReachabilityAndEmitFlags = 4030464, - ContextFlags = 197132288, - TypeExcludesFlags = 41943040, + NonPublicAccessibilityModifier = 24, + TypeScriptModifier = 2270, + ExportDefault = 513, } const enum JsxFlags { None = 0, @@ -1172,33 +1262,62 @@ declare namespace ts { interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; + modifierFlagsCache?: ModifierFlags; + transformFlags?: TransformFlags; decorators?: NodeArray<Decorator>; modifiers?: ModifiersArray; id?: number; parent?: Node; - jsDocComments?: JSDocComment[]; + original?: Node; + startsOnNewLine?: boolean; + jsDocComments?: JSDoc[]; symbol?: Symbol; locals?: SymbolTable; nextContainer?: Node; localSymbol?: Symbol; flowNode?: FlowNode; + emitNode?: EmitNode; } - interface NodeArray<T> extends Array<T>, TextRange { + interface NodeArray<T extends Node> extends Array<T>, TextRange { hasTrailingComma?: boolean; } - interface ModifiersArray extends NodeArray<Modifier> { - flags: NodeFlags; - } - interface Token extends Node { - __tokenTag: any; - } - interface Modifier extends Token { + interface Token<TKind extends SyntaxKind> extends Node { + kind: TKind; + } + type DotDotDotToken = Token<SyntaxKind.DotDotDotToken>; + type QuestionToken = Token<SyntaxKind.QuestionToken>; + type ColonToken = Token<SyntaxKind.ColonToken>; + type EqualsToken = Token<SyntaxKind.EqualsToken>; + type AsteriskToken = Token<SyntaxKind.AsteriskToken>; + 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>; + const enum GeneratedIdentifierKind { + None = 0, + Auto = 1, + Loop = 2, + Unique = 3, + Node = 4, } interface Identifier extends PrimaryExpression { + kind: SyntaxKind.Identifier; text: string; originalKeywordKind?: SyntaxKind; + autoGenerateKind?: GeneratedIdentifierKind; + autoGenerateId?: number; + isInJSDocNamespace?: boolean; + } + interface TransientIdentifier extends Identifier { + resolvedSymbol: Symbol; + } + interface GeneratedIdentifier extends Identifier { + autoGenerateKind: GeneratedIdentifierKind.Auto | GeneratedIdentifierKind.Loop | GeneratedIdentifierKind.Unique | GeneratedIdentifierKind.Node; } interface QualifiedName extends Node { + kind: SyntaxKind.QualifiedName; left: EntityName; right: Identifier; } @@ -1210,15 +1329,18 @@ declare namespace ts { name?: DeclarationName; } interface DeclarationStatement extends Declaration, Statement { - name?: Identifier; + name?: Identifier | LiteralExpression; } interface ComputedPropertyName extends Node { + kind: SyntaxKind.ComputedPropertyName; expression: Expression; } interface Decorator extends Node { + kind: SyntaxKind.Decorator; expression: LeftHandSideExpression; } interface TypeParameterDeclaration extends Declaration { + kind: SyntaxKind.TypeParameter; name: Identifier; constraint?: TypeNode; expression?: Expression; @@ -1230,39 +1352,48 @@ declare namespace ts { type?: TypeNode; } interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.CallSignature; } interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.ConstructSignature; } + type BindingName = Identifier | BindingPattern; interface VariableDeclaration extends Declaration { + kind: SyntaxKind.VariableDeclaration; parent?: VariableDeclarationList; - name: Identifier | BindingPattern; + name: BindingName; type?: TypeNode; initializer?: Expression; } interface VariableDeclarationList extends Node { + kind: SyntaxKind.VariableDeclarationList; declarations: NodeArray<VariableDeclaration>; } interface ParameterDeclaration extends Declaration { - dotDotDotToken?: Node; - name: Identifier | BindingPattern; - questionToken?: Node; + kind: SyntaxKind.Parameter; + dotDotDotToken?: DotDotDotToken; + name: BindingName; + questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } interface BindingElement extends Declaration { + kind: SyntaxKind.BindingElement; propertyName?: PropertyName; - dotDotDotToken?: Node; - name: Identifier | BindingPattern; + dotDotDotToken?: DotDotDotToken; + name: BindingName; initializer?: Expression; } interface PropertySignature extends TypeElement { + kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember; name: PropertyName; - questionToken?: Node; + questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } interface PropertyDeclaration extends ClassElement { - questionToken?: Node; + kind: SyntaxKind.PropertyDeclaration; + questionToken?: QuestionToken; name: PropertyName; type?: TypeNode; initializer?: Expression; @@ -1271,23 +1402,29 @@ declare namespace ts { _objectLiteralBrandBrand: any; name?: PropertyName; } + type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment; interface PropertyAssignment extends ObjectLiteralElement { - _propertyAssignmentBrand: any; + kind: SyntaxKind.PropertyAssignment; name: PropertyName; - questionToken?: Node; + questionToken?: QuestionToken; initializer: Expression; } interface ShorthandPropertyAssignment extends ObjectLiteralElement { + kind: SyntaxKind.ShorthandPropertyAssignment; name: Identifier; - questionToken?: Node; - equalsToken?: Node; + questionToken?: QuestionToken; + equalsToken?: Token<SyntaxKind.EqualsToken>; objectAssignmentInitializer?: Expression; } + interface SpreadAssignment extends ObjectLiteralElement { + kind: SyntaxKind.SpreadAssignment; + expression: Expression; + } interface VariableLikeDeclaration extends Declaration { propertyName?: PropertyName; - dotDotDotToken?: Node; + dotDotDotToken?: DotDotDotToken; name: DeclarationName; - questionToken?: Node; + questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } @@ -1295,102 +1432,151 @@ declare namespace ts { name: PropertyName; } interface BindingPattern extends Node { - elements: NodeArray<BindingElement>; + elements: NodeArray<BindingElement | ArrayBindingElement>; } interface ObjectBindingPattern extends BindingPattern { + kind: SyntaxKind.ObjectBindingPattern; + elements: NodeArray<BindingElement>; } + type ArrayBindingElement = BindingElement | OmittedExpression; interface ArrayBindingPattern extends BindingPattern { + kind: SyntaxKind.ArrayBindingPattern; + elements: NodeArray<ArrayBindingElement>; } interface FunctionLikeDeclaration extends SignatureDeclaration { _functionLikeDeclarationBrand: any; - asteriskToken?: Node; - questionToken?: Node; + asteriskToken?: AsteriskToken; + questionToken?: QuestionToken; body?: Block | Expression; } interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { + kind: SyntaxKind.FunctionDeclaration; name?: Identifier; body?: FunctionBody; } interface MethodSignature extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.MethodSignature; name: PropertyName; } interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.MethodDeclaration; name: PropertyName; body?: FunctionBody; } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + kind: SyntaxKind.Constructor; body?: FunctionBody; } interface SemicolonClassElement extends ClassElement { - _semicolonClassElementBrand: any; + kind: SyntaxKind.SemicolonClassElement; } - interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - _accessorDeclarationBrand: any; + interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.GetAccessor; name: PropertyName; body: FunctionBody; } - interface GetAccessorDeclaration extends AccessorDeclaration { - } - interface SetAccessorDeclaration extends AccessorDeclaration { + interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.SetAccessor; + name: PropertyName; + body: FunctionBody; } + type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { - _indexSignatureDeclarationBrand: any; + kind: SyntaxKind.IndexSignature; } interface TypeNode extends Node { _typeNodeBrand: any; } + interface KeywordTypeNode extends TypeNode { + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + } interface ThisTypeNode extends TypeNode { - _thisTypeNodeBrand: any; + kind: SyntaxKind.ThisType; } interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { - _functionOrConstructorTypeNodeBrand: any; + kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; } interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + kind: SyntaxKind.FunctionType; } interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + kind: SyntaxKind.ConstructorType; } interface TypeReferenceNode extends TypeNode { + kind: SyntaxKind.TypeReference; typeName: EntityName; typeArguments?: NodeArray<TypeNode>; } interface TypePredicateNode extends TypeNode { + kind: SyntaxKind.TypePredicate; parameterName: Identifier | ThisTypeNode; type: TypeNode; } interface TypeQueryNode extends TypeNode { + kind: SyntaxKind.TypeQuery; exprName: EntityName; } interface TypeLiteralNode extends TypeNode, Declaration { + kind: SyntaxKind.TypeLiteral; members: NodeArray<TypeElement>; } interface ArrayTypeNode extends TypeNode { + kind: SyntaxKind.ArrayType; elementType: TypeNode; } interface TupleTypeNode extends TypeNode { + kind: SyntaxKind.TupleType; elementTypes: NodeArray<TypeNode>; } interface UnionOrIntersectionTypeNode extends TypeNode { + kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType; types: NodeArray<TypeNode>; } interface UnionTypeNode extends UnionOrIntersectionTypeNode { + kind: SyntaxKind.UnionType; } interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { + kind: SyntaxKind.IntersectionType; } interface ParenthesizedTypeNode extends TypeNode { + 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 { - _stringLiteralTypeBrand: any; + kind: SyntaxKind.LiteralType; literal: Expression; } interface StringLiteral extends LiteralExpression { - _stringLiteralBrand: any; + kind: SyntaxKind.StringLiteral; + textSourceNode?: Identifier | StringLiteral; } interface Expression extends Node { _expressionBrand: any; contextualType?: Type; } interface OmittedExpression extends Expression { + kind: SyntaxKind.OmittedExpression; + } + interface PartiallyEmittedExpression extends LeftHandSideExpression { + kind: SyntaxKind.PartiallyEmittedExpression; + expression: Expression; } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; @@ -1398,16 +1584,17 @@ declare namespace ts { interface IncrementExpression extends UnaryExpression { _incrementExpressionBrand: any; } + type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken; interface PrefixUnaryExpression extends IncrementExpression { - operator: SyntaxKind; + kind: SyntaxKind.PrefixUnaryExpression; + operator: PrefixUnaryOperator; operand: UnaryExpression; } + type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; interface PostfixUnaryExpression extends IncrementExpression { + kind: SyntaxKind.PostfixUnaryExpression; operand: LeftHandSideExpression; - operator: SyntaxKind; - } - interface PostfixExpression extends UnaryExpression { - _postfixExpressionBrand: any; + operator: PostfixUnaryOperator; } interface LeftHandSideExpression extends IncrementExpression { _leftHandSideExpressionBrand: any; @@ -1418,42 +1605,94 @@ declare namespace ts { interface PrimaryExpression extends MemberExpression { _primaryExpressionBrand: any; } + interface NullLiteral extends PrimaryExpression { + kind: SyntaxKind.NullKeyword; + } + interface BooleanLiteral extends PrimaryExpression { + kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; + } + interface ThisExpression extends PrimaryExpression { + kind: SyntaxKind.ThisKeyword; + } + interface SuperExpression extends PrimaryExpression { + kind: SyntaxKind.SuperKeyword; + } interface DeleteExpression extends UnaryExpression { + kind: SyntaxKind.DeleteExpression; expression: UnaryExpression; } interface TypeOfExpression extends UnaryExpression { + kind: SyntaxKind.TypeOfExpression; expression: UnaryExpression; } interface VoidExpression extends UnaryExpression { + kind: SyntaxKind.VoidExpression; expression: UnaryExpression; } interface AwaitExpression extends UnaryExpression { + kind: SyntaxKind.AwaitExpression; expression: UnaryExpression; } interface YieldExpression extends Expression { - asteriskToken?: Node; + kind: SyntaxKind.YieldExpression; + asteriskToken?: AsteriskToken; expression?: Expression; } + type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; + type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; + type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator; + type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken; + type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator; + type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken; + type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator; + type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword; + type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator; + type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken; + type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator; + type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken; + type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; + type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; + type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; + type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken; + type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; + type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator; + type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; + type BinaryOperatorToken = Token<BinaryOperator>; interface BinaryExpression extends Expression, Declaration { + kind: SyntaxKind.BinaryExpression; left: Expression; - operatorToken: Node; + 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; - questionToken: Node; + questionToken: QuestionToken; whenTrue: Expression; - colonToken: Node; + colonToken: ColonToken; whenFalse: Expression; } type FunctionBody = Block; type ConciseBody = FunctionBody | Expression; interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + kind: SyntaxKind.FunctionExpression; name?: Identifier; body: FunctionBody; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { - equalsGreaterThanToken: Node; + kind: SyntaxKind.ArrowFunction; + equalsGreaterThanToken: EqualsGreaterThanToken; body: ConciseBody; } interface LiteralLikeNode extends Node { @@ -1465,126 +1704,198 @@ declare namespace ts { interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { _literalExpressionBrand: any; } - interface TemplateLiteralFragment extends LiteralLikeNode { - _templateLiteralFragmentBrand: any; + interface RegularExpressionLiteral extends LiteralExpression { + kind: SyntaxKind.RegularExpressionLiteral; + } + interface NoSubstitutionTemplateLiteral extends LiteralExpression { + kind: SyntaxKind.NoSubstitutionTemplateLiteral; + } + interface NumericLiteral extends LiteralExpression { + kind: SyntaxKind.NumericLiteral; + trailingComment?: string; + } + interface TemplateHead extends LiteralLikeNode { + kind: SyntaxKind.TemplateHead; } + interface TemplateMiddle extends LiteralLikeNode { + kind: SyntaxKind.TemplateMiddle; + } + interface TemplateTail extends LiteralLikeNode { + kind: SyntaxKind.TemplateTail; + } + type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; interface TemplateExpression extends PrimaryExpression { - head: TemplateLiteralFragment; + kind: SyntaxKind.TemplateExpression; + head: TemplateHead; templateSpans: NodeArray<TemplateSpan>; } interface TemplateSpan extends Node { + kind: SyntaxKind.TemplateSpan; expression: Expression; - literal: TemplateLiteralFragment; + literal: TemplateMiddle | TemplateTail; } interface ParenthesizedExpression extends PrimaryExpression { + kind: SyntaxKind.ParenthesizedExpression; expression: Expression; } interface ArrayLiteralExpression extends PrimaryExpression { + kind: SyntaxKind.ArrayLiteralExpression; elements: NodeArray<Expression>; multiLine?: boolean; } - interface SpreadElementExpression extends Expression { + interface SpreadElement extends Expression { + kind: SyntaxKind.SpreadElement; expression: Expression; } - interface ObjectLiteralExpression extends PrimaryExpression, Declaration { - properties: NodeArray<ObjectLiteralElement>; + interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration { + properties: NodeArray<T>; + } + interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> { + kind: SyntaxKind.ObjectLiteralExpression; multiLine?: boolean; } type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; interface PropertyAccessExpression extends MemberExpression, Declaration { + kind: SyntaxKind.PropertyAccessExpression; expression: LeftHandSideExpression; name: Identifier; } + interface SuperPropertyAccessExpression extends PropertyAccessExpression { + expression: SuperExpression; + } interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { _propertyAccessExpressionLikeQualifiedNameBrand?: any; expression: EntityNameExpression; } interface ElementAccessExpression extends MemberExpression { + kind: SyntaxKind.ElementAccessExpression; expression: LeftHandSideExpression; argumentExpression?: Expression; } + interface SuperElementAccessExpression extends ElementAccessExpression { + expression: SuperExpression; + } + type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression; interface CallExpression extends LeftHandSideExpression, Declaration { + kind: SyntaxKind.CallExpression; expression: LeftHandSideExpression; typeArguments?: NodeArray<TypeNode>; arguments: NodeArray<Expression>; } + interface SuperCall extends CallExpression { + expression: SuperExpression; + } interface ExpressionWithTypeArguments extends TypeNode { + kind: SyntaxKind.ExpressionWithTypeArguments; expression: LeftHandSideExpression; typeArguments?: NodeArray<TypeNode>; } - interface NewExpression extends CallExpression, PrimaryExpression { + interface NewExpression extends PrimaryExpression, Declaration { + kind: SyntaxKind.NewExpression; + expression: LeftHandSideExpression; + typeArguments?: NodeArray<TypeNode>; + arguments: NodeArray<Expression>; } interface TaggedTemplateExpression extends MemberExpression { + kind: SyntaxKind.TaggedTemplateExpression; tag: LeftHandSideExpression; - template: LiteralExpression | TemplateExpression; + template: TemplateLiteral; } type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; interface AsExpression extends Expression { + kind: SyntaxKind.AsExpression; expression: Expression; type: TypeNode; } interface TypeAssertion extends UnaryExpression { + kind: SyntaxKind.TypeAssertionExpression; type: TypeNode; expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; interface NonNullExpression extends LeftHandSideExpression { + kind: SyntaxKind.NonNullExpression; expression: Expression; } interface JsxElement extends PrimaryExpression { + kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; children: NodeArray<JsxChild>; closingElement: JsxClosingElement; } type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; interface JsxOpeningElement extends Expression { - _openingElementBrand?: any; + kind: SyntaxKind.JsxOpeningElement; tagName: JsxTagNameExpression; attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>; } - interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement { - _selfClosingElementBrand?: any; + interface JsxSelfClosingElement extends PrimaryExpression { + kind: SyntaxKind.JsxSelfClosingElement; + tagName: JsxTagNameExpression; + attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>; } type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; + type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; interface JsxAttribute extends Node { + kind: SyntaxKind.JsxAttribute; name: Identifier; - initializer?: Expression; + initializer?: StringLiteral | JsxExpression; } interface JsxSpreadAttribute extends Node { + kind: SyntaxKind.JsxSpreadAttribute; expression: Expression; } interface JsxClosingElement extends Node { + kind: SyntaxKind.JsxClosingElement; tagName: JsxTagNameExpression; } interface JsxExpression extends Expression { + kind: SyntaxKind.JsxExpression; expression?: Expression; } interface JsxText extends Node { - _jsxTextExpressionBrand: any; + kind: SyntaxKind.JsxText; } type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; interface Statement extends Node { _statementBrand: any; } + interface NotEmittedStatement extends Statement { + kind: SyntaxKind.NotEmittedStatement; + } + interface EndOfDeclarationMarker extends Statement { + kind: SyntaxKind.EndOfDeclarationMarker; + } + interface MergeDeclarationMarker extends Statement { + kind: SyntaxKind.MergeDeclarationMarker; + } interface EmptyStatement extends Statement { + kind: SyntaxKind.EmptyStatement; } interface DebuggerStatement extends Statement { + kind: SyntaxKind.DebuggerStatement; } interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { + kind: SyntaxKind.MissingDeclaration; name?: Identifier; } type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; interface Block extends Statement { + kind: SyntaxKind.Block; statements: NodeArray<Statement>; + multiLine?: boolean; } interface VariableStatement extends Statement { + kind: SyntaxKind.VariableStatement; declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement { + kind: SyntaxKind.ExpressionStatement; expression: Expression; } interface IfStatement extends Statement { + kind: SyntaxKind.IfStatement; expression: Expression; thenStatement: Statement; elseStatement?: Statement; @@ -1593,67 +1904,85 @@ declare namespace ts { statement: Statement; } interface DoStatement extends IterationStatement { + kind: SyntaxKind.DoStatement; expression: Expression; } interface WhileStatement extends IterationStatement { + kind: SyntaxKind.WhileStatement; expression: Expression; } + type ForInitializer = VariableDeclarationList | Expression; interface ForStatement extends IterationStatement { - initializer?: VariableDeclarationList | Expression; + kind: SyntaxKind.ForStatement; + initializer?: ForInitializer; condition?: Expression; incrementor?: Expression; } interface ForInStatement extends IterationStatement { - initializer: VariableDeclarationList | Expression; + kind: SyntaxKind.ForInStatement; + initializer: ForInitializer; expression: Expression; } interface ForOfStatement extends IterationStatement { - initializer: VariableDeclarationList | Expression; + kind: SyntaxKind.ForOfStatement; + initializer: ForInitializer; expression: Expression; } interface BreakStatement extends Statement { + kind: SyntaxKind.BreakStatement; label?: Identifier; } interface ContinueStatement extends Statement { + kind: SyntaxKind.ContinueStatement; label?: Identifier; } type BreakOrContinueStatement = BreakStatement | ContinueStatement; interface ReturnStatement extends Statement { + kind: SyntaxKind.ReturnStatement; expression?: Expression; } interface WithStatement extends Statement { + kind: SyntaxKind.WithStatement; expression: Expression; statement: Statement; } interface SwitchStatement extends Statement { + kind: SyntaxKind.SwitchStatement; expression: Expression; caseBlock: CaseBlock; possiblyExhaustive?: boolean; } interface CaseBlock extends Node { + kind: SyntaxKind.CaseBlock; clauses: NodeArray<CaseOrDefaultClause>; } interface CaseClause extends Node { + kind: SyntaxKind.CaseClause; expression: Expression; statements: NodeArray<Statement>; } interface DefaultClause extends Node { + kind: SyntaxKind.DefaultClause; statements: NodeArray<Statement>; } type CaseOrDefaultClause = CaseClause | DefaultClause; interface LabeledStatement extends Statement { + kind: SyntaxKind.LabeledStatement; label: Identifier; statement: Statement; } interface ThrowStatement extends Statement { + kind: SyntaxKind.ThrowStatement; expression: Expression; } interface TryStatement extends Statement { + kind: SyntaxKind.TryStatement; tryBlock: Block; catchClause?: CatchClause; finallyBlock?: Block; } interface CatchClause extends Node { + kind: SyntaxKind.CatchClause; variableDeclaration: VariableDeclaration; block: Block; } @@ -1665,9 +1994,11 @@ declare namespace ts { members: NodeArray<ClassElement>; } interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { + kind: SyntaxKind.ClassDeclaration; name?: Identifier; } interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + kind: SyntaxKind.ClassExpression; } interface ClassElement extends Declaration { _classElementBrand: any; @@ -1676,82 +2007,112 @@ declare namespace ts { interface TypeElement extends Declaration { _typeElementBrand: any; name?: PropertyName; - questionToken?: Node; + questionToken?: QuestionToken; } interface InterfaceDeclaration extends DeclarationStatement { + kind: SyntaxKind.InterfaceDeclaration; name: Identifier; typeParameters?: NodeArray<TypeParameterDeclaration>; heritageClauses?: NodeArray<HeritageClause>; members: NodeArray<TypeElement>; } interface HeritageClause extends Node { + kind: SyntaxKind.HeritageClause; token: SyntaxKind; types?: NodeArray<ExpressionWithTypeArguments>; } interface TypeAliasDeclaration extends DeclarationStatement { + kind: SyntaxKind.TypeAliasDeclaration; name: Identifier; typeParameters?: NodeArray<TypeParameterDeclaration>; type: TypeNode; } interface EnumMember extends Declaration { - name: DeclarationName; + kind: SyntaxKind.EnumMember; + name: PropertyName; initializer?: Expression; } interface EnumDeclaration extends DeclarationStatement { + kind: SyntaxKind.EnumDeclaration; name: Identifier; members: NodeArray<EnumMember>; } type ModuleBody = ModuleBlock | ModuleDeclaration; + type ModuleName = Identifier | StringLiteral; interface ModuleDeclaration extends DeclarationStatement { + kind: SyntaxKind.ModuleDeclaration; name: Identifier | LiteralExpression; - body?: ModuleBlock | ModuleDeclaration; + 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>; } + type ModuleReference = EntityName | ExternalModuleReference; interface ImportEqualsDeclaration extends DeclarationStatement { + kind: SyntaxKind.ImportEqualsDeclaration; name: Identifier; - moduleReference: EntityName | ExternalModuleReference; + moduleReference: ModuleReference; } interface ExternalModuleReference extends Node { + kind: SyntaxKind.ExternalModuleReference; expression?: Expression; } interface ImportDeclaration extends Statement { + kind: SyntaxKind.ImportDeclaration; importClause?: ImportClause; moduleSpecifier: Expression; } + type NamedImportBindings = NamespaceImport | NamedImports; interface ImportClause extends Declaration { + kind: SyntaxKind.ImportClause; name?: Identifier; - namedBindings?: NamespaceImport | NamedImports; + namedBindings?: NamedImportBindings; } interface NamespaceImport extends Declaration { + kind: SyntaxKind.NamespaceImport; name: Identifier; } interface NamespaceExportDeclaration extends DeclarationStatement { + kind: SyntaxKind.NamespaceExportDeclaration; name: Identifier; moduleReference: LiteralLikeNode; } interface ExportDeclaration extends DeclarationStatement { + kind: SyntaxKind.ExportDeclaration; exportClause?: NamedExports; moduleSpecifier?: Expression; } interface NamedImports extends Node { + kind: SyntaxKind.NamedImports; elements: NodeArray<ImportSpecifier>; } interface NamedExports extends Node { + kind: SyntaxKind.NamedExports; elements: NodeArray<ExportSpecifier>; } type NamedImportsOrExports = NamedImports | NamedExports; interface ImportSpecifier extends Declaration { + kind: SyntaxKind.ImportSpecifier; propertyName?: Identifier; name: Identifier; } interface ExportSpecifier extends Declaration { + kind: SyntaxKind.ExportSpecifier; propertyName?: Identifier; name: Identifier; } type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; interface ExportAssignment extends DeclarationStatement { + kind: SyntaxKind.ExportAssignment; isExportEquals?: boolean; expression: Expression; } @@ -1763,96 +2124,126 @@ declare namespace ts { kind: SyntaxKind; } interface JSDocTypeExpression extends Node { + kind: SyntaxKind.JSDocTypeExpression; type: JSDocType; } interface JSDocType extends TypeNode { _jsDocTypeBrand: any; } interface JSDocAllType extends JSDocType { - _JSDocAllTypeBrand: any; + kind: SyntaxKind.JSDocAllType; } interface JSDocUnknownType extends JSDocType { - _JSDocUnknownTypeBrand: any; + kind: SyntaxKind.JSDocUnknownType; } interface JSDocArrayType extends JSDocType { + kind: SyntaxKind.JSDocArrayType; elementType: JSDocType; } interface JSDocUnionType extends JSDocType { + kind: SyntaxKind.JSDocUnionType; types: NodeArray<JSDocType>; } interface JSDocTupleType extends JSDocType { + kind: SyntaxKind.JSDocTupleType; types: NodeArray<JSDocType>; } interface JSDocNonNullableType extends JSDocType { + kind: SyntaxKind.JSDocNonNullableType; type: JSDocType; } interface JSDocNullableType extends JSDocType { + kind: SyntaxKind.JSDocNullableType; type: JSDocType; } - interface JSDocRecordType extends JSDocType, TypeLiteralNode { - members: NodeArray<JSDocRecordMember>; + interface JSDocRecordType extends JSDocType { + kind: SyntaxKind.JSDocRecordType; + literal: TypeLiteralNode; } interface JSDocTypeReference extends JSDocType { + kind: SyntaxKind.JSDocTypeReference; name: EntityName; typeArguments: NodeArray<JSDocType>; } interface JSDocOptionalType extends JSDocType { + kind: SyntaxKind.JSDocOptionalType; type: JSDocType; } interface JSDocFunctionType extends JSDocType, SignatureDeclaration { + kind: SyntaxKind.JSDocFunctionType; parameters: NodeArray<ParameterDeclaration>; type: JSDocType; } interface JSDocVariadicType extends JSDocType { + kind: SyntaxKind.JSDocVariadicType; type: JSDocType; } interface JSDocConstructorType extends JSDocType { + kind: SyntaxKind.JSDocConstructorType; type: JSDocType; } interface JSDocThisType extends JSDocType { + kind: SyntaxKind.JSDocThisType; type: JSDocType; } interface JSDocLiteralType extends JSDocType { + kind: SyntaxKind.JSDocLiteralType; literal: LiteralTypeNode; } type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; interface JSDocRecordMember extends PropertySignature { + kind: SyntaxKind.JSDocRecordMember; name: Identifier | LiteralExpression; type?: JSDocType; } - interface JSDocComment extends Node { - tags: NodeArray<JSDocTag>; + interface JSDoc extends Node { + kind: SyntaxKind.JSDocComment; + tags: NodeArray<JSDocTag> | undefined; + comment: string | undefined; } interface JSDocTag extends Node { - atToken: Node; + atToken: AtToken; tagName: Identifier; + comment: string | undefined; + } + interface JSDocUnknownTag extends JSDocTag { + kind: SyntaxKind.JSDocTag; } interface JSDocTemplateTag extends JSDocTag { + kind: SyntaxKind.JSDocTemplateTag; typeParameters: NodeArray<TypeParameterDeclaration>; } interface JSDocReturnTag extends JSDocTag { + kind: SyntaxKind.JSDocReturnTag; typeExpression: JSDocTypeExpression; } interface JSDocTypeTag extends JSDocTag { + kind: SyntaxKind.JSDocTypeTag; typeExpression: JSDocTypeExpression; } interface JSDocTypedefTag extends JSDocTag, Declaration { + kind: SyntaxKind.JSDocTypedefTag; + fullName?: JSDocNamespaceDeclaration | Identifier; name?: Identifier; typeExpression?: JSDocTypeExpression; jsDocTypeLiteral?: JSDocTypeLiteral; } interface JSDocPropertyTag extends JSDocTag, TypeElement { + kind: SyntaxKind.JSDocPropertyTag; name: Identifier; typeExpression: JSDocTypeExpression; } interface JSDocTypeLiteral extends JSDocType { + kind: SyntaxKind.JSDocTypeLiteral; jsDocPropertyTags?: NodeArray<JSDocPropertyTag>; jsDocTypeTag?: JSDocTypeTag; } interface JSDocParameterTag extends JSDocTag { + kind: SyntaxKind.JSDocParameterTag; preParameterName?: Identifier; typeExpression?: JSDocTypeExpression; postParameterName?: Identifier; + parameterName: Identifier; isBracketed: boolean; } const enum FlowFlags { @@ -1864,8 +2255,9 @@ declare namespace ts { TrueCondition = 32, FalseCondition = 64, SwitchClause = 128, - Referenced = 256, - Shared = 512, + ArrayMutation = 256, + Referenced = 512, + Shared = 1024, Label = 12, Condition = 96, } @@ -1874,7 +2266,7 @@ declare namespace ts { id?: number; } interface FlowStart extends FlowNode { - container?: FunctionExpression | ArrowFunction; + container?: FunctionExpression | ArrowFunction | MethodDeclaration; } interface FlowLabel extends FlowNode { antecedents: FlowNode[]; @@ -1893,6 +2285,10 @@ declare namespace ts { clauseEnd: number; antecedent: FlowNode; } + interface FlowArrayMutation extends FlowNode { + node: CallExpression | BinaryExpression; + antecedent: FlowNode; + } type FlowType = Type | IncompleteType; interface IncompleteType { flags: TypeFlags; @@ -1903,8 +2299,9 @@ declare namespace ts { name: string; } interface SourceFile extends Declaration { + kind: SyntaxKind.SourceFile; statements: NodeArray<Statement>; - endOfFileToken: Node; + endOfFileToken: Token<SyntaxKind.EndOfFileToken>; fileName: string; path: Path; text: string; @@ -1925,14 +2322,17 @@ declare namespace ts { identifierCount: number; symbolCount: number; parseDiagnostics: Diagnostic[]; + additionalSyntacticDiagnostics?: Diagnostic[]; bindDiagnostics: Diagnostic[]; lineMap: number[]; classifiableNames?: Map<string>; - resolvedModules: Map<ResolvedModule>; + resolvedModules: Map<ResolvedModuleFull>; resolvedTypeReferenceDirectiveNames: Map<ResolvedTypeReferenceDirective>; imports: LiteralExpression[]; moduleAugmentations: LiteralExpression[]; patternAmbientModules?: PatternAmbientModule[]; + ambientModuleNames: string[]; + externalHelpersModuleName?: Identifier; } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; @@ -1944,6 +2344,7 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; fileExists(path: string): boolean; + readFile(path: string): string; } interface WriteFileCallback { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; @@ -1974,6 +2375,7 @@ declare namespace ts { getTypeCount(): number; getFileProcessingDiagnostics(): DiagnosticCollection; getResolvedTypeReferenceDirectives(): Map<ResolvedTypeReferenceDirective>; + isSourceFileFromExternalLibrary(file: SourceFile): boolean; structureIsReused?: boolean; } interface SourceMapSpan { @@ -2051,6 +2453,7 @@ declare namespace ts { getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; + tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol; getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; @@ -2098,6 +2501,7 @@ declare namespace ts { UseFullyQualifiedType = 128, InFirstTypeArgument = 256, InTypeAlias = 512, + UseTypeAliasValue = 1024, } const enum SymbolFormatFlags { None = 0, @@ -2109,6 +2513,10 @@ declare namespace ts { NotAccessible = 1, CannotBeNamed = 2, } + const enum SyntheticSymbolKind { + UnionOrIntersection = 0, + Spread = 1, + } const enum TypePredicateKind { This = 0, Identifier = 1, @@ -2118,9 +2526,10 @@ declare namespace ts { type: Type; } interface ThisTypePredicate extends TypePredicateBase { - _thisTypePredicateBrand: any; + kind: TypePredicateKind.This; } interface IdentifierTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.Identifier; parameterName: string; parameterIndex: number; } @@ -2138,18 +2547,19 @@ declare namespace ts { enum TypeReferenceSerializationKind { Unknown = 0, TypeWithConstructSignatureAndValue = 1, - VoidType = 2, + VoidNullableOrNeverType = 2, NumberLikeType = 3, StringLikeType = 4, BooleanType = 5, ArrayLikeType = 6, ESSymbolType = 7, - TypeWithCallSignature = 8, - ObjectType = 9, + Promise = 8, + TypeWithCallSignature = 9, + ObjectType = 10, } interface EmitResolver { hasGlobalName(name: string): boolean; - getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration; + getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration; getReferencedImportDeclaration(node: Identifier): Declaration; getReferencedDeclarationWithCollidingName(node: Identifier): Declaration; isDeclarationWithCollidingName(node: Declaration): boolean; @@ -2168,13 +2578,16 @@ declare namespace ts { isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; getReferencedValueDeclaration(reference: Identifier): Declaration; - getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind; + getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind; isOptionalParameter(node: ParameterDeclaration): boolean; moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; isArgumentsLocalBinding(node: Identifier): boolean; getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile; getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[]; getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[]; + isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean; + writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, writer: SymbolWriter): void; + getJsxFactoryEntity(): EntityName; } const enum SymbolFlags { None = 0, @@ -2272,7 +2685,10 @@ declare namespace ts { mapper?: TypeMapper; referenced?: boolean; containingType?: UnionOrIntersectionType; - hasCommonType?: boolean; + leftSpread?: Symbol; + rightSpread?: Symbol; + hasNonUniformType?: boolean; + isPartial?: boolean; isDiscriminantProperty?: boolean; resolvedExports?: SymbolTable; exportsChecked?: boolean; @@ -2310,6 +2726,8 @@ declare namespace ts { BodyScopedClassBinding = 1048576, NeedsLoopOutParameter = 2097152, AssignmentsMarked = 4194304, + ClassWithConstructorReference = 8388608, + ConstructorReferenceInClass = 16777216, } interface NodeLinks { flags?: NodeCheckFlags; @@ -2317,6 +2735,7 @@ declare namespace ts { resolvedSignature?: Signature; resolvedSymbol?: Symbol; resolvedIndexInfo?: IndexInfo; + maybeTypePredicate?: boolean; enumMemberValue?: number; isVisible?: boolean; hasReportedStatementInAmbientContext?: boolean; @@ -2342,23 +2761,18 @@ 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, - ObjectLiteral = 8388608, - FreshObjectLiteral = 16777216, - ContainsWideningType = 33554432, - ContainsObjectLiteral = 67108864, - ContainsAnyFunctionType = 134217728, - ThisType = 268435456, - ObjectLiteralPatternWithComputedProperties = 536870912, + Object = 32768, + Union = 65536, + Intersection = 131072, + Index = 262144, + IndexedAccess = 524288, + FreshLiteral = 1048576, + ContainsWideningType = 2097152, + ContainsObjectLiteral = 4194304, + ContainsAnyFunctionType = 8388608, Nullable = 6144, Literal = 480, + StringOrNumberLiteral = 96, DefinitelyFalsy = 7392, PossiblyFalsy = 7406, Intrinsic = 16015, @@ -2367,14 +2781,13 @@ declare namespace ts { NumberLike = 340, BooleanLike = 136, EnumLike = 272, - ObjectType = 2588672, - UnionOrIntersection = 1572864, - StructuredType = 4161536, - StructuredOrTypeParameter = 4177920, - Narrowable = 4178943, - NotUnionOrUnit = 2589191, - RequiresWidening = 100663296, - PropagatingFlags = 234881024, + UnionOrIntersection = 196608, + StructuredType = 229376, + StructuredOrTypeParameter = 507904, + Narrowable = 1033215, + NotUnionOrUnit = 33281, + RequiresWidening = 6291456, + PropagatingFlags = 14680064, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -2390,6 +2803,8 @@ declare namespace ts { } interface LiteralType extends Type { text: string; + freshType?: LiteralType; + regularType?: LiteralType; } interface EnumType extends Type { memberTypes: Map<EnumLiteralType>; @@ -2397,7 +2812,21 @@ declare namespace ts { interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; } + const 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 { + objectFlags: ObjectFlags; } interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; @@ -2430,10 +2859,22 @@ declare namespace ts { } interface IntersectionType extends UnionOrIntersectionType { } + type StructuredType = ObjectType | UnionType | IntersectionType; interface AnonymousType extends ObjectType { target?: AnonymousType; mapper?: TypeMapper; } + interface MappedType extends ObjectType { + declaration: MappedTypeNode; + typeParameter?: TypeParameter; + constraintType?: Type; + templateType?: Type; + mapper?: TypeMapper; + } + interface EvolvingArrayType extends ObjectType { + elementType: Type; + finalArrayType?: Type; + } interface ResolvedType extends ObjectType, UnionOrIntersectionType { members: SymbolTable; properties: Symbol[]; @@ -2454,6 +2895,16 @@ declare namespace ts { target?: TypeParameter; mapper?: TypeMapper; resolvedApparentType: Type; + resolvedIndexType: IndexType; + resolvedIndexedAccessTypes: IndexedAccessType[]; + isThisType?: boolean; + } + interface IndexType extends Type { + type: TypeParameter; + } + interface IndexedAccessType extends Type { + objectType: Type; + indexType: TypeParameter; } const enum SignatureKind { Call = 0, @@ -2474,6 +2925,7 @@ declare namespace ts { erasedSignatureCache?: Signature; isolatedSignatureType?: ObjectType; typePredicate?: TypePredicate; + instantiations?: Map<Signature>; } const enum IndexKind { String = 0, @@ -2487,17 +2939,17 @@ declare namespace ts { interface TypeMapper { (t: TypeParameter): Type; mappedTypes?: Type[]; - targetTypes?: Type[]; instantiations?: Type[]; context?: InferenceContext; } interface TypeInferences { primary: Type[]; secondary: Type[]; + topLevel: boolean; isFixed: boolean; } interface InferenceContext { - typeParameters: TypeParameter[]; + signature: Signature; inferUnionTypes: boolean; inferences: TypeInferences[]; inferredTypes: Type[]; @@ -2547,6 +2999,7 @@ declare namespace ts { allowSyntheticDefaultImports?: boolean; allowUnreachableCode?: boolean; allowUnusedLabels?: boolean; + alwaysStrict?: boolean; baseUrl?: string; charset?: string; configFilePath?: string; @@ -2560,6 +3013,7 @@ declare namespace ts { experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; help?: boolean; + importHelpers?: boolean; init?: boolean; inlineSourceMap?: boolean; inlineSources?: boolean; @@ -2575,6 +3029,7 @@ declare namespace ts { moduleResolution?: ModuleResolutionKind; newLine?: NewLineKind; noEmit?: boolean; + noEmitForJsFiles?: boolean; noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; @@ -2595,6 +3050,7 @@ declare namespace ts { project?: string; pretty?: DiagnosticStyle; reactNamespace?: string; + jsxFactory?: string; removeComments?: boolean; rootDir?: string; rootDirs?: string[]; @@ -2628,6 +3084,7 @@ declare namespace ts { packageNameToTypingLocation: Map<string>; typingOptions: TypingOptions; compilerOptions: CompilerOptions; + unresolvedImports: ReadonlyArray<string>; } enum ModuleKind { None = 0, @@ -2635,7 +3092,6 @@ declare namespace ts { AMD = 2, UMD = 3, System = 4, - ES6 = 5, ES2015 = 5, } const enum JsxEmit { @@ -2661,9 +3117,11 @@ declare namespace ts { const enum ScriptTarget { ES3 = 0, ES5 = 1, - ES6 = 2, ES2015 = 2, - Latest = 2, + ES2016 = 3, + ES2017 = 4, + ESNext = 5, + Latest = 5, } const enum LanguageVariant { Standard = 0, @@ -2853,8 +3311,19 @@ declare namespace ts { resolvedFileName: string; isExternalLibraryImport?: boolean; } + interface ResolvedModuleFull extends ResolvedModule { + 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 { @@ -2879,6 +3348,111 @@ declare namespace ts { getNewLine(): string; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + getEnvironmentVariable?(name: string): string; + } + const enum TransformFlags { + None = 0, + TypeScript = 1, + ContainsTypeScript = 2, + Jsx = 4, + ContainsJsx = 8, + ESNext = 16, + ContainsESNext = 32, + ES2017 = 64, + ContainsES2017 = 128, + ES2016 = 256, + ContainsES2016 = 512, + ES2015 = 1024, + ContainsES2015 = 2048, + Generator = 4096, + ContainsGenerator = 8192, + DestructuringAssignment = 16384, + ContainsDestructuringAssignment = 32768, + ContainsDecorators = 65536, + ContainsPropertyInitializer = 131072, + ContainsLexicalThis = 262144, + ContainsCapturedLexicalThis = 524288, + ContainsLexicalThisInComputedPropertyName = 1048576, + ContainsDefaultValueAssignments = 2097152, + ContainsParameterPropertyAssignments = 4194304, + ContainsSpreadExpression = 8388608, + ContainsComputedPropertyName = 16777216, + ContainsBlockScopedBinding = 33554432, + ContainsBindingPattern = 67108864, + ContainsYield = 134217728, + ContainsHoistedDeclarationOrCompletion = 268435456, + HasComputedFlags = 536870912, + AssertTypeScript = 3, + AssertJsx = 12, + AssertESNext = 48, + AssertES2017 = 192, + AssertES2016 = 768, + AssertES2015 = 3072, + AssertGenerator = 12288, + AssertDestructuringAssignment = 49152, + NodeExcludes = 536892757, + ArrowFunctionExcludes = 979719509, + FunctionExcludes = 980243797, + ConstructorExcludes = 975983957, + MethodOrAccessorExcludes = 975983957, + ClassExcludes = 559895893, + ModuleExcludes = 839734613, + TypeExcludes = -3, + ObjectLiteralExcludes = 554784085, + ArrayLiteralOrCallOrNewExcludes = 545281365, + VariableDeclarationListExcludes = 604001621, + ParameterExcludes = 604001621, + TypeScriptClassSyntaxMask = 4390912, + ES2015FunctionSyntaxMask = 2621440, + } + interface EmitNode { + flags?: EmitFlags; + commentRange?: TextRange; + sourceMapRange?: TextRange; + tokenSourceMapRanges?: Map<TextRange>; + annotatedNodes?: Node[]; + constantValue?: number; + } + const enum EmitFlags { + EmitEmitHelpers = 1, + EmitExportStar = 2, + EmitSuperHelper = 4, + EmitAdvancedSuperHelper = 8, + UMDDefine = 16, + SingleLine = 32, + AdviseOnEmitNode = 64, + NoSubstitution = 128, + CapturesThis = 256, + NoLeadingSourceMap = 512, + NoTrailingSourceMap = 1024, + NoSourceMap = 1536, + NoNestedSourceMaps = 2048, + NoTokenLeadingSourceMaps = 4096, + NoTokenTrailingSourceMaps = 8192, + NoTokenSourceMaps = 12288, + NoLeadingComments = 16384, + NoTrailingComments = 32768, + NoComments = 49152, + NoNestedComments = 65536, + ExportName = 131072, + LocalName = 262144, + Indented = 524288, + NoIndentation = 1048576, + AsyncFunctionBody = 2097152, + ReuseTempVariableScope = 4194304, + CustomPrologue = 8388608, + NoHoisting = 16777216, + HasEndOfDeclarationMarker = 33554432, + } + const enum EmitContext { + SourceFile = 0, + Expression = 1, + IdentifierName = 2, + Unspecified = 3, + } + interface LexicalEnvironment { + startLexicalEnvironment(): void; + endLexicalEnvironment(): Statement[]; } interface TextSpan { start: number; @@ -2929,48 +3503,78 @@ declare namespace ts { GreaterThan = 1, } function forEach<T, U>(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined; + function zipWith<T, U>(arrayA: T[], arrayB: U[], callback: (a: T, b: U, index: number) => void): void; + function every<T>(array: T[], callback: (element: T, index: number) => boolean): boolean; function find<T>(array: T[], predicate: (element: T, index: number) => boolean): T | undefined; function findMap<T, U>(array: T[], callback: (element: T, index: number) => U | undefined): U; function contains<T>(array: T[], value: T): boolean; function indexOf<T>(array: T[], value: T): number; function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number; - function countWhere<T>(array: T[], predicate: (x: T) => boolean): number; + function countWhere<T>(array: T[], predicate: (x: T, i: number) => boolean): number; + function filter<T, U extends T>(array: T[], f: (x: T) => x is U): U[]; function filter<T>(array: T[], f: (x: T) => boolean): T[]; function removeWhere<T>(array: T[], f: (x: T) => boolean): boolean; function filterMutate<T>(array: T[], f: (x: T) => boolean): void; - function map<T, U>(array: T[], f: (x: T) => U): U[]; + function map<T, U>(array: T[], f: (x: T, i: number) => U): U[]; + function sameMap<T>(array: T[], f: (x: T, i: number) => T): T[]; + function flatten<T>(array: (T | T[])[]): T[]; + function flatMap<T, U>(array: T[], mapfn: (x: T, i: number) => U | U[]): U[]; + function span<T>(array: T[], f: (x: T, i: number) => boolean): [T[], T[]]; + function spanMap<T, K, U>(array: T[], keyfn: (x: T, i: number) => K, mapfn: (chunk: T[], key: K, start: number, end: number) => U): U[]; + function mapObject<T, U>(object: MapLike<T>, f: (key: string, x: T) => [string, U]): MapLike<U>; + function some<T>(array: T[], predicate?: (value: T) => boolean): boolean; function concatenate<T>(array1: T[], array2: T[]): T[]; function deduplicate<T>(array: T[], areEqual?: (a: T, b: T) => boolean): T[]; + function arrayIsEqualTo<T>(array1: ReadonlyArray<T>, array2: ReadonlyArray<T>, equaler?: (a: T, b: T) => boolean): boolean; + function changesAffectModuleResolution(oldOptions: CompilerOptions, newOptions: CompilerOptions): boolean; + function compact<T>(array: T[]): T[]; + function relativeComplement<T>(arrayA: T[] | undefined, arrayB: T[] | undefined, comparer?: (x: T, y: T) => Comparison, offsetA?: number, offsetB?: number): T[] | undefined; function sum(array: any[], prop: string): number; - function addRange<T>(to: T[], from: T[]): void; + function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined; + function addRange<T>(to: T[] | undefined, from: T[] | undefined): T[] | undefined; function rangeEquals<T>(array1: T[], array2: T[], pos: number, end: number): boolean; + function firstOrUndefined<T>(array: T[]): T; function lastOrUndefined<T>(array: T[]): T; - function binarySearch<T>(array: T[], value: T, comparer?: (v1: T, v2: T) => number): number; - function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T; - function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U; - function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T; - function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U; + function singleOrUndefined<T>(array: T[]): T; + function singleOrMany<T>(array: T[]): T | T[]; + function replaceElement<T>(array: T[], index: number, value: T): T[]; + function binarySearch<T>(array: T[], value: T, comparer?: (v1: T, v2: T) => number, offset?: number): number; + function reduceLeft<T, U>(array: T[], f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; + function reduceLeft<T>(array: T[], f: (memo: T, value: T, i: number) => T): T; + function reduceRight<T, U>(array: T[], f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; + function reduceRight<T>(array: T[], f: (memo: T, value: T, i: number) => T): T; function hasProperty<T>(map: MapLike<T>, key: string): boolean; function getProperty<T>(map: MapLike<T>, key: string): T | undefined; function getOwnKeys<T>(map: MapLike<T>): string[]; function forEachProperty<T, U>(map: Map<T>, callback: (value: T, key: string) => U): U; function someProperties<T>(map: Map<T>, predicate?: (value: T, key: string) => boolean): boolean; function copyProperties<T>(source: Map<T>, target: MapLike<T>): void; + function assign<T1 extends MapLike<{}>, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3; + function assign<T1 extends MapLike<{}>, T2>(t: T1, arg1: T2): T1 & T2; + function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]): any; function reduceProperties<T, U>(map: Map<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; function reduceOwnProperties<T, U>(map: MapLike<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; function equalOwnProperties<T>(left: MapLike<T>, right: MapLike<T>, equalityComparer?: (left: T, right: T) => boolean): boolean; function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>; function arrayToMap<T, U>(array: T[], makeKey: (value: T) => string, makeValue: (value: T) => U): Map<U>; + function isEmpty<T>(map: Map<T>): boolean; function cloneMap<T>(map: Map<T>): Map<T>; function clone<T>(object: T): T; function extend<T1, T2>(first: T1, second: T2): T1 & T2; + function multiMapAdd<V>(map: Map<V[]>, key: string | number, value: V): V[]; + function multiMapRemove<V>(map: Map<V[]>, key: string, value: V): void; function isArray(value: any): value is any[]; + function noop(): void; + function notImplemented(): never; function memoize<T>(callback: () => T): () => T; + function chain<T, U>(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; + function compose<T>(...args: ((t: T) => T)[]): (t: T) => T; let localizedDiagnosticMessages: Map<string>; function getLocaleSpecificMessage(message: DiagnosticMessage): string; - function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; - function formatMessage(dummy: any, message: DiagnosticMessage): string; - function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; + function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; + function formatMessage(_dummy: any, message: DiagnosticMessage): string; + function createCompilerDiagnostic(message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; + function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessageChain): Diagnostic; function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; function compareValues<T>(a: T, b: T): Comparison; @@ -2981,12 +3585,18 @@ declare namespace ts { function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; function normalizeSlashes(path: string): string; function getRootLength(path: string): number; - let directorySeparator: string; + const directorySeparator = "/"; function normalizePath(path: string): string; + function pathEndsWithDirectorySeparator(path: string): boolean; function getDirectoryPath(path: Path): Path; function getDirectoryPath(path: string): string; function isUrl(path: string): boolean; + function isExternalModuleNameRelative(moduleName: string): boolean; + function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; + function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind; + function hasZeroOrOneAsteriskCharacter(str: string): boolean; function isRootedDiskPath(path: string): boolean; + function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; function getNormalizedPathComponents(path: string, currentDirectory: string): string[]; function getNormalizedAbsolutePath(fileName: string, currentDirectory: string): string; function getNormalizedPathFromPathComponents(pathComponents: string[]): string; @@ -2999,9 +3609,11 @@ declare namespace ts { function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean; function startsWith(str: string, prefix: string): boolean; function endsWith(str: string, suffix: string): boolean; + function hasExtension(fileName: string): boolean; function fileExtensionIs(path: string, extension: string): boolean; function fileExtensionIsAny(path: string, extensions: string[]): boolean; function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude"): string; + function isImplicitGlob(lastPathComponent: string): boolean; interface FileSystemEntries { files: string[]; directories: string[]; @@ -3012,7 +3624,7 @@ declare namespace ts { excludePattern: string; basePaths: string[]; } - function getFileMatcherPatterns(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns; + function getFileMatcherPatterns(path: string, excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns; function matchFiles(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string, getFileSystemEntries: (path: string) => FileSystemEntries): string[]; function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind; function getScriptKindFromFileName(fileName: string): ScriptKind; @@ -3036,13 +3648,12 @@ declare namespace ts { function removeFileExtension(path: string): string; function tryRemoveExtension(path: string, extension: string): string | undefined; function removeExtension(path: string, extension: string): string; - function isJsxOrTsxExtension(ext: string): boolean; function changeExtension<T extends string | Path>(path: T, newExtension: string): T; interface ObjectAllocator { getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; - getTokenConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token; - getIdentifierConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token; - getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile; + getTokenConstructor(): new <TKind extends SyntaxKind>(kind: TKind, pos?: number, end?: number) => Token<TKind>; + getIdentifierConstructor(): new (kind: SyntaxKind.Identifier, pos?: number, end?: number) => Identifier; + getSourceFileConstructor(): new (kind: SyntaxKind.SourceFile, pos?: number, end?: number) => SourceFile; getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; getSignatureConstructor(): new (checker: TypeChecker) => Signature; @@ -3055,30 +3666,24 @@ declare namespace ts { VeryAggressive = 3, } namespace Debug { + let currentAssertionLevel: AssertionLevel; function shouldAssert(level: AssertionLevel): boolean; function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; function fail(message?: string): void; } - function copyListRemovingItem<T>(item: T, list: T[]): T[]; - function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; - function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; - function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean; - function hasZeroOrOneAsteriskCharacter(str: string): boolean; - function createResolvedModule(resolvedFileName: string, isExternalLibraryImport: boolean, failedLookupLocations: string[]): ResolvedModuleWithFailedLookupLocations; - function isExternalModuleNameRelative(moduleName: string): boolean; - interface ModuleResolutionState { - host: ModuleResolutionHost; - compilerOptions: CompilerOptions; - traceEnabled: boolean; - skipTsx: boolean; - } - function readJson(path: string, host: ModuleResolutionHost): { - typings?: string; - types?: string; - main?: string; - }; - function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind; - function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; + function orderedRemoveItemAt<T>(array: T[], index: number): void; + function unorderedRemoveItemAt<T>(array: T[], index: number): void; + function unorderedRemoveItem<T>(array: T[], item: T): void; + function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): (fileName: string) => string; + function matchPatternOrExact(patternStrings: string[], candidate: string): string | Pattern | undefined; + function patternText({prefix, suffix}: Pattern): string; + function matchedText(pattern: Pattern, candidate: string): string; + function findBestPatternMatch<T>(values: T[], getPattern: (value: T) => Pattern, candidate: string): T | undefined; + function tryParsePattern(pattern: string): Pattern | undefined; + function positionIsSynthesized(pos: number): boolean; + function extensionIsTypeScript(ext: Extension): boolean; + function extensionFromPath(path: string): Extension; + function tryGetExtensionFromPath(path: string): Extension | undefined; } declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; @@ -3096,7 +3701,7 @@ 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; + watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; @@ -3111,6 +3716,10 @@ declare namespace ts { getMemoryUsage?(): number; exit(exitCode?: number): void; realpath?(path: string): string; + getEnvironmentVariable(name: string): string; + tryEnableSourceMapsForHost?(): void; + setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout?(timeoutId: any): void; } interface FileWatcher { close(): void; @@ -3119,10 +3728,10 @@ declare namespace ts { directoryName: string; referenceCount: number; } - var sys: System; + let sys: System; } declare namespace ts { - var Diagnostics: { + const Diagnostics: { Unterminated_string_literal: { code: number; category: DiagnosticCategory; @@ -3369,7 +3978,7 @@ declare namespace ts { key: string; message: string; }; - Type_0_is_not_a_valid_async_function_return_type: { + Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: number; category: DiagnosticCategory; key: string; @@ -4029,12 +4638,6 @@ declare namespace ts { key: string; message: string; }; - Catch_clause_variable_name_must_be_an_identifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; Catch_clause_variable_cannot_have_a_type_annotation: { code: number; category: DiagnosticCategory; @@ -4353,19 +4956,19 @@ declare namespace ts { key: string; message: string; }; - with_statements_are_not_allowed_in_an_async_function_block: { + A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { code: number; category: DiagnosticCategory; key: string; message: string; }; - await_expression_is_only_allowed_within_an_async_function: { + with_statements_are_not_allowed_in_an_async_function_block: { code: number; category: DiagnosticCategory; key: string; message: string; }; - Async_functions_are_only_available_when_targeting_ECMAScript_2015_or_higher: { + await_expression_is_only_allowed_within_an_async_function: { code: number; category: DiagnosticCategory; key: string; @@ -4695,7 +5298,7 @@ declare namespace ts { key: string; message: string; }; - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { code: number; category: DiagnosticCategory; key: string; @@ -4725,12 +5328,6 @@ declare namespace ts { key: string; message: string; }; - No_best_common_type_exists_among_return_expressions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: number; category: DiagnosticCategory; @@ -4743,7 +5340,7 @@ declare namespace ts { key: string; message: string; }; - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: number; category: DiagnosticCategory; key: string; @@ -4785,7 +5382,7 @@ declare namespace ts { key: string; message: string; }; - Invalid_left_hand_side_of_assignment_expression: { + The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: number; category: DiagnosticCategory; key: string; @@ -5025,7 +5622,7 @@ declare namespace ts { key: string; message: string; }; - Invalid_left_hand_side_in_for_in_statement: { + The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: number; category: DiagnosticCategory; key: string; @@ -5049,7 +5646,7 @@ declare namespace ts { key: string; message: string; }; - All_symbols_within_a_with_block_will_be_resolved_to_any: { + The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: number; category: DiagnosticCategory; key: string; @@ -5253,18 +5850,6 @@ declare namespace ts { key: string; message: string; }; - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; Cannot_redeclare_block_scoped_variable_0: { code: number; category: DiagnosticCategory; @@ -5331,7 +5916,7 @@ declare namespace ts { key: string; message: string; }; - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: number; category: DiagnosticCategory; key: string; @@ -5463,19 +6048,7 @@ declare namespace ts { key: string; message: string; }; - The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_left_hand_side_in_for_of_statement: { + The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: number; category: DiagnosticCategory; key: string; @@ -5577,12 +6150,6 @@ declare namespace ts { key: string; message: string; }; - No_best_common_type_exists_among_yield_expressions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; A_generator_cannot_have_a_void_type_annotation: { code: number; category: DiagnosticCategory; @@ -5679,7 +6246,7 @@ declare namespace ts { key: string; message: string; }; - The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { + The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: number; category: DiagnosticCategory; key: string; @@ -5763,6 +6330,48 @@ declare namespace ts { key: string; message: string; }; + Type_0_is_not_constrained_to_keyof_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_has_no_matching_index_signature_for_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_cannot_be_used_as_an_index_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_assign_to_0_because_it_is_not_a_variable: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Index_signature_in_type_0_only_permits_reading: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; JSX_element_attributes_type_0_may_not_be_a_union_type: { code: number; category: DiagnosticCategory; @@ -5901,6 +6510,12 @@ declare namespace ts { key: string; message: string; }; + Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: number; category: DiagnosticCategory; @@ -6021,7 +6636,7 @@ declare namespace ts { key: string; message: string; }; - Identifier_0_must_be_imported_from_a_module: { + _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { code: number; category: DiagnosticCategory; key: string; @@ -6063,6 +6678,54 @@ declare namespace ts { key: string; message: string; }; + _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Namespace_0_has_no_exported_member_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Spread_types_may_only_be_created_from_object_types: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Rest_types_may_only_be_created_from_object_types: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_object_rest_element_must_be_an_identifier: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Import_declaration_0_is_using_private_name_1: { code: number; category: DiagnosticCategory; @@ -6657,6 +7320,12 @@ declare namespace ts { key: string; message: string; }; + Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Concatenate_and_emit_output_to_single_file: { code: number; category: DiagnosticCategory; @@ -6837,6 +7506,12 @@ declare namespace ts { key: string; message: string; }; + STRATEGY: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Compilation_complete_Watching_for_file_changes: { code: number; category: DiagnosticCategory; @@ -7149,7 +7824,7 @@ declare namespace ts { key: string; message: string; }; - package_json_does_not_have_types_field: { + package_json_does_not_have_a_types_or_main_field: { code: number; category: DiagnosticCategory; key: string; @@ -7371,7 +8046,7 @@ declare namespace ts { key: string; message: string; }; - No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { + No_types_specified_in_package_json_so_returning_main_value_of_0: { code: number; category: DiagnosticCategory; key: string; @@ -7383,12 +8058,54 @@ declare namespace ts { key: string; message: string; }; + Import_emit_helpers_from_tslib: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: number; category: DiagnosticCategory; key: string; message: string; }; + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_was_resolved_to_1_but_jsx_is_not_set: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_was_resolved_to_1_but_allowJs_is_not_set: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Variable_0_implicitly_has_an_1_type: { code: number; category: DiagnosticCategory; @@ -7437,7 +8154,13 @@ declare namespace ts { key: string; message: string; }; - Index_signature_of_object_type_implicitly_has_an_any_type: { + Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: number; category: DiagnosticCategory; key: string; @@ -7533,6 +8256,12 @@ declare namespace ts { key: string; message: string; }; + Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; You_cannot_rename_this_element: { code: number; category: DiagnosticCategory; @@ -7635,6 +8364,12 @@ declare namespace ts { key: string; message: string; }; + Language_service_is_disabled: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: number; category: DiagnosticCategory; @@ -7701,6 +8436,84 @@ declare namespace ts { key: string; message: string; }; + Circularity_detected_while_resolving_configuration_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_path_in_an_extends_options_must_be_relative_or_rooted: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_files_list_in_config_file_0_is_empty: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Add_missing_super_call: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Make_super_call_the_first_statement_in_the_constructor: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Change_extends_to_implements: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Remove_unused_identifiers: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Implement_interface_on_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Implement_interface_on_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Implement_inherited_abstract_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; }; } declare namespace ts { @@ -7724,6 +8537,7 @@ declare namespace ts { reScanSlashToken(): SyntaxKind; reScanTemplateToken(): SyntaxKind; scanJsxIdentifier(): SyntaxKind; + scanJsxAttributeValue(): SyntaxKind; reScanJsxToken(): SyntaxKind; scanJsxToken(): SyntaxKind; scanJSDocToken(): SyntaxKind; @@ -7756,12 +8570,16 @@ declare namespace ts { function isOctalDigit(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean, stopAtComments?: boolean): number; + function forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; - function isIdentifier(name: string, languageVersion: ScriptTarget): boolean; + function isIdentifierText(name: string, languageVersion: ScriptTarget): boolean; function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } declare namespace ts { @@ -7789,7 +8607,7 @@ declare namespace ts { function generateTSConfig(options: CompilerOptions, fileNames: string[]): { compilerOptions: Map<CompilerOptionsValue>; }; - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; @@ -7807,13 +8625,26 @@ declare namespace ts.JsTyping { readFile: (path: string, encoding?: string) => string; readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[]; } - function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map<string>, typingOptions: TypingOptions, compilerOptions: CompilerOptions): { + const nodeCoreModuleList: ReadonlyArray<string>; + function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map<string>, typingOptions: TypingOptions, unresolvedImports: ReadonlyArray<string>): { cachedTypingPaths: string[]; newTypingNames: string[]; filesToWatch: string[]; }; } declare namespace ts.server { + const ActionSet: ActionSet; + const ActionInvalidate: ActionInvalidate; + const EventInstall: EventInstall; + namespace Arguments { + const GlobalCacheLocation = "--globalTypingsCacheLocation"; + const LogFile = "--logFile"; + const EnableTelemetry = "--enableTelemetry"; + } + function hasArgument(argumentName: string): boolean; + function findArgument(argumentName: string): string; +} +declare namespace ts.server { enum LogLevel { terse = 0, normal = 1, @@ -7841,7 +8672,7 @@ declare namespace ts.server { const Perf: Perf; type Types = Err | Info | Perf; } - function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, cachePath?: string): DiscoverTypings; + function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings; namespace Errors { function ThrowNoProject(): never; function ThrowProjectLanguageServiceDisabled(): never; @@ -7863,12 +8694,6 @@ declare namespace ts.server { remove(path: NormalizedPath): void; } function createNormalizedPathMap<T>(): NormalizedPathMap<T>; - const nullLanguageService: LanguageService; - interface ServerLanguageServiceHost { - setCompilationSettings(options: CompilerOptions): void; - notifyFileRemoved(info: ScriptInfo): void; - } - const nullLanguageServiceHost: ServerLanguageServiceHost; interface ProjectOptions { configHasFilesProperty?: boolean; files?: string[]; @@ -7879,6 +8704,7 @@ declare namespace ts.server { } function isInferredProjectName(name: string): boolean; function makeInferredProjectName(counter: number): string; + function toSortedReadonlyArray(arr: string[]): SortedReadonlyArray<string>; class ThrottledOperations { private readonly host; private pendingTimeouts; @@ -7897,17 +8723,30 @@ declare namespace ts.server { } } declare namespace ts { + function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; + function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean; + function getEffectiveTypeRoots(options: CompilerOptions, host: { + directoryExists?: (directoryName: string) => boolean; + getCurrentDirectory?: () => string; + }): string[] | undefined; + function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; + function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function directoryProbablyExists(directoryName: string, host: { + directoryExists?: (directoryName: string) => boolean; + }): boolean; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function loadModuleFromGlobalCache(moduleName: string, projectName: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, globalCache: string): ResolvedModuleWithFailedLookupLocations; +} +declare namespace ts { + const externalHelpersModuleNameText = "tslib"; interface ReferencePathMatchResult { fileReference?: FileReference; diagnosticMessage?: DiagnosticMessage; isNoDefaultLib?: boolean; isTypeReferenceDirective?: boolean; } - interface SynthesizedNode extends Node { - leadingCommentRanges?: CommentRange[]; - trailingCommentRanges?: CommentRange[]; - startsOnNewLine: boolean; - } function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration; interface StringSymbolWriter extends SymbolWriter { string(): string; @@ -7924,12 +8763,11 @@ declare namespace ts { function getSingleLineStringWriter(): StringSymbolWriter; function releaseStringWriter(writer: StringSymbolWriter): void; function getFullWidth(node: Node): number; - function arrayIsEqualTo<T>(array1: ReadonlyArray<T>, array2: ReadonlyArray<T>, equaler?: (a: T, b: T) => boolean): boolean; function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean; - function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule; - function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModule): void; + function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModuleFull; + function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModuleFull): void; function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void; - function moduleResolutionIsEqualTo(oldResolution: ResolvedModule, newResolution: ResolvedModule): boolean; + function moduleResolutionIsEqualTo(oldResolution: ResolvedModuleFull, newResolution: ResolvedModuleFull): boolean; function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirective, newResolution: ResolvedTypeReferenceDirective): boolean; function hasChangesInResolutions<T>(names: string[], newResolutions: T[], oldResolutions: Map<T>, comparer: (oldResolution: T, newResolution: T) => boolean): boolean; function containsParseError(node: Node): boolean; @@ -7938,6 +8776,7 @@ declare namespace ts { function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; function nodePosToString(node: Node): string; function getStartPosOfNode(node: Node): number; + function isDefined(value: any): boolean; function getEndLinePosition(line: number, sourceFile: SourceFile): number; function nodeIsMissing(node: Node): boolean; function nodeIsPresent(node: Node): boolean; @@ -7948,29 +8787,34 @@ declare namespace ts { function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia?: boolean): string; function getTextOfNodeFromSourceText(sourceText: string, node: Node): string; function getTextOfNode(node: Node, includeTrivia?: boolean): string; + function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile, languageVersion: ScriptTarget): string; + function isBinaryOrOctalIntegerLiteral(node: LiteralLikeNode, text: string): boolean; function escapeIdentifier(identifier: string): string; function unescapeIdentifier(identifier: string): string; function makeIdentifierFromModuleName(moduleName: string): string; function isBlockOrCatchScoped(declaration: Declaration): boolean; + function isCatchClauseVariableDeclarationOrBindingElement(declaration: Declaration): boolean; function isAmbientModule(node: Node): boolean; function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean; function isBlockScopedContainerTopLevel(node: Node): boolean; function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean; function isExternalModuleAugmentation(node: Node): boolean; + function isBlockScope(node: Node, parentNode: Node): boolean; function getEnclosingBlockScopeContainer(node: Node): Node; - function isCatchClauseVariableDeclaration(declaration: Declaration): boolean; function declarationNameToString(name: DeclarationName): string; - function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic; + function getTextOfPropertyName(name: PropertyName): string; + function entityNameToString(name: EntityNameOrEntityNameExpression): string; + function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic; + function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic; function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic; function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan; function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan; function isExternalOrCommonJsModule(file: SourceFile): boolean; function isDeclarationFile(file: SourceFile): boolean; function isConstEnumDeclaration(node: Node): boolean; - function getCombinedNodeFlags(node: Node): NodeFlags; function isConst(node: Node): boolean; function isLet(node: Node): boolean; - function isSuperCallExpression(n: Node): boolean; + function isSuperCall(n: Node): n is SuperCall; function isPrologueDirective(node: Node): boolean; function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; function getLeadingCommentRangesOfNodeFromText(node: Node, text: string): CommentRange[]; @@ -7979,7 +8823,7 @@ declare namespace ts { let fullTripleSlashReferencePathRegEx: RegExp; let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp; let fullTripleSlashAMDReferencePathRegEx: RegExp; - function isTypeNode(node: Node): boolean; + function isPartOfTypeNode(node: Node): boolean; function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T; function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; function isVariableLike(node: Node): node is VariableLikeDeclaration; @@ -7988,9 +8832,10 @@ declare namespace ts { function isFunctionLike(node: Node): node is FunctionLikeDeclaration; function isFunctionLikeKind(kind: SyntaxKind): boolean; function introducesArgumentsExoticObject(node: Node): boolean; - function isIterationStatement(node: Node, lookInLabeledStatements: boolean): boolean; + function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement; function isFunctionBlock(node: Node): boolean; function isObjectLiteralMethod(node: Node): node is MethodDeclaration; + function isObjectLiteralOrClassExpressionMethod(node: Node): node is MethodDeclaration; function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate; function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate; function getContainingFunction(node: Node): FunctionLikeDeclaration; @@ -7998,15 +8843,16 @@ declare namespace ts { function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; function getSuperContainer(node: Node, stopOnFunctions: boolean): Node; function getImmediatelyInvokedFunctionExpression(func: Node): CallExpression; - function isSuperPropertyOrElementAccess(node: Node): boolean; + function isSuperProperty(node: Node): node is SuperProperty; function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression; + function isCallLikeExpression(node: Node): node is CallLikeExpression; function getInvokedExpression(node: CallLikeExpression): Expression; function nodeCanBeDecorated(node: Node): boolean; function nodeIsDecorated(node: Node): boolean; - function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression; - function isElementAccessExpression(node: Node): node is ElementAccessExpression; + function nodeOrChildIsDecorated(node: Node): boolean; + function childIsDecorated(node: Node): boolean; function isJSXTagName(node: Node): boolean; - function isExpression(node: Node): boolean; + function isPartOfExpression(node: Node): boolean; function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; function isExternalModuleImportEqualsDeclaration(node: Node): boolean; function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression; @@ -8018,8 +8864,11 @@ declare namespace ts { function isDeclarationOfFunctionExpression(s: Symbol): boolean; function getSpecialPropertyAssignmentKind(expression: Node): SpecialPropertyAssignmentKind; function getExternalModuleName(node: Node): Expression; + function getNamespaceDeclarationNode(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): ImportEqualsDeclaration | NamespaceImport; + function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean; function hasQuestionToken(node: Node): boolean; function isJSDocConstructSignature(node: Node): boolean; + function getJSDocComments(node: Node, checkParentVariableStatement: boolean): string[]; function getJSDocTypeTag(node: Node): JSDocTypeTag; function getJSDocReturnTag(node: Node): JSDocReturnTag; function getJSDocTemplateTag(node: Node): JSDocTemplateTag; @@ -8028,16 +8877,15 @@ declare namespace ts { function hasDeclaredRestParameter(s: SignatureDeclaration): boolean; function isRestParameter(node: ParameterDeclaration): boolean; function isDeclaredRestParam(node: ParameterDeclaration): boolean; - function isLiteralKind(kind: SyntaxKind): boolean; - function isTextualLiteralKind(kind: SyntaxKind): boolean; - function isTemplateLiteralKind(kind: SyntaxKind): boolean; - function isBindingPattern(node: Node): node is BindingPattern; + const enum AssignmentKind { + None = 0, + Definite = 1, + Compound = 2, + } + function getAssignmentTargetKind(node: Node): AssignmentKind; function isAssignmentTarget(node: Node): boolean; - function isNodeDescendentOf(node: Node, ancestor: Node): boolean; + function isNodeDescendantOf(node: Node, ancestor: Node): boolean; function isInAmbientContext(node: Node): boolean; - function isDeclaration(node: Node): boolean; - function isStatement(n: Node): boolean; - function isClassElement(n: Node): boolean; function isDeclarationName(name: Node): boolean; function isLiteralComputedPropertyDeclarationName(node: Node): boolean; function isIdentifierName(node: Identifier): boolean; @@ -8060,16 +8908,28 @@ declare namespace ts { function getPropertyNameForPropertyNameNode(name: DeclarationName): string; function getPropertyNameForKnownSymbolName(symbolName: string): string; function isESSymbolIdentifier(node: Node): boolean; + function isPushOrUnshiftIdentifier(node: Identifier): boolean; function isModifierKind(token: SyntaxKind): boolean; function isParameterDeclaration(node: VariableLikeDeclaration): boolean; function getRootDeclaration(node: Node): Node; - function nodeStartsNewLexicalEnvironment(n: Node): boolean; - function cloneNode<T extends Node>(node: T, location?: TextRange, flags?: NodeFlags, parent?: Node): T; - function cloneEntityName(node: EntityName, parent?: Node): EntityName; - function isQualifiedName(node: Node): node is QualifiedName; - function nodeIsSynthesized(node: Node): boolean; - function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; - function createSynthesizedNodeArray(): NodeArray<any>; + function nodeStartsNewLexicalEnvironment(node: Node): boolean; + function nodeIsSynthesized(node: TextRange): boolean; + function getOriginalNode(node: Node): Node; + function getOriginalNode<T extends Node>(node: Node, nodeTest: (node: Node) => node is T): T; + function isParseTreeNode(node: Node): boolean; + function getParseTreeNode(node: Node): Node; + function getParseTreeNode<T extends Node>(node: Node, nodeTest?: (node: Node) => node is T): T; + function getOriginalSourceFiles(sourceFiles: SourceFile[]): SourceFile[]; + function getOriginalNodeId(node: Node): number; + const enum Associativity { + Left = 0, + Right = 1, + } + function getExpressionAssociativity(expression: Expression): Associativity; + function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity; + function getExpressionPrecedence(expression: Expression): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; + function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.Count; + function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; function createDiagnosticCollection(): DiagnosticCollection; function escapeString(s: string): string; function isIntrinsicJsxName(name: string): boolean; @@ -8087,11 +8947,14 @@ declare namespace ts { getLine(): number; getColumn(): number; getIndent(): number; + isAtStartOfLine(): boolean; reset(): void; } function getIndentString(level: number): string; function getIndentSize(): number; function createTextWriter(newLine: String): EmitTextWriter; + function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string; + function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): string; function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string; function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string; function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost): string; @@ -8100,29 +8963,46 @@ declare namespace ts { sourceMapFilePath: string; declarationFilePath: string; } + function getSourceFilesToEmit(host: EmitHost, targetSourceFile?: SourceFile): SourceFile[]; + function filterSourceFilesInDirectory(sourceFiles: SourceFile[], isSourceFileFromExternalLibrary: (file: SourceFile) => boolean): SourceFile[]; + function forEachTransformedEmitFile(host: EmitHost, sourceFiles: SourceFile[], action: (jsFilePath: string, sourceMapFilePath: string, declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) => void, emitOnlyDtsFiles?: boolean): void; function forEachExpectedEmitFile(host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFiles: SourceFile[], isBundledEmit: boolean, emitOnlyDtsFiles: boolean) => void, targetSourceFile?: SourceFile, emitOnlyDtsFiles?: boolean): void; function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; function writeFile(host: EmitHost, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: SourceFile[]): void; function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; function getLineOfLocalPositionFromLineMap(lineMap: number[], pos: number): number; function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; - function getSetAccessorTypeAnnotationNode(accessor: AccessorDeclaration): TypeNode; - function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): { + function getSetAccessorTypeAnnotationNode(accessor: SetAccessorDeclaration): TypeNode; + function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined; + function parameterIsThisKeyword(parameter: ParameterDeclaration): boolean; + function isThisIdentifier(node: Node | undefined): boolean; + function identifierIsThisKeyword(id: Identifier): boolean; + interface AllAccessorDeclarations { firstAccessor: AccessorDeclaration; secondAccessor: AccessorDeclaration; getAccessor: AccessorDeclaration; setAccessor: AccessorDeclaration; - }; + } + function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): AllAccessorDeclarations; function emitNewLineBeforeLeadingComments(lineMap: number[], writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; - function emitComments(text: string, lineMap: number[], writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void; - function emitDetachedComments(text: string, lineMap: number[], writer: EmitTextWriter, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): { + function emitNewLineBeforeLeadingCommentsOfPosition(lineMap: number[], writer: EmitTextWriter, pos: number, leadingComments: CommentRange[]): void; + function emitNewLineBeforeLeadingCommentOfPosition(lineMap: number[], writer: EmitTextWriter, pos: number, commentPos: number): void; + function emitComments(text: string, lineMap: number[], writer: EmitTextWriter, comments: CommentRange[], leadingSeparator: boolean, trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void): void; + function emitDetachedComments(text: string, lineMap: number[], writer: EmitTextWriter, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): { nodePos: number; detachedCommentEndPos: number; }; - function writeCommentRange(text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string): void; - function modifierToFlag(token: SyntaxKind): NodeFlags; - function isLeftHandSideExpression(expr: Expression): boolean; + function writeCommentRange(text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string): void; + function hasModifiers(node: Node): boolean; + function hasModifier(node: Node, flags: ModifierFlags): boolean; + function getModifierFlags(node: Node): ModifierFlags; + function modifierToFlag(token: SyntaxKind): ModifierFlags; + function isLogicalOperator(token: SyntaxKind): boolean; function isAssignmentOperator(token: SyntaxKind): boolean; + function tryGetClassExtendingExpressionWithTypeArguments(node: Node): ClassLikeDeclaration | undefined; + function isAssignmentExpression(node: Node): node is AssignmentExpression; + function isDestructuringAssignment(node: Node): node is DestructuringAssignment; + function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean; function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean; function isEntityNameExpression(node: Expression): node is EntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; @@ -8131,8 +9011,120 @@ declare namespace ts { function tryExtractTypeScriptExtension(fileName: string): string | undefined; const stringify: (value: any) => string; function convertToBase64(input: string): string; - function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; function getNewLineCharacter(options: CompilerOptions): string; + function isSimpleExpression(node: Expression): boolean; + function formatSyntaxKind(kind: SyntaxKind): string; + function movePos(pos: number, value: number): number; + function createRange(pos: number, end: number): TextRange; + function moveRangeEnd(range: TextRange, end: number): TextRange; + function moveRangePos(range: TextRange, pos: number): TextRange; + function moveRangePastDecorators(node: Node): TextRange; + function moveRangePastModifiers(node: Node): TextRange; + function isCollapsedRange(range: TextRange): boolean; + function collapseRangeToStart(range: TextRange): TextRange; + function collapseRangeToEnd(range: TextRange): TextRange; + function createTokenRange(pos: number, token: SyntaxKind): TextRange; + function rangeIsOnSingleLine(range: TextRange, sourceFile: SourceFile): boolean; + function rangeStartPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; + function rangeEndPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; + function rangeStartIsOnSameLineAsRangeEnd(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; + function rangeEndIsOnSameLineAsRangeStart(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; + function positionsAreOnSameLine(pos1: number, pos2: number, sourceFile: SourceFile): boolean; + function getStartPositionOfRange(range: TextRange, sourceFile: SourceFile): number; + interface ExternalModuleInfo { + externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; + exportSpecifiers: Map<ExportSpecifier[]>; + exportedBindings: Map<Identifier[]>; + exportedNames: Identifier[]; + exportEquals: ExportAssignment | undefined; + hasExportStarsToExportValues: boolean; + } + function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver): ExternalModuleInfo; + function isDeclarationNameOfEnumOrNamespace(node: Identifier): boolean; + function getInitializedVariables(node: VariableDeclarationList): VariableDeclaration[]; + function isMergedWithClass(node: Node): boolean; + function isFirstDeclarationOfKind(node: Node, kind: SyntaxKind): boolean; + function isNodeArray<T extends Node>(array: T[]): array is NodeArray<T>; + function isNoSubstitutionTemplateLiteral(node: Node): node is LiteralExpression; + function isLiteralKind(kind: SyntaxKind): boolean; + function isTextualLiteralKind(kind: SyntaxKind): boolean; + function isLiteralExpression(node: Node): node is LiteralExpression; + function isTemplateLiteralKind(kind: SyntaxKind): boolean; + function isTemplateHead(node: Node): node is TemplateHead; + function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail; + function isIdentifier(node: Node): node is Identifier; + function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier; + function isModifier(node: Node): node is Modifier; + function isQualifiedName(node: Node): node is QualifiedName; + function isComputedPropertyName(node: Node): node is ComputedPropertyName; + function isEntityName(node: Node): node is EntityName; + function isPropertyName(node: Node): node is PropertyName; + function isModuleName(node: Node): node is ModuleName; + function isBindingName(node: Node): node is BindingName; + function isTypeParameter(node: Node): node is TypeParameterDeclaration; + function isParameter(node: Node): node is ParameterDeclaration; + function isDecorator(node: Node): node is Decorator; + function isMethodDeclaration(node: Node): node is MethodDeclaration; + function isClassElement(node: Node): node is ClassElement; + function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; + function isTypeNode(node: Node): node is TypeNode; + function isBindingPattern(node: Node): node is BindingPattern; + function isBindingElement(node: Node): node is BindingElement; + function isArrayBindingElement(node: Node): node is ArrayBindingElement; + function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression; + function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression; + function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression; + function isElementAccessExpression(node: Node): node is ElementAccessExpression; + function isBinaryExpression(node: Node): node is BinaryExpression; + function isConditionalExpression(node: Node): node is ConditionalExpression; + function isCallExpression(node: Node): node is CallExpression; + function isTemplateLiteral(node: Node): node is TemplateLiteral; + function isSpreadExpression(node: Node): node is SpreadElement; + function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; + function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression; + function isUnaryExpression(node: Node): node is UnaryExpression; + function isExpression(node: Node): node is Expression; + function isAssertionExpression(node: Node): node is AssertionExpression; + function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression; + function isNotEmittedStatement(node: Node): node is NotEmittedStatement; + function isNotEmittedOrPartiallyEmittedNode(node: Node): node is NotEmittedStatement | PartiallyEmittedExpression; + function isOmittedExpression(node: Node): node is OmittedExpression; + function isTemplateSpan(node: Node): node is TemplateSpan; + function isBlock(node: Node): node is Block; + function isConciseBody(node: Node): node is ConciseBody; + function isFunctionBody(node: Node): node is FunctionBody; + function isForInitializer(node: Node): node is ForInitializer; + function isVariableDeclaration(node: Node): node is VariableDeclaration; + function isVariableDeclarationList(node: Node): node is VariableDeclarationList; + function isCaseBlock(node: Node): node is CaseBlock; + function isModuleBody(node: Node): node is ModuleBody; + function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; + function isImportClause(node: Node): node is ImportClause; + function isNamedImportBindings(node: Node): node is NamedImportBindings; + function isImportSpecifier(node: Node): node is ImportSpecifier; + function isNamedExports(node: Node): node is NamedExports; + function isExportSpecifier(node: Node): node is ExportSpecifier; + function isModuleOrEnumDeclaration(node: Node): node is ModuleDeclaration | EnumDeclaration; + function isDeclaration(node: Node): node is Declaration; + function isDeclarationStatement(node: Node): node is DeclarationStatement; + function isStatementButNotDeclaration(node: Node): node is Statement; + function isStatement(node: Node): node is Statement; + function isModuleReference(node: Node): node is ModuleReference; + function isJsxOpeningElement(node: Node): node is JsxOpeningElement; + function isJsxClosingElement(node: Node): node is JsxClosingElement; + function isJsxTagNameExpression(node: Node): node is JsxTagNameExpression; + function isJsxChild(node: Node): node is JsxChild; + function isJsxAttributeLike(node: Node): node is JsxAttributeLike; + function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute; + function isJsxAttribute(node: Node): node is JsxAttribute; + function isStringLiteralOrJsxExpression(node: Node): node is StringLiteral | JsxExpression; + function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause; + function isHeritageClause(node: Node): node is HeritageClause; + function isCatchClause(node: Node): node is CatchClause; + function isPropertyAssignment(node: Node): node is PropertyAssignment; + function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment; + function isEnumMember(node: Node): node is EnumMember; + function isSourceFile(node: Node): node is SourceFile; function isWatchSet(options: CompilerOptions): boolean; } declare namespace ts { @@ -8157,35 +9149,312 @@ declare namespace ts { function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function getCombinedModifierFlags(node: Node): ModifierFlags; + function getCombinedNodeFlags(node: Node): NodeFlags; } declare namespace ts { - function loadNodeModuleFromDirectory(extensions: string[], candidate: string, failedLookupLocation: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): string; - function loadModuleFromNodeModules(moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState, checkOneLevel: boolean): string; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function findBestPatternMatch<T>(values: T[], getPattern: (value: T) => Pattern, candidate: string): T | undefined; - function tryParsePattern(pattern: string): Pattern | undefined; - function directoryProbablyExists(directoryName: string, host: { - directoryExists?: (directoryName: string) => boolean; - }): boolean; - function pathToPackageJson(directory: string): string; + function updateNode<T extends Node>(updated: T, original: T): T; + function createNodeArray<T extends Node>(elements?: T[], location?: TextRange, hasTrailingComma?: boolean): NodeArray<T>; + function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; + function createSynthesizedNodeArray<T extends Node>(elements?: T[]): NodeArray<T>; + function getSynthesizedClone<T extends Node>(node: T): T; + function getMutableClone<T extends Node>(node: T): T; + function createLiteral(textSource: StringLiteral | Identifier, location?: TextRange): StringLiteral; + function createLiteral(value: string, location?: TextRange): StringLiteral; + function createLiteral(value: number, location?: TextRange): NumericLiteral; + function createLiteral(value: boolean, location?: TextRange): BooleanLiteral; + function createLiteral(value: string | number | boolean, location?: TextRange): PrimaryExpression; + function createIdentifier(text: string, location?: TextRange): Identifier; + function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, location?: TextRange): Identifier; + function createLoopVariable(location?: TextRange): Identifier; + function createUniqueName(text: string, location?: TextRange): Identifier; + function getGeneratedNameForNode(node: Node, location?: TextRange): Identifier; + function createToken<TKind extends SyntaxKind>(token: TKind): Token<TKind>; + function createSuper(): PrimaryExpression; + function createThis(location?: TextRange): PrimaryExpression; + function createNull(): PrimaryExpression; + function createComputedPropertyName(expression: Expression, location?: TextRange): ComputedPropertyName; + function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; + function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): ParameterDeclaration; + function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration; + function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression, location?: TextRange): PropertyDeclaration; + function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression): PropertyDeclaration; + function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): MethodDeclaration; + function updateMethod(node: MethodDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): MethodDeclaration; + function createConstructor(decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block, location?: TextRange, flags?: NodeFlags): ConstructorDeclaration; + function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block): ConstructorDeclaration; + function createGetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): GetAccessorDeclaration; + function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block): GetAccessorDeclaration; + function createSetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], body: Block, location?: TextRange, flags?: NodeFlags): SetAccessorDeclaration; + function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], body: Block): SetAccessorDeclaration; + function createObjectBindingPattern(elements: BindingElement[], location?: TextRange): ObjectBindingPattern; + function updateObjectBindingPattern(node: ObjectBindingPattern, elements: BindingElement[]): ObjectBindingPattern; + function createArrayBindingPattern(elements: ArrayBindingElement[], location?: TextRange): ArrayBindingPattern; + function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; + function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression, location?: TextRange): BindingElement; + function updateBindingElement(node: BindingElement, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement; + function createArrayLiteral(elements?: Expression[], location?: TextRange, multiLine?: boolean): ArrayLiteralExpression; + function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; + function createObjectLiteral(properties?: ObjectLiteralElementLike[], location?: TextRange, multiLine?: boolean): ObjectLiteralExpression; + function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]): ObjectLiteralExpression; + function createPropertyAccess(expression: Expression, name: string | Identifier, location?: TextRange, flags?: NodeFlags): PropertyAccessExpression; + function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; + function createElementAccess(expression: Expression, index: number | Expression, location?: TextRange): ElementAccessExpression; + function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; + function createCall(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags): CallExpression; + function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]): CallExpression; + function createNew(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags): NewExpression; + function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]): NewExpression; + function createTaggedTemplate(tag: Expression, template: TemplateLiteral, location?: TextRange): TaggedTemplateExpression; + function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function createParen(expression: Expression, location?: TextRange): ParenthesizedExpression; + function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; + function createFunctionExpression(modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): FunctionExpression; + function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): FunctionExpression; + function createArrowFunction(modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody, location?: TextRange, flags?: NodeFlags): ArrowFunction; + function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: ConciseBody): ArrowFunction; + function createDelete(expression: Expression, location?: TextRange): DeleteExpression; + function updateDelete(node: DeleteExpression, expression: Expression): Expression; + function createTypeOf(expression: Expression, location?: TextRange): TypeOfExpression; + function updateTypeOf(node: TypeOfExpression, expression: Expression): Expression; + function createVoid(expression: Expression, location?: TextRange): VoidExpression; + function updateVoid(node: VoidExpression, expression: Expression): VoidExpression; + function createAwait(expression: Expression, location?: TextRange): AwaitExpression; + function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression; + function createPrefix(operator: PrefixUnaryOperator, operand: Expression, location?: TextRange): PrefixUnaryExpression; + function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; + function createPostfix(operand: Expression, operator: PostfixUnaryOperator, location?: TextRange): PostfixUnaryExpression; + function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; + function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression, location?: TextRange): BinaryExpression; + function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; + function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression, location?: TextRange): ConditionalExpression; + function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[], location?: TextRange): TemplateExpression; + function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function createYield(asteriskToken: AsteriskToken, expression: Expression, location?: TextRange): YieldExpression; + function updateYield(node: YieldExpression, expression: Expression): YieldExpression; + function createSpread(expression: Expression, location?: TextRange): SpreadElement; + function updateSpread(node: SpreadElement, expression: Expression): SpreadElement; + function createClassExpression(modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[], location?: TextRange): ClassExpression; + function updateClassExpression(node: ClassExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function createOmittedExpression(location?: TextRange): OmittedExpression; + function createExpressionWithTypeArguments(typeArguments: TypeNode[], expression: Expression, location?: TextRange): ExpressionWithTypeArguments; + function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail, location?: TextRange): TemplateSpan; + function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function createBlock(statements: Statement[], location?: TextRange, multiLine?: boolean, flags?: NodeFlags): Block; + function updateBlock(node: Block, statements: Statement[]): Block; + function createVariableStatement(modifiers: Modifier[], declarationList: VariableDeclarationList | VariableDeclaration[], location?: TextRange, flags?: NodeFlags): VariableStatement; + function updateVariableStatement(node: VariableStatement, modifiers: Modifier[], declarationList: VariableDeclarationList): VariableStatement; + function createVariableDeclarationList(declarations: VariableDeclaration[], location?: TextRange, flags?: NodeFlags): VariableDeclarationList; + function updateVariableDeclarationList(node: VariableDeclarationList, declarations: VariableDeclaration[]): VariableDeclarationList; + function createVariableDeclaration(name: string | BindingPattern | Identifier, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): VariableDeclaration; + function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode, initializer: Expression): VariableDeclaration; + function createEmptyStatement(location: TextRange): EmptyStatement; + function createStatement(expression: Expression, location?: TextRange, flags?: NodeFlags): ExpressionStatement; + function updateStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; + function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement, location?: TextRange): IfStatement; + function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement): IfStatement; + function createDo(statement: Statement, expression: Expression, location?: TextRange): DoStatement; + function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement; + function createWhile(expression: Expression, statement: Statement, location?: TextRange): WhileStatement; + function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; + function createFor(initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement, location?: TextRange): ForStatement; + function updateFor(node: ForStatement, initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement): ForStatement; + function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange): ForInStatement; + function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function createForOf(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange): ForOfStatement; + function updateForOf(node: ForOfStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function createContinue(label?: Identifier, location?: TextRange): ContinueStatement; + function updateContinue(node: ContinueStatement, label: Identifier): ContinueStatement; + function createBreak(label?: Identifier, location?: TextRange): BreakStatement; + function updateBreak(node: BreakStatement, label: Identifier): BreakStatement; + function createReturn(expression?: Expression, location?: TextRange): ReturnStatement; + function updateReturn(node: ReturnStatement, expression: Expression): ReturnStatement; + function createWith(expression: Expression, statement: Statement, location?: TextRange): WithStatement; + function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement; + function createSwitch(expression: Expression, caseBlock: CaseBlock, location?: TextRange): SwitchStatement; + function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function createLabel(label: string | Identifier, statement: Statement, location?: TextRange): LabeledStatement; + function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; + function createThrow(expression: Expression, location?: TextRange): ThrowStatement; + function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement; + function createTry(tryBlock: Block, catchClause: CatchClause, finallyBlock: Block, location?: TextRange): TryStatement; + function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause, finallyBlock: Block): TryStatement; + function createCaseBlock(clauses: CaseOrDefaultClause[], location?: TextRange): CaseBlock; + function updateCaseBlock(node: CaseBlock, clauses: CaseOrDefaultClause[]): CaseBlock; + function createFunctionDeclaration(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): FunctionDeclaration; + function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): FunctionDeclaration; + function createClassDeclaration(decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[], location?: TextRange): ClassDeclaration; + function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function createImportDeclaration(decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier?: Expression, location?: TextRange): ImportDeclaration; + function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier: Expression): ImportDeclaration; + function createImportClause(name: Identifier, namedBindings: NamedImportBindings, location?: TextRange): ImportClause; + function updateImportClause(node: ImportClause, name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function createNamespaceImport(name: Identifier, location?: TextRange): NamespaceImport; + function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; + function createNamedImports(elements: ImportSpecifier[], location?: TextRange): NamedImports; + function updateNamedImports(node: NamedImports, elements: ImportSpecifier[]): NamedImports; + function createImportSpecifier(propertyName: Identifier, name: Identifier, location?: TextRange): ImportSpecifier; + function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier, name: Identifier): ImportSpecifier; + function createExportAssignment(decorators: Decorator[], modifiers: Modifier[], isExportEquals: boolean, expression: Expression, location?: TextRange): ExportAssignment; + function updateExportAssignment(node: ExportAssignment, decorators: Decorator[], modifiers: Modifier[], expression: Expression): ExportAssignment; + function createExportDeclaration(decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier?: Expression, location?: TextRange): ExportDeclaration; + function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier: Expression): ExportDeclaration; + function createNamedExports(elements: ExportSpecifier[], location?: TextRange): NamedExports; + function updateNamedExports(node: NamedExports, elements: ExportSpecifier[]): NamedExports; + function createExportSpecifier(name: string | Identifier, propertyName?: string | Identifier, location?: TextRange): ExportSpecifier; + function updateExportSpecifier(node: ExportSpecifier, name: Identifier, propertyName: Identifier): ExportSpecifier; + function createJsxElement(openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement, location?: TextRange): JsxElement; + function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributeLike[], location?: TextRange): JsxSelfClosingElement; + function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributeLike[]): JsxSelfClosingElement; + function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributeLike[], location?: TextRange): JsxOpeningElement; + function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributeLike[]): JsxOpeningElement; + function createJsxClosingElement(tagName: JsxTagNameExpression, location?: TextRange): JsxClosingElement; + function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression, location?: TextRange): JsxAttribute; + function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function createJsxSpreadAttribute(expression: Expression, location?: TextRange): JsxSpreadAttribute; + function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; + function createJsxExpression(expression: Expression, location?: TextRange): JsxExpression; + function updateJsxExpression(node: JsxExpression, expression: Expression): JsxExpression; + function createHeritageClause(token: SyntaxKind, types: ExpressionWithTypeArguments[], location?: TextRange): HeritageClause; + function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; + function createCaseClause(expression: Expression, statements: Statement[], location?: TextRange): CaseClause; + function updateCaseClause(node: CaseClause, expression: Expression, statements: Statement[]): CaseClause; + function createDefaultClause(statements: Statement[], location?: TextRange): DefaultClause; + function updateDefaultClause(node: DefaultClause, statements: Statement[]): DefaultClause; + function createCatchClause(variableDeclaration: string | VariableDeclaration, block: Block, location?: TextRange): CatchClause; + function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration, block: Block): CatchClause; + function createPropertyAssignment(name: string | PropertyName, initializer: Expression, location?: TextRange): PropertyAssignment; + function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; + function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer: Expression, location?: TextRange): ShorthandPropertyAssignment; + function createSpreadAssignment(expression: Expression, location?: TextRange): SpreadAssignment; + function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression): ShorthandPropertyAssignment; + function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; + function updateSourceFileNode(node: SourceFile, statements: Statement[]): SourceFile; + function createNotEmittedStatement(original: Node): NotEmittedStatement; + function createEndOfDeclarationMarker(original: Node): EndOfDeclarationMarker; + function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; + function createPartiallyEmittedExpression(expression: Expression, original?: Node, location?: TextRange): PartiallyEmittedExpression; + function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; + function createComma(left: Expression, right: Expression): Expression; + function createLessThan(left: Expression, right: Expression, location?: TextRange): Expression; + function createAssignment(left: Expression, right: Expression, location?: TextRange): BinaryExpression; + function createStrictEquality(left: Expression, right: Expression): BinaryExpression; + function createStrictInequality(left: Expression, right: Expression): BinaryExpression; + function createAdd(left: Expression, right: Expression): BinaryExpression; + function createSubtract(left: Expression, right: Expression): BinaryExpression; + function createPostfixIncrement(operand: Expression, location?: TextRange): PostfixUnaryExpression; + function createLogicalAnd(left: Expression, right: Expression): BinaryExpression; + function createLogicalOr(left: Expression, right: Expression): BinaryExpression; + function createLogicalNot(operand: Expression): PrefixUnaryExpression; + function createVoidZero(): VoidExpression; + function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression; + function createFunctionCall(func: Expression, thisArg: Expression, argumentsList: Expression[], location?: TextRange): CallExpression; + function createFunctionApply(func: Expression, thisArg: Expression, argumentsExpression: Expression, location?: TextRange): CallExpression; + function createArraySlice(array: Expression, start?: number | Expression): CallExpression; + function createArrayConcat(array: Expression, values: Expression[]): CallExpression; + function createMathPow(left: Expression, right: Expression, location?: TextRange): CallExpression; + function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: Expression[], parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression; + function createExportDefault(expression: Expression): ExportAssignment; + function createExternalModuleExport(exportName: Identifier): ExportDeclaration; + function createLetStatement(name: Identifier, initializer: Expression, location?: TextRange): VariableStatement; + function createLetDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; + function createConstDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; + function createHelperName(externalHelpersModuleName: Identifier | undefined, name: string): Identifier | PropertyAccessExpression; + function createExtendsHelper(externalHelpersModuleName: Identifier | undefined, name: Identifier): CallExpression; + function createAssignHelper(externalHelpersModuleName: Identifier | undefined, attributesSegments: Expression[]): CallExpression; + function createParamHelper(externalHelpersModuleName: Identifier | undefined, expression: Expression, parameterOffset: number, location?: TextRange): CallExpression; + function createMetadataHelper(externalHelpersModuleName: Identifier | undefined, metadataKey: string, metadataValue: Expression): CallExpression; + function createDecorateHelper(externalHelpersModuleName: Identifier | undefined, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange): CallExpression; + function createAwaiterHelper(externalHelpersModuleName: Identifier | undefined, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block): CallExpression; + function createHasOwnProperty(target: LeftHandSideExpression, propertyName: Expression): CallExpression; + function createAdvancedAsyncSuperHelper(): VariableStatement; + function createSimpleAsyncSuperHelper(): VariableStatement; + interface CallBinding { + target: LeftHandSideExpression; + thisArg: Expression; + } + function createCallBinding(expression: Expression, recordTempVariable: (temp: Identifier) => void, languageVersion?: ScriptTarget, cacheIdentifiers?: boolean): CallBinding; + function inlineExpressions(expressions: Expression[]): Expression; + function createExpressionFromEntityName(node: EntityName | Expression): Expression; + function createExpressionForPropertyName(memberName: PropertyName): Expression; + function createExpressionForObjectLiteralElementLike(node: ObjectLiteralExpression, property: ObjectLiteralElementLike, receiver: Expression): Expression; + function getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; + function isLocalName(node: Identifier): boolean; + function getExportName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; + function isExportName(node: Identifier): boolean; + function getDeclarationName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; + function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression; + function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression; + function addPrologueDirectives(target: Statement[], source: Statement[], ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult<Node>): number; + function ensureUseStrict(node: SourceFile): SourceFile; + function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression): Expression; + function parenthesizeForNew(expression: Expression): LeftHandSideExpression; + function parenthesizeForAccess(expression: Expression): LeftHandSideExpression; + function parenthesizePostfixOperand(operand: Expression): LeftHandSideExpression; + function parenthesizePrefixOperand(operand: Expression): UnaryExpression; + function parenthesizeExpressionForList(expression: Expression): Expression; + function parenthesizeExpressionForExpressionStatement(expression: Expression): Expression; + function parenthesizeConciseBody(body: ConciseBody): ConciseBody; + const enum OuterExpressionKinds { + Parentheses = 1, + Assertions = 2, + PartiallyEmittedExpressions = 4, + All = 7, + } + function skipOuterExpressions(node: Expression, kinds?: OuterExpressionKinds): Expression; + function skipOuterExpressions(node: Node, kinds?: OuterExpressionKinds): Node; + function skipParentheses(node: Expression): Expression; + function skipParentheses(node: Node): Node; + function skipAssertions(node: Expression): Expression; + function skipAssertions(node: Node): Node; + function skipPartiallyEmittedExpressions(node: Expression): Expression; + function skipPartiallyEmittedExpressions(node: Node): Node; + function startOnNewLine<T extends Node>(node: T): T; + function setOriginalNode<T extends Node>(node: T, original: Node): T; + function disposeEmitNodes(sourceFile: SourceFile): void; + function getEmitFlags(node: Node): EmitFlags; + function setEmitFlags<T extends Node>(node: T, emitFlags: EmitFlags): T; + function setSourceMapRange<T extends Node>(node: T, range: TextRange): T; + function setTokenSourceMapRange<T extends Node>(node: T, token: SyntaxKind, range: TextRange): T; + function setCommentRange<T extends Node>(node: T, range: TextRange): T; + function getCommentRange(node: Node): TextRange; + function getSourceMapRange(node: Node): TextRange; + function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange; + function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; + function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; + function setTextRange<T extends TextRange>(node: T, location: TextRange): T; + function setNodeFlags<T extends Node>(node: T, flags: NodeFlags): T; + function setMultiLine<T extends ObjectLiteralExpression | ArrayLiteralExpression | Block>(node: T, multiLine: boolean): T; + function setHasTrailingComma<T extends Node>(nodes: NodeArray<T>, hasTrailingComma: boolean): NodeArray<T>; + function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier; + function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions): StringLiteral; + function tryGetModuleNameFromFile(file: SourceFile, host: EmitHost, options: CompilerOptions): StringLiteral; + function transformFunctionBody(node: FunctionLikeDeclaration, visitor: (node: Node) => VisitResult<Node>, currentSourceFile: SourceFile, context: TransformationContext, enableSubstitutionsForCapturedThis: () => void, convertObjectRest?: boolean): Block; + function addCaptureThisForNodeIfNeeded(statements: Statement[], node: Node, enableSubstitutionsForCapturedThis: () => void): void; + function captureThisForNode(statements: Statement[], node: Node, initializer: Expression | undefined, enableSubstitutionsForCapturedThis?: () => void, originalStatement?: Statement): void; + function addDefaultValueAssignmentsIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, visitor: (node: Node) => VisitResult<Node>, convertObjectRest: boolean): void; + function addRestParameterIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, inConstructorWithSynthesizedSuper: boolean): void; + function convertForOf(node: ForOfStatement, convertedLoopBodyStatements: Statement[], visitor: (node: Node) => VisitResult<Node>, enableSubstitutionsForBlockScopedBindings: () => void, context: TransformationContext, convertObjectRest?: boolean): ForStatement | ForOfStatement; } 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; function parseIsolatedJSDocComment(content: string, start?: number, length?: number): { - jsDocComment: JSDocComment; + jsDoc: JSDoc; diagnostics: Diagnostic[]; }; function parseJSDocTypeExpressionForTests(content: string, start?: number, length?: number): { jsDocTypeExpression: JSDocTypeExpression; diagnostics: Diagnostic[]; }; - function fixupParentReferences(rootNode: Node): void; } declare namespace ts { const enum ModuleInstanceState { @@ -8195,6 +9464,8 @@ declare namespace ts { } function getModuleInstanceState(node: Node): ModuleInstanceState; function bindSourceFile(file: SourceFile, options: CompilerOptions): void; + function computeTransformFlagsForNode(node: Node, subtreeFlags: TransformFlags): TransformFlags; + function getTransformFlagsSubtreeExclusions(kind: SyntaxKind): TransformFlags; } declare namespace ts { function getNodeId(node: Node): number; @@ -8202,40 +9473,121 @@ declare namespace ts { function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; } declare namespace ts { + type VisitResult<T extends Node> = T | T[]; + function reduceEachChild<T>(node: Node, f: (memo: T, node: Node) => T, initial: T): T; + function visitNode<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, optional?: boolean, lift?: (node: NodeArray<Node>) => T): T; + function visitNode<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, optional: boolean, lift: (node: NodeArray<Node>) => T, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): T; + function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>; + function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, start: number, count: number, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): NodeArray<T>; + function visitEachChild<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, context: LexicalEnvironment): T; + function mergeFunctionBodyLexicalEnvironment(body: FunctionBody, declarations: Statement[]): FunctionBody; + function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody; + function liftToBlock(nodes: Node[]): Statement; + function aggregateTransformFlags<T extends Node>(node: T): T; + namespace Debug { + const failNotOptional: typeof noop; + const failBadSyntaxKind: (node: Node, message?: string) => void; + const assertNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; + } +} +declare namespace ts { + function flattenDestructuringAssignment(context: TransformationContext, node: BinaryExpression, needsValue: boolean, recordTempVariable: (node: Identifier) => void, visitor?: (node: Node) => VisitResult<Node>, transformRest?: boolean): Expression; + function flattenParameterDestructuring(node: ParameterDeclaration, value: Expression, visitor?: (node: Node) => VisitResult<Node>, transformRest?: boolean): VariableDeclaration[]; + function flattenVariableDestructuring(node: VariableDeclaration, value?: Expression, visitor?: (node: Node) => VisitResult<Node>, recordTempVariable?: (node: Identifier) => void, transformRest?: boolean): VariableDeclaration[]; + function flattenVariableDestructuringToExpression(node: VariableDeclaration, recordTempVariable: (name: Identifier) => void, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression, visitor?: (node: Node) => VisitResult<Node>): Expression; +} +declare namespace ts { + function transformTypeScript(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformES2017(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformES2016(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformES2015(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformGenerators(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformES5(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformModule(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformSystemModule(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + function transformES2015Module(context: TransformationContext): (node: SourceFile) => SourceFile; +} +declare namespace ts { + interface TransformationResult { + transformed: SourceFile[]; + emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; + emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; + } + interface TransformationContext extends LexicalEnvironment { + getCompilerOptions(): CompilerOptions; + getEmitResolver(): EmitResolver; + getEmitHost(): EmitHost; + hoistFunctionDeclaration(node: FunctionDeclaration): void; + hoistVariableDeclaration(node: Identifier): void; + enableSubstitution(kind: SyntaxKind): void; + isSubstitutionEnabled(node: Node): boolean; + onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node; + enableEmitNotification(kind: SyntaxKind): void; + isEmitNotificationEnabled(node: Node): boolean; + onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; + } + type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile; + function getTransformers(compilerOptions: CompilerOptions): Transformer[]; + function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult; +} +declare namespace ts { + function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[]; + function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection, emitOnlyDtsFiles: boolean): boolean; +} +declare namespace ts { interface SourceMapWriter { - getSourceMapData(): SourceMapData; + initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void; + reset(): void; setSourceFile(sourceFile: SourceFile): void; emitPos(pos: number): void; - emitStart(range: TextRange): void; - emitEnd(range: TextRange, stopOverridingSpan?: boolean): void; - changeEmitSourcePos(): void; + emitNodeWithSourceMap(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; + emitTokenWithSourceMap(node: Node, token: SyntaxKind, tokenStartPos: number, emitCallback: (token: SyntaxKind, tokenStartPos: number) => number): number; getText(): string; getSourceMappingURL(): string; - initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void; - reset(): void; + getSourceMapData(): SourceMapData; } - function getNullSourceMapWriter(): SourceMapWriter; function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter; } declare namespace ts { - function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[]; - function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection, emitOnlyDtsFiles: boolean): boolean; + interface CommentWriter { + reset(): void; + setSourceFile(sourceFile: SourceFile): void; + emitNodeWithComments(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; + emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void): void; + emitTrailingCommentsOfPosition(pos: number): void; + } + function createCommentWriter(host: EmitHost, writer: EmitTextWriter, sourceMap: SourceMapWriter): CommentWriter; } declare namespace ts { - function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string; - function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): string; function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitResult; } declare namespace ts { - const version: string; + const version = "2.2.0-dev.20161115"; function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string; - function getEffectiveTypeRoots(options: CompilerOptions, host: { - directoryExists?(directoryName: string): boolean; - getCurrentDirectory?(): string; - }): string[] | undefined; - function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; interface FormatDiagnosticsHost { @@ -8245,61 +9597,568 @@ declare namespace ts { } function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; - function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; -} -declare namespace ts.BreakpointResolver { - function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan; -} -declare namespace ts.OutliningElementsCollector { - function collectElements(sourceFile: SourceFile): OutliningSpan[]; -} -declare namespace ts.NavigateTo { - function getNavigateToItems(program: Program, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDts: boolean): NavigateToItem[]; -} -declare namespace ts.NavigationBar { - function getNavigationBarItems(sourceFile: SourceFile): NavigationBarItem[]; - function getNavigationTree(sourceFile: SourceFile): NavigationTree; + function getResolutionDiagnostic(options: CompilerOptions, {extension}: ResolvedModuleFull): DiagnosticMessage | undefined; } declare namespace ts { - enum PatternMatchKind { - exact = 0, - prefix = 1, - substring = 2, - camelCase = 3, + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; } - interface PatternMatch { - kind: PatternMatchKind; - camelCaseWeight?: number; + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + getBaseTypes(): ObjectType[]; + getNonNullableType(): Type; + } + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): Type[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface SourceFile { + version: string; + scriptSnapshot: IScriptSnapshot; + nameTable: Map<number>; + getNamedDeclarations(): Map<Declaration[]>; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionOfLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } + interface IScriptSnapshot { + getText(start: number, end: number): string; + getLength(): number; + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; + dispose?(): void; + } + namespace ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; + } + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; + importedFiles: FileReference[]; + ambientExternalModules: string[]; + isLibFile: boolean; + } + interface HostCancellationToken { + isCancellationRequested(): boolean; + } + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getProjectVersion?(): string; + getScriptFileNames(): string[]; + getScriptKind?(fileName: string): ScriptKind; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): HostCancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + useCaseSensitiveFileNames?(): boolean; + readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + readFile?(path: string, encoding?: string): string; + fileExists?(path: string): boolean; + getTypeRootsVersion?(): number; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + directoryExists?(directoryName: string): boolean; + getDirectories?(directoryName: string): string[]; + } + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + findReferences(fileName: string, position: number): ReferencedSymbol[]; + getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getNavigationTree(fileName: string): NavigationTree; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; + isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[]; + getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; + getProgram(): Program; + getNonBoundSourceFile(fileName: string): SourceFile; + getSourceFile(fileName: string): SourceFile; + dispose(): void; + } + interface Classifications { + spans: number[]; + endOfLineState: EndOfLineState; + } + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + interface NavigationTree { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems?: NavigationTree[]; + } + interface TodoCommentDescriptor { + text: string; + priority: number; + } + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; + } + class TextChange { + span: TextSpan; + newText: string; + } + interface FileTextChanges { + fileName: string; + textChanges: TextChange[]; + } + interface CodeAction { + description: string; + changes: FileTextChanges[]; + } + interface TextInsertion { + newText: string; + caretOffset: number; + } + interface RenameLocation { + textSpan: TextSpan; + fileName: string; + } + interface ReferenceEntry { + textSpan: TextSpan; + fileName: string; + isWriteAccess: boolean; + isDefinition: boolean; + } + interface ImplementationLocation { + textSpan: TextSpan; + fileName: string; + } + interface DocumentHighlights { + fileName: string; + highlightSpans: HighlightSpan[]; + } + namespace HighlightSpanKind { + const none = "none"; + const definition = "definition"; + const reference = "reference"; + const writtenReference = "writtenReference"; + } + interface HighlightSpan { + fileName?: string; + textSpan: TextSpan; + kind: string; + } + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; isCaseSensitive: boolean; - punctuationStripped: boolean; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; } - interface PatternMatcher { - getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; - getMatches(candidateContainers: string[], candidate: string): PatternMatch[]; - patternContainsDots: boolean; + enum IndentStyle { + None = 0, + Block = 1, + Smart = 2, } - function createPatternMatcher(pattern: string): PatternMatcher; - function breakIntoCharacterSpans(identifier: string): TextSpan[]; - function breakIntoWordSpans(identifier: string): TextSpan[]; -} -declare namespace ts.SignatureHelp { - const enum ArgumentListKind { - TypeArguments = 0, - CallArguments = 1, - TaggedTemplateArguments = 2, + interface EditorOptions { + BaseIndentSize?: number; + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + IndentStyle: IndentStyle; } - interface ArgumentListInfo { - kind: ArgumentListKind; - invocation: CallLikeExpression; - argumentsSpan: TextSpan; - argumentIndex?: number; + interface EditorSettings { + baseIndentSize?: number; + indentSize?: number; + tabSize?: number; + newLineCharacter?: string; + convertTabsToSpaces?: boolean; + indentStyle?: IndentStyle; + } + interface FormatCodeOptions extends EditorOptions { + 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; + } + 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; + } + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; + } + interface ReferencedSymbolDefinitionInfo extends DefinitionInfo { + displayParts: SymbolDisplayPart[]; + } + interface ReferencedSymbol { + definition: ReferencedSymbolDefinitionInfo; + references: ReferenceEntry[]; + } + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; argumentCount: number; } - function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationToken): SignatureHelpItems; - function getContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo; + interface CompletionInfo { + isGlobalCompletion: boolean; + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + sortText: string; + replacementSpan?: TextSpan; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface OutliningSpan { + textSpan: TextSpan; + hintSpan: TextSpan; + bannerText: string; + autoCollapse: boolean; + } + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } + const enum EndOfLineState { + None = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, + } + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, + } + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; + } + interface ClassificationInfo { + length: number; + classification: TokenClass; + } + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; + getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; + } + namespace ScriptElementKind { + const unknown = ""; + const warning = "warning"; + const keyword = "keyword"; + const scriptElement = "script"; + const moduleElement = "module"; + const classElement = "class"; + const localClassElement = "local class"; + const interfaceElement = "interface"; + const typeElement = "type"; + const enumElement = "enum"; + const enumMemberElement = "const"; + const variableElement = "var"; + const localVariableElement = "local var"; + const functionElement = "function"; + const localFunctionElement = "local function"; + const memberFunctionElement = "method"; + const memberGetAccessorElement = "getter"; + const memberSetAccessorElement = "setter"; + const memberVariableElement = "property"; + const constructorImplementationElement = "constructor"; + const callSignatureElement = "call"; + const indexSignatureElement = "index"; + const constructSignatureElement = "construct"; + const parameterElement = "parameter"; + const typeParameterElement = "type parameter"; + const primitiveType = "primitive type"; + const label = "label"; + const alias = "alias"; + const constElement = "const"; + const letElement = "let"; + const directory = "directory"; + const externalModuleName = "external module name"; + } + namespace ScriptElementKindModifier { + const none = ""; + const publicMemberModifier = "public"; + const privateMemberModifier = "private"; + const protectedMemberModifier = "protected"; + const exportedModifier = "export"; + const ambientModifier = "declare"; + const staticModifier = "static"; + const abstractModifier = "abstract"; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAliasName: string; + static parameterName: string; + static docCommentTagName: string; + static jsxOpenTagName: string; + static jsxCloseTagName: string; + static jsxSelfClosingTagName: string; + static jsxAttribute: string; + static jsxText: string; + static jsxAttributeStringLiteralValue: string; + } + const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, + docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, + } } declare namespace ts { + const scanner: Scanner; + const emptyArray: any[]; + const enum SemanticMeaning { + None = 0, + Value = 1, + Type = 2, + Namespace = 4, + All = 7, + } + function getMeaningFromDeclaration(node: Node): SemanticMeaning; + function getMeaningFromLocation(node: Node): SemanticMeaning; + function isCallExpressionTarget(node: Node): boolean; + function isNewExpressionTarget(node: Node): boolean; + function climbPastPropertyAccess(node: Node): Node; + function getTargetLabel(referenceNode: Node, labelName: string): Identifier; + function isJumpStatementTarget(node: Node): boolean; + function isLabelName(node: Node): boolean; + function isRightSideOfQualifiedName(node: Node): boolean; + function isRightSideOfPropertyAccess(node: Node): boolean; + function isNameOfModuleDeclaration(node: Node): boolean; + function isNameOfFunctionDeclaration(node: Node): boolean; + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean; + function isExpressionOfExternalModuleImportEqualsDeclaration(node: Node): boolean; + function isInsideComment(sourceFile: SourceFile, token: Node, position: number): boolean; + function getContainerNode(node: Node): Declaration; + function getNodeKind(node: Node): string; + function getStringLiteralTypeForNode(node: StringLiteral | LiteralTypeNode, typeChecker: TypeChecker): LiteralType; + function isThis(node: Node): boolean; interface ListItemInfo { listItemIndex: number; list: Node; @@ -8348,7 +10207,7 @@ declare namespace ts { declare namespace ts { function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; - function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart; + function displayPart(text: string, kind: SymbolDisplayPartKind): SymbolDisplayPart; function spacePart(): SymbolDisplayPart; function keywordPart(kind: SyntaxKind): SymbolDisplayPart; function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; @@ -8371,6 +10230,138 @@ declare namespace ts { diagnostics: Diagnostic[]; }; } +declare namespace ts.BreakpointResolver { + function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan; +} +declare namespace ts { + function createClassifier(): Classifier; + function getSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map<string>, span: TextSpan): ClassifiedSpan[]; + function getEncodedSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map<string>, span: TextSpan): Classifications; + function getSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): ClassifiedSpan[]; + function getEncodedSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): Classifications; +} +declare namespace ts.Completions { + function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo; + function getCompletionEntryDetails(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): CompletionEntryDetails; + function getCompletionEntrySymbol(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): Symbol; +} +declare namespace ts.DocumentHighlights { + function getDocumentHighlights(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: SourceFile[]): DocumentHighlights[]; +} +declare namespace ts { + interface DocumentRegistry { + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; + reportStats(): string; + } + type DocumentRegistryBucketKey = string & { + __bucketKey: any; + }; + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; +} +declare namespace ts.FindAllReferences { + function findReferencedSymbols(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], sourceFile: SourceFile, position: number, findInStrings: boolean, findInComments: boolean): ReferencedSymbol[]; + function getReferencedSymbolsForNode(typeChecker: TypeChecker, cancellationToken: CancellationToken, node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean, implementations: boolean): ReferencedSymbol[]; + function convertReferences(referenceSymbols: ReferencedSymbol[]): ReferenceEntry[]; + function getReferenceEntriesForShorthandPropertyAssignment(node: Node, typeChecker: TypeChecker, result: ReferenceEntry[]): void; + function getReferenceEntryFromNode(node: Node): ReferenceEntry; +} +declare namespace ts.GoToDefinition { + function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[]; + function getTypeDefinitionAtPosition(typeChecker: TypeChecker, sourceFile: SourceFile, position: number): DefinitionInfo[]; +} +declare namespace ts.GoToImplementation { + function getImplementationAtPosition(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], node: Node): ImplementationLocation[]; +} +declare namespace ts.JsDoc { + function getJsDocCommentsFromDeclarations(declarations: Declaration[]): SymbolDisplayPart[]; + function getAllJsDocCompletionEntries(): CompletionEntry[]; + function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion; +} +declare namespace ts.NavigateTo { + function getNavigateToItems(sourceFiles: SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[]; +} +declare namespace ts.NavigationBar { + function getNavigationBarItems(sourceFile: SourceFile): NavigationBarItem[]; + function getNavigationTree(sourceFile: SourceFile): NavigationTree; +} +declare namespace ts.OutliningElementsCollector { + function collectElements(sourceFile: SourceFile): OutliningSpan[]; +} +declare namespace ts { + enum PatternMatchKind { + exact = 0, + prefix = 1, + substring = 2, + camelCase = 3, + } + interface PatternMatch { + kind: PatternMatchKind; + camelCaseWeight?: number; + isCaseSensitive: boolean; + punctuationStripped: boolean; + } + interface PatternMatcher { + getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; + getMatches(candidateContainers: string[], candidate: string): PatternMatch[]; + patternContainsDots: boolean; + } + function createPatternMatcher(pattern: string): PatternMatcher; + function breakIntoCharacterSpans(identifier: string): TextSpan[]; + function breakIntoWordSpans(identifier: string): TextSpan[]; +} +declare namespace ts { + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; +} +declare namespace ts.Rename { + function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: (fileName: string) => string, sourceFile: SourceFile, position: number): RenameInfo; +} +declare namespace ts.SignatureHelp { + const enum ArgumentListKind { + TypeArguments = 0, + CallArguments = 1, + TaggedTemplateArguments = 2, + } + interface ArgumentListInfo { + kind: ArgumentListKind; + invocation: CallLikeExpression; + argumentsSpan: TextSpan; + argumentIndex?: number; + argumentCount: number; + } + function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationToken): SignatureHelpItems; + function getContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo; +} +declare namespace ts.SymbolDisplay { + function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): string; + function getSymbolModifiers(symbol: Symbol): string; + function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: TypeChecker, symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, location: Node, semanticMeaning?: SemanticMeaning): { + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + symbolKind: string; + }; +} +declare namespace ts { + interface TranspileOptions { + compilerOptions?: CompilerOptions; + fileName?: string; + reportDiagnostics?: boolean; + moduleName?: string; + renamedDependencies?: MapLike<string>; + } + interface TranspileOutput { + outputText: string; + diagnostics?: Diagnostic[]; + sourceMapText?: string; + } + function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; +} declare namespace ts.formatting { interface FormattingScanner { advance(): void; @@ -8496,6 +10487,8 @@ declare namespace ts.formatting { NoSpaceAfterCloseBracket: Rule; SpaceAfterOpenBrace: Rule; SpaceBeforeCloseBrace: Rule; + NoSpaceAfterOpenBrace: Rule; + NoSpaceBeforeCloseBrace: Rule; NoSpaceBetweenEmptyBraceBrackets: Rule; NewLineAfterOpenBraceInBlockContext: Rule; NewLineBeforeCloseBraceInBlockContext: Rule; @@ -8537,7 +10530,6 @@ declare namespace ts.formatting { NoSpaceAfterOpenAngularBracket: Rule; NoSpaceBeforeCloseAngularBracket: Rule; NoSpaceAfterCloseAngularBracket: Rule; - NoSpaceAfterTypeAssertion: Rule; NoSpaceBetweenEmptyInterfaceBraceBrackets: Rule; HighPriorityCommonRules: Rule[]; LowPriorityCommonRules: Rule[]; @@ -8595,6 +10587,8 @@ declare namespace ts.formatting { NoSpaceBeforeGreaterThanTokenInJsxOpeningElement: Rule; NoSpaceBeforeEqualInJsxAttribute: Rule; NoSpaceAfterEqualInJsxAttribute: Rule; + NoSpaceAfterTypeAssertion: Rule; + SpaceAfterTypeAssertion: Rule; constructor(); static IsForContext(context: FormattingContext): boolean; static IsNotForContext(context: FormattingContext): boolean; @@ -8700,7 +10694,7 @@ declare namespace ts.formatting { } class TokenAllAccess implements ITokenAccess { GetTokens(): SyntaxKind[]; - Contains(tokenValue: SyntaxKind): boolean; + Contains(): boolean; toString(): string; } class TokenRange { @@ -8775,572 +10769,40 @@ declare namespace ts.formatting { } } declare namespace ts { - const servicesVersion: string; - interface Node { - getSourceFile(): SourceFile; - getChildCount(sourceFile?: SourceFile): number; - getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; - getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; - getFullStart(): number; - getEnd(): number; - getWidth(sourceFile?: SourceFile): number; - getFullWidth(): number; - getLeadingTriviaWidth(sourceFile?: SourceFile): number; - getFullText(sourceFile?: SourceFile): string; - getText(sourceFile?: SourceFile): string; - getFirstToken(sourceFile?: SourceFile): Node; - getLastToken(sourceFile?: SourceFile): Node; - } - interface Symbol { - getFlags(): SymbolFlags; - getName(): string; - getDeclarations(): Declaration[]; - getDocumentationComment(): SymbolDisplayPart[]; - } - interface Type { - getFlags(): TypeFlags; - getSymbol(): Symbol; - getProperties(): Symbol[]; - getProperty(propertyName: string): Symbol; - getApparentProperties(): Symbol[]; - getCallSignatures(): Signature[]; - getConstructSignatures(): Signature[]; - getStringIndexType(): Type; - getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; - getNonNullableType(): Type; - } - interface Signature { - getDeclaration(): SignatureDeclaration; - getTypeParameters(): Type[]; - getParameters(): Symbol[]; - getReturnType(): Type; - getDocumentationComment(): SymbolDisplayPart[]; - } - interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map<number>; - getNamedDeclarations(): Map<Declaration[]>; - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - getLineStarts(): number[]; - getPositionOfLineAndCharacter(line: number, character: number): number; - update(newText: string, textChangeRange: TextChangeRange): SourceFile; - } - interface IScriptSnapshot { - getText(start: number, end: number): string; - getLength(): number; - getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; - dispose?(): void; - } - namespace ScriptSnapshot { - function fromString(text: string): IScriptSnapshot; - } - interface PreProcessedFileInfo { - referencedFiles: FileReference[]; - typeReferenceDirectives: FileReference[]; - importedFiles: FileReference[]; - ambientExternalModules: string[]; - isLibFile: boolean; - } - function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { - message: string; - start: number; - length: number; - category: string; - code: number; - }[]; - function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { - message: string; - start: number; - length: number; - category: string; - code: number; - }; - interface HostCancellationToken { - isCancellationRequested(): boolean; - } - interface LanguageServiceHost { - getCompilationSettings(): CompilerOptions; - getNewLine?(): string; - getProjectVersion?(): string; - getScriptFileNames(): string[]; - getScriptKind?(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; - getLocalizedDiagnosticMessages?(): any; - getCancellationToken?(): HostCancellationToken; - getCurrentDirectory(): string; - getDefaultLibFileName(options: CompilerOptions): string; - log?(s: string): void; - trace?(s: string): void; - error?(s: string): void; - useCaseSensitiveFileNames?(): boolean; - readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; - readFile?(path: string, encoding?: string): string; - fileExists?(path: string): boolean; - getTypeRootsVersion?(): number; - resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; - resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - directoryExists?(directoryName: string): boolean; - getDirectories?(directoryName: string): string[]; + interface CodeFix { + errorCodes: number[]; + getCodeActions(context: CodeFixContext): CodeAction[] | undefined; } - interface LanguageService { - cleanupSemanticCache(): void; - getSyntacticDiagnostics(fileName: string): Diagnostic[]; - getSemanticDiagnostics(fileName: string): Diagnostic[]; - getCompilerOptionsDiagnostics(): Diagnostic[]; - getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; - getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; - getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; - getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; - getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; - getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; - getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; - getRenameInfo(fileName: string, position: number): RenameInfo; - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; - getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; - getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; - getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - findReferences(fileName: string, position: number): ReferencedSymbol[]; - getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]; - getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string, maxResultCount?: number, excludeDts?: boolean): NavigateToItem[]; - getNavigationBarItems(fileName: string): NavigationBarItem[]; - getNavigationTree(fileName: string): NavigationTree; - getOutliningSpans(fileName: string): OutliningSpan[]; - getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; - getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; - getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number; - getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; - getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; - getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; - getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; - getProgram(): Program; - getNonBoundSourceFile(fileName: string): SourceFile; - dispose(): void; - } - interface Classifications { - spans: number[]; - endOfLineState: EndOfLineState; - } - interface ClassifiedSpan { - textSpan: TextSpan; - classificationType: string; - } - interface NavigationBarItem { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems: NavigationBarItem[]; - indent: number; - bolded: boolean; - grayed: boolean; - } - interface NavigationTree { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems?: NavigationTree[]; - } - interface TodoCommentDescriptor { - text: string; - priority: number; - } - interface TodoComment { - descriptor: TodoCommentDescriptor; - message: string; - position: number; - } - class TextChange { + interface CodeFixContext { + errorCode: number; + sourceFile: SourceFile; span: TextSpan; - newText: string; - } - interface TextInsertion { - newText: string; - caretOffset: number; - } - interface RenameLocation { - textSpan: TextSpan; - fileName: string; - } - interface ReferenceEntry { - textSpan: TextSpan; - fileName: string; - isWriteAccess: boolean; - isDefinition: boolean; - } - interface DocumentHighlights { - fileName: string; - highlightSpans: HighlightSpan[]; - } - namespace HighlightSpanKind { - const none: string; - const definition: string; - const reference: string; - const writtenReference: string; - } - interface HighlightSpan { - fileName?: string; - textSpan: TextSpan; - kind: string; - } - interface NavigateToItem { - name: string; - kind: string; - kindModifiers: string; - matchKind: string; - isCaseSensitive: boolean; - fileName: string; - textSpan: TextSpan; - containerName: string; - containerKind: string; - } - interface EditorOptions { - BaseIndentSize?: number; - IndentSize: number; - TabSize: number; - NewLineCharacter: string; - ConvertTabsToSpaces: boolean; - IndentStyle: IndentStyle; - } - interface EditorSettings { - baseIndentSize?: number; - indentSize?: number; - tabSize?: number; - newLineCharacter?: string; - convertTabsToSpaces?: boolean; - indentStyle?: IndentStyle; - } - enum IndentStyle { - None = 0, - Block = 1, - Smart = 2, - } - interface FormatCodeOptions extends EditorOptions { - InsertSpaceAfterCommaDelimiter: boolean; - InsertSpaceAfterSemicolonInForStatements: boolean; - InsertSpaceBeforeAndAfterBinaryOperators: boolean; - InsertSpaceAfterKeywordsInControlFlowStatements: boolean; - InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; - InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; - InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; - InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; - InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - PlaceOpenBraceOnNewLineForFunctions: boolean; - PlaceOpenBraceOnNewLineForControlBlocks: boolean; - } - 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; - } - function toEditorSettings(options: FormatCodeOptions | FormatCodeSettings): FormatCodeSettings; - function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; - interface DefinitionInfo { - fileName: string; - textSpan: TextSpan; - kind: string; - name: string; - containerKind: string; - containerName: string; - } - interface ReferencedSymbolDefinitionInfo extends DefinitionInfo { - displayParts: SymbolDisplayPart[]; - } - interface ReferencedSymbol { - definition: ReferencedSymbolDefinitionInfo; - references: ReferenceEntry[]; - } - enum SymbolDisplayPartKind { - aliasName = 0, - className = 1, - enumName = 2, - fieldName = 3, - interfaceName = 4, - keyword = 5, - lineBreak = 6, - numericLiteral = 7, - stringLiteral = 8, - localName = 9, - methodName = 10, - moduleName = 11, - operator = 12, - parameterName = 13, - propertyName = 14, - punctuation = 15, - space = 16, - text = 17, - typeParameterName = 18, - enumMemberName = 19, - functionName = 20, - regularExpressionLiteral = 21, - } - interface SymbolDisplayPart { - text: string; - kind: string; - } - interface QuickInfo { - kind: string; - kindModifiers: string; - textSpan: TextSpan; - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - } - interface RenameInfo { - canRename: boolean; - localizedErrorMessage: string; - displayName: string; - fullDisplayName: string; - kind: string; - kindModifiers: string; - triggerSpan: TextSpan; - } - interface SignatureHelpParameter { - name: string; - documentation: SymbolDisplayPart[]; - displayParts: SymbolDisplayPart[]; - isOptional: boolean; - } - interface SignatureHelpItem { - isVariadic: boolean; - prefixDisplayParts: SymbolDisplayPart[]; - suffixDisplayParts: SymbolDisplayPart[]; - separatorDisplayParts: SymbolDisplayPart[]; - parameters: SignatureHelpParameter[]; - documentation: SymbolDisplayPart[]; - } - interface SignatureHelpItems { - items: SignatureHelpItem[]; - applicableSpan: TextSpan; - selectedItemIndex: number; - argumentIndex: number; - argumentCount: number; - } - interface CompletionInfo { - isMemberCompletion: boolean; - isNewIdentifierLocation: boolean; - entries: CompletionEntry[]; - } - interface CompletionEntry { - name: string; - kind: string; - kindModifiers: string; - sortText: string; - replacementSpan?: TextSpan; - } - interface CompletionEntryDetails { - name: string; - kind: string; - kindModifiers: string; - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - } - interface OutliningSpan { - textSpan: TextSpan; - hintSpan: TextSpan; - bannerText: string; - autoCollapse: boolean; - } - interface EmitOutput { - outputFiles: OutputFile[]; - emitSkipped: boolean; - } - const enum OutputFileType { - JavaScript = 0, - SourceMap = 1, - Declaration = 2, - } - interface OutputFile { - name: string; - writeByteOrderMark: boolean; - text: string; - } - const enum EndOfLineState { - None = 0, - InMultiLineCommentTrivia = 1, - InSingleQuoteStringLiteral = 2, - InDoubleQuoteStringLiteral = 3, - InTemplateHeadOrNoSubstitutionTemplate = 4, - InTemplateMiddleOrTail = 5, - InTemplateSubstitutionPosition = 6, - } - enum TokenClass { - Punctuation = 0, - Keyword = 1, - Operator = 2, - Comment = 3, - Whitespace = 4, - Identifier = 5, - NumberLiteral = 6, - StringLiteral = 7, - RegExpLiteral = 8, - } - interface ClassificationResult { - finalLexState: EndOfLineState; - entries: ClassificationInfo[]; - } - interface ClassificationInfo { - length: number; - classification: TokenClass; - } - interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; - getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; - } - interface DocumentRegistry { - acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; - releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; - releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; - reportStats(): string; - } - type DocumentRegistryBucketKey = string & { - __bucketKey: any; - }; - namespace ScriptElementKind { - const unknown: string; - const warning: string; - const keyword: string; - const scriptElement: string; - const moduleElement: string; - const classElement: string; - const localClassElement: string; - const interfaceElement: string; - const typeElement: string; - const enumElement: string; - const enumMemberElement: string; - const variableElement: string; - const localVariableElement: string; - const functionElement: string; - const localFunctionElement: string; - const memberFunctionElement: string; - const memberGetAccessorElement: string; - const memberSetAccessorElement: string; - const memberVariableElement: string; - const constructorImplementationElement: string; - const callSignatureElement: string; - const indexSignatureElement: string; - const constructSignatureElement: string; - const parameterElement: string; - const typeParameterElement: string; - const primitiveType: string; - const label: string; - const alias: string; - const constElement: string; - const letElement: string; - const directory: string; - const externalModuleName: string; + program: Program; + newLineCharacter: string; } - namespace ScriptElementKindModifier { - const none: string; - const publicMemberModifier: string; - const privateMemberModifier: string; - const protectedMemberModifier: string; - const exportedModifier: string; - const ambientModifier: string; - const staticModifier: string; - const abstractModifier: string; - } - class ClassificationTypeNames { - static comment: string; - static identifier: string; - static keyword: string; - static numericLiteral: string; - static operator: string; - static stringLiteral: string; - static whiteSpace: string; - static text: string; - static punctuation: string; - static className: string; - static enumName: string; - static interfaceName: string; - static moduleName: string; - static typeParameterName: string; - static typeAliasName: string; - static parameterName: string; - static docCommentTagName: string; - static jsxOpenTagName: string; - static jsxCloseTagName: string; - static jsxSelfClosingTagName: string; - static jsxAttribute: string; - static jsxText: string; - static jsxAttributeStringLiteralValue: string; - } - const enum ClassificationType { - comment = 1, - identifier = 2, - keyword = 3, - numericLiteral = 4, - operator = 5, - stringLiteral = 6, - regularExpressionLiteral = 7, - whiteSpace = 8, - text = 9, - punctuation = 10, - className = 11, - enumName = 12, - interfaceName = 13, - moduleName = 14, - typeParameterName = 15, - typeAliasName = 16, - parameterName = 17, - docCommentTagName = 18, - jsxOpenTagName = 19, - jsxCloseTagName = 20, - jsxSelfClosingTagName = 21, - jsxAttribute = 22, - jsxText = 23, - jsxAttributeStringLiteralValue = 24, + namespace codefix { + function registerCodeFix(action: CodeFix): void; + function getSupportedErrorCodes(): string[]; + function getFixes(context: CodeFixContext): CodeAction[]; } +} +declare namespace ts.codefix { +} +declare namespace ts { + const servicesVersion = "0.5"; interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; } + function toEditorSettings(options: FormatCodeOptions | FormatCodeSettings): FormatCodeSettings; + function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; function displayPartsToString(displayParts: SymbolDisplayPart[]): string; function getDefaultCompilerOptions(): CompilerOptions; - interface TranspileOptions { - compilerOptions?: CompilerOptions; - fileName?: string; - reportDiagnostics?: boolean; - moduleName?: string; - renamedDependencies?: MapLike<string>; - } - interface TranspileOutput { - outputText: string; - diagnostics?: Diagnostic[]; - sourceMapText?: string; - } - function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; - function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; + function getSupportedCodeFixes(): string[]; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; - function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; - function getContainerNode(node: Node): Declaration; - function getNodeKind(node: Node): string; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function getNameTable(sourceFile: SourceFile): Map<number>; - function createClassifier(): Classifier; function getDefaultLibFilePath(options: CompilerOptions): string; } declare namespace ts.server { @@ -9379,7 +10841,7 @@ declare namespace ts.server { } } declare namespace ts.server { - class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost, ServerLanguageServiceHost { + class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { private readonly host; private readonly project; private readonly cancellationToken; @@ -9387,16 +10849,20 @@ declare namespace ts.server { private readonly resolvedModuleNames; private readonly resolvedTypeReferenceDirectives; private readonly getCanonicalFileName; + private filesWithChangedSetOfUnresolvedImports; private readonly resolveModuleName; readonly trace: (s: string) => void; + readonly realpath?: (path: string) => string; constructor(host: ServerHost, project: Project, cancellationToken: HostCancellationToken); - private resolveNamesWithLocalCache<T, R>(names, containingFile, cache, loader, getResult); + startRecordingFilesWithChangedResolutions(): void; + finishRecordingFilesWithChangedResolutions(): Path[]; + private resolveNamesWithLocalCache<T, R>(names, containingFile, cache, loader, getResult, getResultFileName, logChanges); getProjectVersion(): string; getCompilationSettings(): CompilerOptions; useCaseSensitiveFileNames(): boolean; getCancellationToken(): HostCancellationToken; resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModuleFull[]; getDefaultLibFileName(): string; getScriptSnapshot(filename: string): ts.IScriptSnapshot; getScriptFileNames(): string[]; @@ -9406,8 +10872,9 @@ declare namespace ts.server { getCurrentDirectory(): string; resolvePath(path: string): string; fileExists(path: string): boolean; - directoryExists(path: string): boolean; readFile(fileName: string): string; + directoryExists(path: string): boolean; + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; getDirectories(path: string): string[]; notifyFileRemoved(info: ScriptInfo): void; setCompilationSettings(opt: ts.CompilerOptions): void; @@ -9415,22 +10882,19 @@ declare namespace ts.server { } declare namespace ts.server { interface ITypingsInstaller { - enqueueInstallTypingsRequest(p: Project, typingOptions: TypingOptions): void; + enqueueInstallTypingsRequest(p: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray<string>): void; attach(projectService: ProjectService): void; onProjectClosed(p: Project): void; readonly globalTypingsCacheLocation: string; } const nullTypingsInstaller: ITypingsInstaller; - interface TypingsArray extends ReadonlyArray<string> { - " __typingsArrayBrand": any; - } class TypingsCache { private readonly installer; private readonly perProjectCache; constructor(installer: ITypingsInstaller); - getTypingsForProject(project: Project, forceRefresh: boolean): TypingsArray; - invalidateCachedTypingsForProject(project: Project): void; - updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typingOptions: TypingOptions, newTypings: string[]): void; + getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray<string>, forceRefresh: boolean): SortedReadonlyArray<string>; + updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray<string>, newTypings: string[]): void; + deleteTypingsForProject(projectName: string): void; onProjectClosed(project: Project): void; } } @@ -9466,18 +10930,31 @@ declare namespace ts.server { interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles { projectErrors: Diagnostic[]; } + class UnresolvedImportsMap { + readonly perFileMap: FileMap<ReadonlyArray<string>>; + private version; + clear(): void; + getVersion(): number; + remove(path: Path): void; + get(path: Path): ReadonlyArray<string>; + set(path: Path, value: ReadonlyArray<string>): void; + } + function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService; abstract class Project { readonly projectKind: ProjectKind; readonly projectService: ProjectService; private documentRegistry; - languageServiceEnabled: boolean; private compilerOptions; compileOnSaveEnabled: boolean; private rootFiles; private rootFilesMap; private lsHost; private program; - private languageService; + private cachedUnresolvedImportsPerFile; + private lastCachedUnresolvedImportsList; + private readonly languageService; + private readonly noSemanticFeaturesLanguageService; + languageServiceEnabled: boolean; builder: Builder; private lastReportedFileNames; private lastReportedVersion; @@ -9486,7 +10963,9 @@ declare namespace ts.server { private typingFiles; protected projectErrors: Diagnostic[]; typesVersion: number; + isNonTsProject(): boolean; isJsOnlyProject(): boolean; + getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; constructor(projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); getProjectErrors(): Diagnostic[]; getLanguageService(ensureSynchronized?: boolean): LanguageService; @@ -9507,7 +10986,7 @@ declare namespace ts.server { getRootScriptInfos(): ScriptInfo[]; getScriptInfos(): ScriptInfo[]; getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean): EmitOutput; - getFileNames(): NormalizedPath[]; + getFileNames(excludeFilesFromExternalLibraries?: boolean): NormalizedPath[]; getAllEmittableFiles(): string[]; containsScriptInfo(info: ScriptInfo): boolean; containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean; @@ -9515,6 +10994,7 @@ declare namespace ts.server { addRoot(info: ScriptInfo): void; removeFile(info: ScriptInfo, detachFromProject?: boolean): void; markAsDirty(): void; + private extractUnresolvedImportsFromSourceFile(file, result); updateGraph(): boolean; private setTypings(typings); private updateGraphWorker(); @@ -9529,11 +11009,10 @@ declare namespace ts.server { private removeRootFileIfNecessary(info); } class InferredProject extends Project { - compileOnSaveEnabled: boolean; private static NextId; private readonly inferredProjectName; directoriesWatchedForTsconfig: string[]; - constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); + constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); getProjectName(): string; getProjectRootPath(): string; close(): void; @@ -9580,20 +11059,32 @@ declare namespace ts.server { } declare namespace ts.server { const maxProgramSizeForNonTsFiles: number; - type ProjectServiceEvent = { - eventName: "context"; + const ContextEvent = "context"; + const ConfigFileDiagEvent = "configFileDiag"; + const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; + interface ContextEvent { + eventName: typeof ContextEvent; data: { project: Project; fileName: NormalizedPath; }; - } | { - eventName: "configFileDiag"; + } + interface ConfigFileDiagEvent { + eventName: typeof ConfigFileDiagEvent; data: { - triggerFile?: string; + triggerFile: string; configFileName: string; diagnostics: Diagnostic[]; }; - }; + } + interface ProjectLanguageServiceStateEvent { + eventName: typeof ProjectLanguageServiceStateEvent; + data: { + project: Project; + languageServiceEnabled: boolean; + }; + } + type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent; interface ProjectServiceEventHandler { (event: ProjectServiceEvent): void; } @@ -9632,10 +11123,12 @@ declare namespace ts.server { private readonly hostConfiguration; private changedFiles; private toCanonicalFileName; + lastDeletedFile: ScriptInfo; constructor(host: ServerHost, logger: Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller?: ITypingsInstaller, eventHandler?: ProjectServiceEventHandler); getChangedFiles_TestOnly(): ScriptInfo[]; ensureInferredProjectsUpToDate_TestOnly(): void; getCompilerOptionsForInferredProjects(): CompilerOptions; + onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void; setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void; stopWatchingDirectory(directory: string): void; @@ -9649,7 +11142,7 @@ declare namespace ts.server { private handleDeletedFile(info); private onTypeRootFileChanged(project, fileName); private onSourceFileInDirectoryChangedForConfiguredProject(project, fileName); - private handleChangeInSourceFileForConfiguredProject(project); + private handleChangeInSourceFileForConfiguredProject(project, triggerFile); private onConfigChangedForConfiguredProject(project); private onConfigFileAddedForInferredProject(fileName); private getCanonicalFileName(fileName); @@ -9664,7 +11157,7 @@ declare namespace ts.server { private convertConfigFileContentToProjectOptions(configFilename); private exceededTotalSizeLimitForNonTsFiles<T>(options, fileNames, propertyReader); private createAndAddExternalProject(projectFileName, files, options, typingOptions); - private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile?); + private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile); private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?); private watchConfigDirectoryForProject(project, options); private addFilesToProjectAndUpdateGraph<T>(project, files, propertyReader, clientFileName, typingOptions, configFileErrors); @@ -9676,6 +11169,7 @@ declare namespace ts.server { getScriptInfo(uncheckedFileName: string): ScriptInfo; getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): ScriptInfo; getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; + getScriptInfoForPath(fileName: Path): ScriptInfo; setHostConfiguration(args: protocol.ConfigureRequestArguments): void; closeLog(): void; reloadProjects(): void; @@ -9696,6 +11190,9 @@ declare namespace ts.server { fileName: NormalizedPath; project: Project; } + interface EventSender { + event(payload: any, eventName: string): void; + } namespace CommandNames { const Brace: protocol.CommandTypes.Brace; const BraceFull: protocol.CommandTypes.BraceFull; @@ -9718,6 +11215,8 @@ declare namespace ts.server { const FormatRangeFull: protocol.CommandTypes.FormatRangeFull; const Geterr: protocol.CommandTypes.Geterr; const GeterrForProject: protocol.CommandTypes.GeterrForProject; + const Implementation: protocol.CommandTypes.Implementation; + const ImplementationFull: protocol.CommandTypes.ImplementationFull; const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync; const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync; const NavBar: protocol.CommandTypes.NavBar; @@ -9760,9 +11259,12 @@ declare namespace ts.server { const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan; const BreakpointStatement: protocol.CommandTypes.BreakpointStatement; const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects; + const GetCodeFixes: protocol.CommandTypes.GetCodeFixes; + const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull; + const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes; } function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; - class Session { + class Session implements EventSender { private host; protected readonly typingsInstaller: ITypingsInstaller; private byteLength; @@ -9792,9 +11294,10 @@ declare namespace ts.server { private getProject(projectFileName); private getCompilerOptionsDiagnostics(args); private convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo); - private getDiagnosticsWorker(args, selector, includeLinePosition); + private getDiagnosticsWorker(args, isSemantic, selector, includeLinePosition); private getDefinition(args, simplifiedResult); private getTypeDefinition(args); + private getImplementation(args, simplifiedResult); private getOccurrences(args); private getSyntacticDiagnosticsSync(args); private getSemanticDiagnosticsSync(args); @@ -9840,6 +11343,10 @@ declare namespace ts.server { private decorateSpan(span, scriptInfo); private getNavigationTree(args, simplifiedResult); private getNavigateToItems(args, simplifiedResult); + private getSupportedCodeFixes(); + private getCodeFixes(args, simplifiedResult); + private mapCodeAction(codeAction, scriptInfo); + private convertTextChangeToCodeEdit(change, scriptInfo); private getBraceMatching(args, simplifiedResult); getDiagnosticsForProject(delay: number, fileName: string): void; getCanonicalFileName(fileName: string): string; @@ -10039,11 +11546,11 @@ declare namespace ts { unregisterShim(shim: Shim): void; } interface Shim { - dispose(dummy: any): void; + dispose(_dummy: any): void; } interface LanguageServiceShim extends Shim { languageService: LanguageService; - dispose(dummy: any): void; + dispose(_dummy: any): void; refresh(throwOnError: boolean): void; cleanupSemanticCache(): void; getSyntacticDiagnostics(fileName: string): string; @@ -10063,11 +11570,12 @@ declare namespace ts { findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string; getDefinitionAtPosition(fileName: string, position: number): string; getTypeDefinitionAtPosition(fileName: string, position: number): string; + getImplementationAtPosition(fileName: string, position: number): string; getReferencesAtPosition(fileName: string, position: number): string; findReferences(fileName: string, position: number): string; getOccurrencesAtPosition(fileName: string, position: number): string; getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; - getNavigateToItems(searchValue: string, maxResultCount?: number): string; + getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string): string; getNavigationBarItems(fileName: string): string; getNavigationTree(fileName: string): string; getOutliningSpans(fileName: string): string; @@ -10098,7 +11606,7 @@ declare namespace ts { private files; private loggingEnabled; private tracingEnabled; - resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[]; + resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModuleFull[]; resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; directoryExists: (directoryName: string) => boolean; constructor(shimHost: LanguageServiceShimHost); @@ -10134,6 +11642,13 @@ declare namespace ts { private readDirectoryFallback(rootDir, extension, exclude); getDirectories(path: string): string[]; } + function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { + message: string; + start: number; + length: number; + category: string; + code: number; + }[]; class TypeScriptServicesFactory implements ShimFactory { private _shims; private documentRegistry; @@ -10149,4 +11664,4 @@ declare namespace ts { declare namespace TypeScript.Services { const TypeScriptServicesFactory: typeof ts.TypeScriptServicesFactory; } -declare const toolsVersion: string; +declare const toolsVersion = "2.2"; |