UNPKG

chen-typescript

Version:

TypeScript is a language for application scale JavaScript development

1,403 lines (1,400 loc) 104 kB
/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ declare namespace ts { interface MapLike<T> { [index: string]: T; } interface Map<T> extends MapLike<T> { __mapBrand: any; } type Path = string & { __pathBrand: any; }; interface FileMap<T> { get(fileName: Path): T; set(fileName: Path, value: T): void; contains(fileName: Path): boolean; remove(fileName: Path): void; forEachValue(f: (key: Path, v: T) => void): void; getKeys(): Path[]; clear(): void; } interface TextRange { pos: number; end: number; } enum SyntaxKind { Unknown = 0, EndOfFileToken = 1, SingleLineCommentTrivia = 2, MultiLineCommentTrivia = 3, NewLineTrivia = 4, WhitespaceTrivia = 5, ShebangTrivia = 6, 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, FirstToken = 0, LastToken = 138, 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, } enum NodeFlags { None = 0, Export = 1, Ambient = 2, Public = 4, Private = 8, Protected = 16, Static = 32, Readonly = 64, 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, AccessibilityModifier = 28, ParameterPropertyModifier = 92, BlockScoped = 3072, ReachabilityCheckFlags = 98304, EmitHelperFlags = 3932160, ReachabilityAndEmitFlags = 4030464, ContextFlags = 197132288, TypeExcludesFlags = 41943040, } enum JsxFlags { None = 0, /** An element from a named property of the JSX.IntrinsicElements interface */ IntrinsicNamedElement = 1, /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */ IntrinsicIndexedElement = 2, IntrinsicElement = 3, } interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; decorators?: NodeArray<Decorator>; modifiers?: ModifiersArray; parent?: Node; } interface NodeArray<T> extends Array<T>, TextRange { hasTrailingComma?: boolean; } interface ModifiersArray extends NodeArray<Modifier> { flags: NodeFlags; } interface Token extends Node { __tokenTag: any; } interface Modifier extends Token { } interface Identifier extends PrimaryExpression { text: string; originalKeywordKind?: SyntaxKind; } interface QualifiedName extends Node { left: EntityName; right: Identifier; } type EntityName = Identifier | QualifiedName; type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; name?: DeclarationName; } interface DeclarationStatement extends Declaration, Statement { name?: Identifier; } interface ComputedPropertyName extends Node { expression: Expression; } interface Decorator extends Node { expression: LeftHandSideExpression; } interface TypeParameterDeclaration extends Declaration { name: Identifier; constraint?: TypeNode; expression?: Expression; } interface SignatureDeclaration extends Declaration { name?: PropertyName; typeParameters?: NodeArray<TypeParameterDeclaration>; parameters: NodeArray<ParameterDeclaration>; type?: TypeNode; } interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { } interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { } interface VariableDeclaration extends Declaration { parent?: VariableDeclarationList; name: Identifier | BindingPattern; type?: TypeNode; initializer?: Expression; } interface VariableDeclarationList extends Node { declarations: NodeArray<VariableDeclaration>; } interface ParameterDeclaration extends Declaration { dotDotDotToken?: Node; name: Identifier | BindingPattern; questionToken?: Node; type?: TypeNode; initializer?: Expression; } interface BindingElement extends Declaration { propertyName?: PropertyName; dotDotDotToken?: Node; name: Identifier | BindingPattern; initializer?: Expression; } interface PropertySignature extends TypeElement { name: PropertyName; questionToken?: Node; type?: TypeNode; initializer?: Expression; } interface PropertyDeclaration extends ClassElement { questionToken?: Node; name: PropertyName; type?: TypeNode; initializer?: Expression; } interface ObjectLiteralElement extends Declaration { _objectLiteralBrandBrand: any; name?: PropertyName; } interface PropertyAssignment extends ObjectLiteralElement { _propertyAssignmentBrand: any; name: PropertyName; questionToken?: Node; initializer: Expression; } interface ShorthandPropertyAssignment extends ObjectLiteralElement { name: Identifier; questionToken?: Node; equalsToken?: Node; objectAssignmentInitializer?: Expression; } interface VariableLikeDeclaration extends Declaration { propertyName?: PropertyName; dotDotDotToken?: Node; name: DeclarationName; questionToken?: Node; type?: TypeNode; initializer?: Expression; } interface PropertyLikeDeclaration extends Declaration { name: PropertyName; } interface BindingPattern extends Node { elements: NodeArray<BindingElement>; } interface ObjectBindingPattern extends BindingPattern { } interface ArrayBindingPattern extends BindingPattern { } /** * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. * Examples: * - FunctionDeclaration * - MethodDeclaration * - AccessorDeclaration */ interface FunctionLikeDeclaration extends SignatureDeclaration { _functionLikeDeclarationBrand: any; asteriskToken?: Node; questionToken?: Node; body?: Block | Expression; } interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { name?: Identifier; body?: FunctionBody; } interface MethodSignature extends SignatureDeclaration, TypeElement { name: PropertyName; } interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { name: PropertyName; body?: FunctionBody; } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { body?: FunctionBody; } interface SemicolonClassElement extends ClassElement { _semicolonClassElementBrand: any; } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; name: PropertyName; body: FunctionBody; } interface GetAccessorDeclaration extends AccessorDeclaration { } interface SetAccessorDeclaration extends AccessorDeclaration { } interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { _indexSignatureDeclarationBrand: any; } interface TypeNode extends Node { _typeNodeBrand: any; } interface ThisTypeNode extends TypeNode { _thisTypeNodeBrand: any; } interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { _functionOrConstructorTypeNodeBrand: any; } interface FunctionTypeNode extends FunctionOrConstructorTypeNode { } interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { } interface TypeReferenceNode extends TypeNode { typeName: EntityName; typeArguments?: NodeArray<TypeNode>; } interface TypePredicateNode extends TypeNode { parameterName: Identifier | ThisTypeNode; type: TypeNode; } interface TypeQueryNode extends TypeNode { exprName: EntityName; } interface TypeLiteralNode extends TypeNode, Declaration { members: NodeArray<TypeElement>; } interface ArrayTypeNode extends TypeNode { elementType: TypeNode; } interface TupleTypeNode extends TypeNode { elementTypes: NodeArray<TypeNode>; } interface UnionOrIntersectionTypeNode extends TypeNode { types: NodeArray<TypeNode>; } interface UnionTypeNode extends UnionOrIntersectionTypeNode { } interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { } interface ParenthesizedTypeNode extends TypeNode { type: TypeNode; } interface LiteralTypeNode extends TypeNode { _stringLiteralTypeBrand: any; literal: Expression; } interface StringLiteral extends LiteralExpression { _stringLiteralBrand: any; } interface Expression extends Node { _expressionBrand: any; contextualType?: Type; } interface OmittedExpression extends Expression { } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } interface IncrementExpression extends UnaryExpression { _incrementExpressionBrand: any; } interface PrefixUnaryExpression extends IncrementExpression { operator: SyntaxKind; operand: UnaryExpression; } interface PostfixUnaryExpression extends IncrementExpression { operand: LeftHandSideExpression; operator: SyntaxKind; } interface PostfixExpression extends UnaryExpression { _postfixExpressionBrand: any; } interface LeftHandSideExpression extends IncrementExpression { _leftHandSideExpressionBrand: any; } interface MemberExpression extends LeftHandSideExpression { _memberExpressionBrand: any; } interface PrimaryExpression extends MemberExpression { _primaryExpressionBrand: any; } interface DeleteExpression extends UnaryExpression { expression: UnaryExpression; } interface TypeOfExpression extends UnaryExpression { expression: UnaryExpression; } interface VoidExpression extends UnaryExpression { expression: UnaryExpression; } interface AwaitExpression extends UnaryExpression { expression: UnaryExpression; } interface YieldExpression extends Expression { asteriskToken?: Node; expression?: Expression; } interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { condition: Expression; questionToken: Node; whenTrue: Expression; colonToken: Node; whenFalse: Expression; } type FunctionBody = Block; type ConciseBody = FunctionBody | Expression; interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { name?: Identifier; body: FunctionBody; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { equalsGreaterThanToken: Node; body: ConciseBody; } interface LiteralLikeNode extends Node { text: string; isUnterminated?: boolean; hasExtendedUnicodeEscape?: boolean; } interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { _literalExpressionBrand: any; } interface TemplateLiteralFragment extends LiteralLikeNode { _templateLiteralFragmentBrand: any; } interface TemplateExpression extends PrimaryExpression { head: TemplateLiteralFragment; templateSpans: NodeArray<TemplateSpan>; } interface TemplateSpan extends Node { expression: Expression; literal: TemplateLiteralFragment; } interface ParenthesizedExpression extends PrimaryExpression { expression: Expression; } interface ArrayLiteralExpression extends PrimaryExpression { elements: NodeArray<Expression>; } interface SpreadElementExpression extends Expression { expression: Expression; } interface ObjectLiteralExpression extends PrimaryExpression, Declaration { properties: NodeArray<ObjectLiteralElement>; } type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; interface PropertyAccessExpression extends MemberExpression, Declaration { expression: LeftHandSideExpression; name: Identifier; } /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */ interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { _propertyAccessExpressionLikeQualifiedNameBrand?: any; expression: EntityNameExpression; } interface ElementAccessExpression extends MemberExpression { expression: LeftHandSideExpression; argumentExpression?: Expression; } interface CallExpression extends LeftHandSideExpression, Declaration { expression: LeftHandSideExpression; typeArguments?: NodeArray<TypeNode>; arguments: NodeArray<Expression>; } interface ExpressionWithTypeArguments extends TypeNode { expression: LeftHandSideExpression; typeArguments?: NodeArray<TypeNode>; } interface NewExpression extends CallExpression, PrimaryExpression { } interface TaggedTemplateExpression extends MemberExpression { tag: LeftHandSideExpression; template: LiteralExpression | TemplateExpression; } type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; interface AsExpression extends Expression { expression: Expression; type: TypeNode; } interface TypeAssertion extends UnaryExpression { type: TypeNode; expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; interface NonNullExpression extends LeftHandSideExpression { expression: Expression; } interface JsxElement extends PrimaryExpression { openingElement: JsxOpeningElement; children: NodeArray<JsxChild>; closingElement: JsxClosingElement; } type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; interface JsxOpeningElement extends Expression { _openingElementBrand?: any; tagName: JsxTagNameExpression; attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>; } interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement { _selfClosingElementBrand?: any; } type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; interface JsxAttribute extends Node { name: Identifier; initializer?: Expression; } interface JsxSpreadAttribute extends Node { expression: Expression; } interface JsxClosingElement extends Node { tagName: JsxTagNameExpression; } interface JsxExpression extends Expression { expression?: Expression; } interface JsxText extends Node { _jsxTextExpressionBrand: any; } type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; interface Statement extends Node { _statementBrand: any; } interface EmptyStatement extends Statement { } interface DebuggerStatement extends Statement { } interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { name?: Identifier; } type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; interface Block extends Statement { statements: NodeArray<Statement>; } interface VariableStatement extends Statement { declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement { expression: Expression; } interface IfStatement extends Statement { expression: Expression; thenStatement: Statement; elseStatement?: Statement; } interface IterationStatement extends Statement { statement: Statement; } interface DoStatement extends IterationStatement { expression: Expression; } interface WhileStatement extends IterationStatement { expression: Expression; } interface ForStatement extends IterationStatement { initializer?: VariableDeclarationList | Expression; condition?: Expression; incrementor?: Expression; } interface ForInStatement extends IterationStatement { initializer: VariableDeclarationList | Expression; expression: Expression; } interface ForOfStatement extends IterationStatement { initializer: VariableDeclarationList | Expression; expression: Expression; } interface BreakStatement extends Statement { label?: Identifier; } interface ContinueStatement extends Statement { label?: Identifier; } type BreakOrContinueStatement = BreakStatement | ContinueStatement; interface ReturnStatement extends Statement { expression?: Expression; } interface WithStatement extends Statement { expression: Expression; statement: Statement; } interface SwitchStatement extends Statement { expression: Expression; caseBlock: CaseBlock; possiblyExhaustive?: boolean; } interface CaseBlock extends Node { clauses: NodeArray<CaseOrDefaultClause>; } interface CaseClause extends Node { expression: Expression; statements: NodeArray<Statement>; } interface DefaultClause extends Node { statements: NodeArray<Statement>; } type CaseOrDefaultClause = CaseClause | DefaultClause; interface LabeledStatement extends Statement { label: Identifier; statement: Statement; } interface ThrowStatement extends Statement { expression: Expression; } interface TryStatement extends Statement { tryBlock: Block; catchClause?: CatchClause; finallyBlock?: Block; } interface CatchClause extends Node { variableDeclaration: VariableDeclaration; block: Block; } type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray<TypeParameterDeclaration>; heritageClauses?: NodeArray<HeritageClause>; members: NodeArray<ClassElement>; } interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { name?: Identifier; } interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { } interface ClassElement extends Declaration { _classElementBrand: any; name?: PropertyName; } interface TypeElement extends Declaration { _typeElementBrand: any; name?: PropertyName; questionToken?: Node; } interface InterfaceDeclaration extends DeclarationStatement { name: Identifier; typeParameters?: NodeArray<TypeParameterDeclaration>; heritageClauses?: NodeArray<HeritageClause>; members: NodeArray<TypeElement>; } interface HeritageClause extends Node { token: SyntaxKind; types?: NodeArray<ExpressionWithTypeArguments>; } interface TypeAliasDeclaration extends DeclarationStatement { name: Identifier; typeParameters?: NodeArray<TypeParameterDeclaration>; type: TypeNode; } interface EnumMember extends Declaration { name: DeclarationName; initializer?: Expression; } interface EnumDeclaration extends DeclarationStatement { name: Identifier; members: NodeArray<EnumMember>; } type ModuleBody = ModuleBlock | ModuleDeclaration; interface ModuleDeclaration extends DeclarationStatement { name: Identifier | LiteralExpression; body?: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, Statement { statements: NodeArray<Statement>; } interface ImportEqualsDeclaration extends DeclarationStatement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } interface ExternalModuleReference extends Node { expression?: Expression; } interface ImportDeclaration extends Statement { importClause?: ImportClause; moduleSpecifier: Expression; } interface ImportClause extends Declaration { name?: Identifier; namedBindings?: NamespaceImport | NamedImports; } interface NamespaceImport extends Declaration { name: Identifier; } interface NamespaceExportDeclaration extends DeclarationStatement { name: Identifier; moduleReference: LiteralLikeNode; } interface ExportDeclaration extends DeclarationStatement { exportClause?: NamedExports; moduleSpecifier?: Expression; } interface NamedImports extends Node { elements: NodeArray<ImportSpecifier>; } interface NamedExports extends Node { elements: NodeArray<ExportSpecifier>; } type NamedImportsOrExports = NamedImports | NamedExports; interface ImportSpecifier extends Declaration { propertyName?: Identifier; name: Identifier; } interface ExportSpecifier extends Declaration { propertyName?: Identifier; name: Identifier; } type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; interface ExportAssignment extends DeclarationStatement { isExportEquals?: boolean; expression: Expression; } interface FileReference extends TextRange { fileName: string; } interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; kind: SyntaxKind; } interface JSDocTypeExpression extends Node { type: JSDocType; } interface JSDocType extends TypeNode { _jsDocTypeBrand: any; } interface JSDocAllType extends JSDocType { _JSDocAllTypeBrand: any; } interface JSDocUnknownType extends JSDocType { _JSDocUnknownTypeBrand: any; } interface JSDocArrayType extends JSDocType { elementType: JSDocType; } interface JSDocUnionType extends JSDocType { types: NodeArray<JSDocType>; } interface JSDocTupleType extends JSDocType { types: NodeArray<JSDocType>; } interface JSDocNonNullableType extends JSDocType { type: JSDocType; } interface JSDocNullableType extends JSDocType { type: JSDocType; } interface JSDocRecordType extends JSDocType, TypeLiteralNode { members: NodeArray<JSDocRecordMember>; } interface JSDocTypeReference extends JSDocType { name: EntityName; typeArguments: NodeArray<JSDocType>; } interface JSDocOptionalType extends JSDocType { type: JSDocType; } interface JSDocFunctionType extends JSDocType, SignatureDeclaration { parameters: NodeArray<ParameterDeclaration>; type: JSDocType; } interface JSDocVariadicType extends JSDocType { type: JSDocType; } interface JSDocConstructorType extends JSDocType { type: JSDocType; } interface JSDocThisType extends JSDocType { type: JSDocType; } interface JSDocLiteralType extends JSDocType { literal: LiteralTypeNode; } type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; interface JSDocRecordMember extends PropertySignature { name: Identifier | LiteralExpression; type?: JSDocType; } interface JSDocComment extends Node { tags: NodeArray<JSDocTag>; } interface JSDocTag extends Node { atToken: Node; tagName: Identifier; } interface JSDocTemplateTag extends JSDocTag { typeParameters: NodeArray<TypeParameterDeclaration>; } interface JSDocReturnTag extends JSDocTag { typeExpression: JSDocTypeExpression; } interface JSDocTypeTag extends JSDocTag { typeExpression: JSDocTypeExpression; } interface JSDocTypedefTag extends JSDocTag, Declaration { name?: Identifier; typeExpression?: JSDocTypeExpression; jsDocTypeLiteral?: JSDocTypeLiteral; } interface JSDocPropertyTag extends JSDocTag, TypeElement { name: Identifier; typeExpression: JSDocTypeExpression; } interface JSDocTypeLiteral extends JSDocType { jsDocPropertyTags?: NodeArray<JSDocPropertyTag>; jsDocTypeTag?: JSDocTypeTag; } interface JSDocParameterTag extends JSDocTag { preParameterName?: Identifier; typeExpression?: JSDocTypeExpression; postParameterName?: Identifier; isBracketed: boolean; } enum FlowFlags { Unreachable = 1, Start = 2, BranchLabel = 4, LoopLabel = 8, Assignment = 16, TrueCondition = 32, FalseCondition = 64, SwitchClause = 128, Referenced = 256, Shared = 512, Label = 12, Condition = 96, } interface FlowNode { flags: FlowFlags; id?: number; } interface FlowStart extends FlowNode { container?: FunctionExpression | ArrowFunction; } interface FlowLabel extends FlowNode { antecedents: FlowNode[]; } interface FlowAssignment extends FlowNode { node: Expression | VariableDeclaration | BindingElement; antecedent: FlowNode; } interface FlowCondition extends FlowNode { expression: Expression; antecedent: FlowNode; } interface FlowSwitchClause extends FlowNode { switchStatement: SwitchStatement; clauseStart: number; clauseEnd: number; antecedent: FlowNode; } type FlowType = Type | IncompleteType; interface IncompleteType { flags: TypeFlags; type: Type; } interface AmdDependency { path: string; name: string; } interface SourceFile extends Declaration { statements: NodeArray<Statement>; endOfFileToken: Node; fileName: string; path: Path; text: string; amdDependencies: AmdDependency[]; moduleName: string; referencedFiles: FileReference[]; typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; isDeclarationFile: boolean; /** * lib.d.ts should have a reference comment like * * /// <reference no-default-lib="true"/> * * If any other file has this comment, it signals not to include lib.d.ts * because this containing file is intended to act as a default library. */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; getSourceFile(fileName: string): SourceFile; getSourceFileByPath(path: Path): SourceFile; getCurrentDirectory(): string; } interface ParseConfigHost { useCaseSensitiveFileNames: boolean; readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; /** * Gets a value indicating whether the specified path exists and is a file. * @param path The path to test. */ fileExists(path: string): boolean; } interface WriteFileCallback { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; } class OperationCanceledException { } interface CancellationToken { isCancellationRequested(): boolean; /** @throws OperationCanceledException if isCancellationRequested is true */ throwIfCancellationRequested(): void; } interface Program extends ScriptReferenceHost { /** * Get a list of root file names that were passed to a 'createProgram' */ getRootFileNames(): string[]; /** * Get a list of files in the program */ getSourceFiles(): SourceFile[]; /** * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then * the JavaScript and declaration files will be produced for all the files in this program. * If targetSourceFile is specified, then only the JavaScript and declaration for that * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult; getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; /** * Gets a type checker that can be used to semantically analyze source fils in the program. */ getTypeChecker(): TypeChecker; } interface SourceMapSpan { /** Line number in the .js file. */ emittedLine: number; /** Column number in the .js file. */ emittedColumn: number; /** Line number in the .ts file. */ sourceLine: number; /** Column number in the .ts file. */ sourceColumn: number; /** Optional name (index into names array) associated with this span. */ nameIndex?: number; /** .ts file (index into sources array) associated with this span */ sourceIndex: number; } interface SourceMapData { sourceMapFilePath: string; jsSourceMappingURL: string; sourceMapFile: string; sourceMapSourceRoot: string; sourceMapSources: string[]; sourceMapSourcesContent?: string[]; inputSourceFileNames: string[]; sourceMapNames?: string[]; sourceMapMappings: string; sourceMapDecodedMappings: SourceMapSpan[]; } /** Return code used by getEmitOutput function to indicate status of the function */ enum ExitStatus { Success = 0, DiagnosticsPresent_OutputsSkipped = 1, DiagnosticsPresent_OutputsGenerated = 2, } interface EmitResult { emitSkipped: boolean; /** Contains declaration emit diagnostics */ diagnostics: Diagnostic[]; emittedFiles: string[]; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): Symbol[]; getContextualType(node: Expression): Type; getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; isUndefinedSymbol(symbol: Symbol): boolean; isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; } interface SymbolWriter { writeKeyword(text: string): void; writeOperator(text: string): void; writePunctuation(text: string): void; writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; decreaseIndent(): void; clear(): void; trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; } enum TypeFormatFlags { None = 0, WriteArrayAsGenericType = 1, UseTypeOfFunction = 2, NoTruncation = 4, WriteArrowStyleSignature = 8, WriteOwnNameForAnyLike = 16, WriteTypeArgumentsOfSignature = 32, InElementType = 64, UseFullyQualifiedType = 128, InFirstTypeArgument = 256, InTypeAlias = 512, } enum SymbolFormatFlags { None = 0, WriteTypeParametersOrArguments = 1, UseOnlyExternalAliasing = 2, } enum TypePredicateKind { This = 0, Identifier = 1, } interface TypePredicateBase { kind: TypePredicateKind; type: Type; } interface ThisTypePredicate extends TypePredicateBase { _thisTypePredicateBrand: any; } interface IdentifierTypePredicate extends TypePredicateBase { parameterName: string; parameterIndex: number; } type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; enum SymbolFlags { None = 0, FunctionScopedVariable = 1, BlockScopedVariable = 2, Property = 4, EnumMember = 8, Function = 16, Class = 32, Interface = 64, ConstEnum = 128, RegularEnum = 256, ValueModule = 512, NamespaceModule = 1024, TypeLiteral = 2048, ObjectLiteral = 4096, Method = 8192, Constructor = 16384, GetAccessor = 32768, SetAccessor = 65536, Signature = 131072, TypeParameter = 262144, TypeAlias = 524288, ExportValue = 1048576, ExportType = 2097152, ExportNamespace = 4194304, Alias = 8388608, Instantiated = 16777216, Merged = 33554432, Transient = 67108864, Prototype = 134217728, SyntheticProperty = 268435456, Optional = 536870912, ExportStar = 1073741824, Enum = 384, Variable = 3, Value = 107455, Type = 793064, Namespace = 1920, Module = 1536, Accessor = 98304, FunctionScopedVariableExcludes = 107454, BlockScopedVariableExcludes = 107455, ParameterExcludes = 107455, PropertyExcludes = 0, EnumMemberExcludes = 900095, FunctionExcludes = 106927, ClassExcludes = 899519, InterfaceExcludes = 792968, Re