UNPKG

typescript

Version:

TypeScript is a language for application scale JavaScript development

1,121 lines (1,118 loc) • 308 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 { const versionMajorMinor = "3.7"; /** The version of the TypeScript compiler release */ const version: string; } declare namespace ts { /** * Type of objects whose values are all of the same type. * The `in` and `for-in` operators can *not* be safely used, * since `Object.prototype` may be modified by outside code. */ interface MapLike<T> { [index: string]: T; } interface SortedReadonlyArray<T> extends ReadonlyArray<T> { " __sortedArrayBrand": any; } interface SortedArray<T> extends Array<T> { " __sortedArrayBrand": any; } /** ES6 Map interface, only read methods included. */ interface ReadonlyMap<T> { get(key: string): T | undefined; has(key: string): boolean; forEach(action: (value: T, key: string) => void): void; readonly size: number; keys(): Iterator<string>; values(): Iterator<T>; entries(): Iterator<[string, T]>; } /** ES6 Map interface. */ interface Map<T> extends ReadonlyMap<T> { set(key: string, value: T): this; delete(key: string): boolean; clear(): void; } /** ES6 Iterator type. */ interface Iterator<T> { next(): { value: T; done?: false; } | { value: never; done: true; }; } /** Array that is only intended to be pushed to, never read. */ interface Push<T> { push(...values: T[]): void; } } declare namespace ts { export type Path = string & { __pathBrand: any; }; export interface TextRange { pos: number; end: number; } export type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind; export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; export enum SyntaxKind { Unknown = 0, EndOfFileToken = 1, SingleLineCommentTrivia = 2, MultiLineCommentTrivia = 3, NewLineTrivia = 4, WhitespaceTrivia = 5, ShebangTrivia = 6, ConflictMarkerTrivia = 7, NumericLiteral = 8, BigIntLiteral = 9, StringLiteral = 10, JsxText = 11, JsxTextAllWhiteSpaces = 12, RegularExpressionLiteral = 13, NoSubstitutionTemplateLiteral = 14, TemplateHead = 15, TemplateMiddle = 16, TemplateTail = 17, OpenBraceToken = 18, CloseBraceToken = 19, OpenParenToken = 20, CloseParenToken = 21, OpenBracketToken = 22, CloseBracketToken = 23, DotToken = 24, DotDotDotToken = 25, SemicolonToken = 26, CommaToken = 27, QuestionDotToken = 28, LessThanToken = 29, LessThanSlashToken = 30, GreaterThanToken = 31, LessThanEqualsToken = 32, GreaterThanEqualsToken = 33, EqualsEqualsToken = 34, ExclamationEqualsToken = 35, EqualsEqualsEqualsToken = 36, ExclamationEqualsEqualsToken = 37, EqualsGreaterThanToken = 38, PlusToken = 39, MinusToken = 40, AsteriskToken = 41, AsteriskAsteriskToken = 42, SlashToken = 43, PercentToken = 44, PlusPlusToken = 45, MinusMinusToken = 46, LessThanLessThanToken = 47, GreaterThanGreaterThanToken = 48, GreaterThanGreaterThanGreaterThanToken = 49, AmpersandToken = 50, BarToken = 51, CaretToken = 52, ExclamationToken = 53, TildeToken = 54, AmpersandAmpersandToken = 55, BarBarToken = 56, QuestionToken = 57, ColonToken = 58, AtToken = 59, QuestionQuestionToken = 60, /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */ BacktickToken = 61, EqualsToken = 62, PlusEqualsToken = 63, MinusEqualsToken = 64, AsteriskEqualsToken = 65, AsteriskAsteriskEqualsToken = 66, SlashEqualsToken = 67, PercentEqualsToken = 68, LessThanLessThanEqualsToken = 69, GreaterThanGreaterThanEqualsToken = 70, GreaterThanGreaterThanGreaterThanEqualsToken = 71, AmpersandEqualsToken = 72, BarEqualsToken = 73, CaretEqualsToken = 74, Identifier = 75, BreakKeyword = 76, CaseKeyword = 77, CatchKeyword = 78, ClassKeyword = 79, ConstKeyword = 80, ContinueKeyword = 81, DebuggerKeyword = 82, DefaultKeyword = 83, DeleteKeyword = 84, DoKeyword = 85, ElseKeyword = 86, EnumKeyword = 87, ExportKeyword = 88, ExtendsKeyword = 89, FalseKeyword = 90, FinallyKeyword = 91, ForKeyword = 92, FunctionKeyword = 93, IfKeyword = 94, ImportKeyword = 95, InKeyword = 96, InstanceOfKeyword = 97, NewKeyword = 98, NullKeyword = 99, ReturnKeyword = 100, SuperKeyword = 101, SwitchKeyword = 102, ThisKeyword = 103, ThrowKeyword = 104, TrueKeyword = 105, TryKeyword = 106, TypeOfKeyword = 107, VarKeyword = 108, VoidKeyword = 109, WhileKeyword = 110, WithKeyword = 111, ImplementsKeyword = 112, InterfaceKeyword = 113, LetKeyword = 114, PackageKeyword = 115, PrivateKeyword = 116, ProtectedKeyword = 117, PublicKeyword = 118, StaticKeyword = 119, YieldKeyword = 120, AbstractKeyword = 121, AsKeyword = 122, AssertsKeyword = 123, AnyKeyword = 124, AsyncKeyword = 125, AwaitKeyword = 126, BooleanKeyword = 127, ConstructorKeyword = 128, DeclareKeyword = 129, GetKeyword = 130, InferKeyword = 131, IsKeyword = 132, KeyOfKeyword = 133, ModuleKeyword = 134, NamespaceKeyword = 135, NeverKeyword = 136, ReadonlyKeyword = 137, RequireKeyword = 138, NumberKeyword = 139, ObjectKeyword = 140, SetKeyword = 141, StringKeyword = 142, SymbolKeyword = 143, TypeKeyword = 144, UndefinedKeyword = 145, UniqueKeyword = 146, UnknownKeyword = 147, FromKeyword = 148, GlobalKeyword = 149, BigIntKeyword = 150, OfKeyword = 151, QualifiedName = 152, ComputedPropertyName = 153, TypeParameter = 154, Parameter = 155, Decorator = 156, PropertySignature = 157, PropertyDeclaration = 158, MethodSignature = 159, MethodDeclaration = 160, Constructor = 161, GetAccessor = 162, SetAccessor = 163, CallSignature = 164, ConstructSignature = 165, IndexSignature = 166, TypePredicate = 167, TypeReference = 168, FunctionType = 169, ConstructorType = 170, TypeQuery = 171, TypeLiteral = 172, ArrayType = 173, TupleType = 174, OptionalType = 175, RestType = 176, UnionType = 177, IntersectionType = 178, ConditionalType = 179, InferType = 180, ParenthesizedType = 181, ThisType = 182, TypeOperator = 183, IndexedAccessType = 184, MappedType = 185, LiteralType = 186, ImportType = 187, ObjectBindingPattern = 188, ArrayBindingPattern = 189, BindingElement = 190, ArrayLiteralExpression = 191, ObjectLiteralExpression = 192, PropertyAccessExpression = 193, ElementAccessExpression = 194, CallExpression = 195, NewExpression = 196, TaggedTemplateExpression = 197, TypeAssertionExpression = 198, ParenthesizedExpression = 199, FunctionExpression = 200, ArrowFunction = 201, DeleteExpression = 202, TypeOfExpression = 203, VoidExpression = 204, AwaitExpression = 205, PrefixUnaryExpression = 206, PostfixUnaryExpression = 207, BinaryExpression = 208, ConditionalExpression = 209, TemplateExpression = 210, YieldExpression = 211, SpreadElement = 212, ClassExpression = 213, OmittedExpression = 214, ExpressionWithTypeArguments = 215, AsExpression = 216, NonNullExpression = 217, MetaProperty = 218, SyntheticExpression = 219, TemplateSpan = 220, SemicolonClassElement = 221, Block = 222, EmptyStatement = 223, VariableStatement = 224, ExpressionStatement = 225, IfStatement = 226, DoStatement = 227, WhileStatement = 228, ForStatement = 229, ForInStatement = 230, ForOfStatement = 231, ContinueStatement = 232, BreakStatement = 233, ReturnStatement = 234, WithStatement = 235, SwitchStatement = 236, LabeledStatement = 237, ThrowStatement = 238, TryStatement = 239, DebuggerStatement = 240, VariableDeclaration = 241, VariableDeclarationList = 242, FunctionDeclaration = 243, ClassDeclaration = 244, InterfaceDeclaration = 245, TypeAliasDeclaration = 246, EnumDeclaration = 247, ModuleDeclaration = 248, ModuleBlock = 249, CaseBlock = 250, NamespaceExportDeclaration = 251, ImportEqualsDeclaration = 252, ImportDeclaration = 253, ImportClause = 254, NamespaceImport = 255, NamedImports = 256, ImportSpecifier = 257, ExportAssignment = 258, ExportDeclaration = 259, NamedExports = 260, ExportSpecifier = 261, MissingDeclaration = 262, ExternalModuleReference = 263, JsxElement = 264, JsxSelfClosingElement = 265, JsxOpeningElement = 266, JsxClosingElement = 267, JsxFragment = 268, JsxOpeningFragment = 269, JsxClosingFragment = 270, JsxAttribute = 271, JsxAttributes = 272, JsxSpreadAttribute = 273, JsxExpression = 274, CaseClause = 275, DefaultClause = 276, HeritageClause = 277, CatchClause = 278, PropertyAssignment = 279, ShorthandPropertyAssignment = 280, SpreadAssignment = 281, EnumMember = 282, UnparsedPrologue = 283, UnparsedPrepend = 284, UnparsedText = 285, UnparsedInternalText = 286, UnparsedSyntheticReference = 287, SourceFile = 288, Bundle = 289, UnparsedSource = 290, InputFiles = 291, JSDocTypeExpression = 292, JSDocAllType = 293, JSDocUnknownType = 294, JSDocNullableType = 295, JSDocNonNullableType = 296, JSDocOptionalType = 297, JSDocFunctionType = 298, JSDocVariadicType = 299, JSDocNamepathType = 300, JSDocComment = 301, JSDocTypeLiteral = 302, JSDocSignature = 303, JSDocTag = 304, JSDocAugmentsTag = 305, JSDocAuthorTag = 306, JSDocClassTag = 307, JSDocCallbackTag = 308, JSDocEnumTag = 309, JSDocParameterTag = 310, JSDocReturnTag = 311, JSDocThisTag = 312, JSDocTypeTag = 313, JSDocTemplateTag = 314, JSDocTypedefTag = 315, JSDocPropertyTag = 316, SyntaxList = 317, NotEmittedStatement = 318, PartiallyEmittedExpression = 319, CommaListExpression = 320, MergeDeclarationMarker = 321, EndOfDeclarationMarker = 322, SyntheticReferenceExpression = 323, Count = 324, FirstAssignment = 62, LastAssignment = 74, FirstCompoundAssignment = 63, LastCompoundAssignment = 74, FirstReservedWord = 76, LastReservedWord = 111, FirstKeyword = 76, LastKeyword = 151, FirstFutureReservedWord = 112, LastFutureReservedWord = 120, FirstTypeNode = 167, LastTypeNode = 187, FirstPunctuation = 18, LastPunctuation = 74, FirstToken = 0, LastToken = 151, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, LastLiteralToken = 14, FirstTemplateToken = 14, LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 74, FirstStatement = 224, LastStatement = 240, FirstNode = 152, FirstJSDocNode = 292, LastJSDocNode = 316, FirstJSDocTagNode = 304, LastJSDocTagNode = 316, } export enum NodeFlags { None = 0, Let = 1, Const = 2, NestedNamespace = 4, Synthesized = 8, Namespace = 16, OptionalChain = 32, ExportContext = 64, ContainsThis = 128, HasImplicitReturn = 256, HasExplicitReturn = 512, GlobalAugmentation = 1024, HasAsyncFunctions = 2048, DisallowInContext = 4096, YieldContext = 8192, DecoratorContext = 16384, AwaitContext = 32768, ThisNodeHasError = 65536, JavaScriptFile = 131072, ThisNodeOrAnySubNodesHasError = 262144, HasAggregatedChildData = 524288, JSDoc = 4194304, JsonFile = 33554432, BlockScoped = 3, ReachabilityCheckFlags = 768, ReachabilityAndEmitFlags = 2816, ContextFlags = 25358336, TypeExcludesFlags = 40960, } export enum ModifierFlags { None = 0, Export = 1, Ambient = 2, Public = 4, Private = 8, Protected = 16, Static = 32, Readonly = 64, Abstract = 128, Async = 256, Default = 512, Const = 2048, HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, NonPublicAccessibilityModifier = 24, TypeScriptModifier = 2270, ExportDefault = 513, All = 3071 } export 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 } export interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; decorators?: NodeArray<Decorator>; modifiers?: ModifiersArray; parent: Node; } export interface JSDocContainer { } export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | EndOfFileToken; export type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType; export type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute; export type HasExpressionInitializer = VariableDeclaration | ParameterDeclaration | BindingElement | PropertySignature | PropertyDeclaration | PropertyAssignment | EnumMember; export interface NodeArray<T extends Node> extends ReadonlyArray<T>, TextRange { hasTrailingComma?: boolean; } export interface Token<TKind extends SyntaxKind> extends Node { kind: TKind; } export type DotToken = Token<SyntaxKind.DotToken>; export type DotDotDotToken = Token<SyntaxKind.DotDotDotToken>; export type QuestionToken = Token<SyntaxKind.QuestionToken>; export type QuestionDotToken = Token<SyntaxKind.QuestionDotToken>; export type ExclamationToken = Token<SyntaxKind.ExclamationToken>; export type ColonToken = Token<SyntaxKind.ColonToken>; export type EqualsToken = Token<SyntaxKind.EqualsToken>; export type AsteriskToken = Token<SyntaxKind.AsteriskToken>; export type EqualsGreaterThanToken = Token<SyntaxKind.EqualsGreaterThanToken>; export type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & JSDocContainer; export type ReadonlyToken = Token<SyntaxKind.ReadonlyKeyword>; export type AwaitKeywordToken = Token<SyntaxKind.AwaitKeyword>; export type PlusToken = Token<SyntaxKind.PlusToken>; export type MinusToken = Token<SyntaxKind.MinusToken>; export type AssertsToken = Token<SyntaxKind.AssertsKeyword>; export 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>; export type ModifiersArray = NodeArray<Modifier>; export interface Identifier extends PrimaryExpression, Declaration { kind: SyntaxKind.Identifier; /** * Prefer to use `id.unescapedText`. (Note: This is available only in services, not internally to the TypeScript compiler.) * Text of identifier, but if the identifier begins with two underscores, this will begin with three. */ escapedText: __String; originalKeywordKind?: SyntaxKind; isInJSDocNamespace?: boolean; } export interface TransientIdentifier extends Identifier { resolvedSymbol: Symbol; } export interface QualifiedName extends Node { kind: SyntaxKind.QualifiedName; left: EntityName; right: Identifier; } export type EntityName = Identifier | QualifiedName; export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern | EntityNameExpression; export interface Declaration extends Node { _declarationBrand: any; } export interface NamedDeclaration extends Declaration { name?: DeclarationName; } export interface DeclarationStatement extends NamedDeclaration, Statement { name?: Identifier | StringLiteral | NumericLiteral; } export interface ComputedPropertyName extends Node { parent: Declaration; kind: SyntaxKind.ComputedPropertyName; expression: Expression; } export interface Decorator extends Node { kind: SyntaxKind.Decorator; parent: NamedDeclaration; expression: LeftHandSideExpression; } export interface TypeParameterDeclaration extends NamedDeclaration { kind: SyntaxKind.TypeParameter; parent: DeclarationWithTypeParameterChildren | InferTypeNode; name: Identifier; /** Note: Consider calling `getEffectiveConstraintOfTypeParameter` */ constraint?: TypeNode; default?: TypeNode; expression?: Expression; } export interface SignatureDeclarationBase extends NamedDeclaration, JSDocContainer { kind: SignatureDeclaration["kind"]; name?: PropertyName; typeParameters?: NodeArray<TypeParameterDeclaration>; parameters: NodeArray<ParameterDeclaration>; type?: TypeNode; } export type SignatureDeclaration = CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction; export interface CallSignatureDeclaration extends SignatureDeclarationBase, TypeElement { kind: SyntaxKind.CallSignature; } export interface ConstructSignatureDeclaration extends SignatureDeclarationBase, TypeElement { kind: SyntaxKind.ConstructSignature; } export type BindingName = Identifier | BindingPattern; export interface VariableDeclaration extends NamedDeclaration { kind: SyntaxKind.VariableDeclaration; parent: VariableDeclarationList | CatchClause; name: BindingName; exclamationToken?: ExclamationToken; type?: TypeNode; initializer?: Expression; } export interface VariableDeclarationList extends Node { kind: SyntaxKind.VariableDeclarationList; parent: VariableStatement | ForStatement | ForOfStatement | ForInStatement; declarations: NodeArray<VariableDeclaration>; } export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer { kind: SyntaxKind.Parameter; parent: SignatureDeclaration; dotDotDotToken?: DotDotDotToken; name: BindingName; questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } export interface BindingElement extends NamedDeclaration { kind: SyntaxKind.BindingElement; parent: BindingPattern; propertyName?: PropertyName; dotDotDotToken?: DotDotDotToken; name: BindingName; initializer?: Expression; } export interface PropertySignature extends TypeElement, JSDocContainer { kind: SyntaxKind.PropertySignature; name: PropertyName; questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } export interface PropertyDeclaration extends ClassElement, JSDocContainer { kind: SyntaxKind.PropertyDeclaration; parent: ClassLikeDeclaration; name: PropertyName; questionToken?: QuestionToken; exclamationToken?: ExclamationToken; type?: TypeNode; initializer?: Expression; } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; name?: PropertyName; } /** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */ export type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration; export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer { parent: ObjectLiteralExpression; kind: SyntaxKind.PropertyAssignment; name: PropertyName; questionToken?: QuestionToken; initializer: Expression; } export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer { parent: ObjectLiteralExpression; kind: SyntaxKind.ShorthandPropertyAssignment; name: Identifier; questionToken?: QuestionToken; exclamationToken?: ExclamationToken; equalsToken?: Token<SyntaxKind.EqualsToken>; objectAssignmentInitializer?: Expression; } export interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer { parent: ObjectLiteralExpression; kind: SyntaxKind.SpreadAssignment; expression: Expression; } export type VariableLikeDeclaration = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertyAssignment | PropertySignature | JsxAttribute | ShorthandPropertyAssignment | EnumMember | JSDocPropertyTag | JSDocParameterTag; export interface PropertyLikeDeclaration extends NamedDeclaration { name: PropertyName; } export interface ObjectBindingPattern extends Node { kind: SyntaxKind.ObjectBindingPattern; parent: VariableDeclaration | ParameterDeclaration | BindingElement; elements: NodeArray<BindingElement>; } export interface ArrayBindingPattern extends Node { kind: SyntaxKind.ArrayBindingPattern; parent: VariableDeclaration | ParameterDeclaration | BindingElement; elements: NodeArray<ArrayBindingElement>; } export type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; export type ArrayBindingElement = BindingElement | OmittedExpression; /** * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclarationBase. * Examples: * - FunctionDeclaration * - MethodDeclaration * - AccessorDeclaration */ export interface FunctionLikeDeclarationBase extends SignatureDeclarationBase { _functionLikeDeclarationBrand: any; asteriskToken?: AsteriskToken; questionToken?: QuestionToken; exclamationToken?: ExclamationToken; body?: Block | Expression; } export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction; /** @deprecated Use SignatureDeclaration */ export type FunctionLike = SignatureDeclaration; export interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement { kind: SyntaxKind.FunctionDeclaration; name?: Identifier; body?: FunctionBody; } export interface MethodSignature extends SignatureDeclarationBase, TypeElement { kind: SyntaxKind.MethodSignature; parent: ObjectTypeDeclaration; name: PropertyName; } export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { kind: SyntaxKind.MethodDeclaration; parent: ClassLikeDeclaration | ObjectLiteralExpression; name: PropertyName; body?: FunctionBody; } export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer { kind: SyntaxKind.Constructor; parent: ClassLikeDeclaration; body?: FunctionBody; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ export interface SemicolonClassElement extends ClassElement { kind: SyntaxKind.SemicolonClassElement; parent: ClassLikeDeclaration; } export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { kind: SyntaxKind.GetAccessor; parent: ClassLikeDeclaration | ObjectLiteralExpression; name: PropertyName; body?: FunctionBody; } export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { kind: SyntaxKind.SetAccessor; parent: ClassLikeDeclaration | ObjectLiteralExpression; name: PropertyName; body?: FunctionBody; } export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement { kind: SyntaxKind.IndexSignature; parent: ObjectTypeDeclaration; } export interface TypeNode extends Node { _typeNodeBrand: any; } export interface KeywordTypeNode extends TypeNode { kind: SyntaxKind.AnyKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } export interface ImportTypeNode extends NodeWithTypeArguments { kind: SyntaxKind.ImportType; isTypeOf?: boolean; argument: TypeNode; qualifier?: EntityName; } export interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } export type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode; export interface FunctionOrConstructorTypeNodeBase extends TypeNode, SignatureDeclarationBase { kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; type: TypeNode; } export interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase { kind: SyntaxKind.FunctionType; } export interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase { kind: SyntaxKind.ConstructorType; } export interface NodeWithTypeArguments extends TypeNode { typeArguments?: NodeArray<TypeNode>; } export type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments; export interface TypeReferenceNode extends NodeWithTypeArguments { kind: SyntaxKind.TypeReference; typeName: EntityName; } export interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; parent: SignatureDeclaration | JSDocTypeExpression; assertsModifier?: AssertsToken; parameterName: Identifier | ThisTypeNode; type?: TypeNode; } export interface TypeQueryNode extends TypeNode { kind: SyntaxKind.TypeQuery; exprName: EntityName; } export interface TypeLiteralNode extends TypeNode, Declaration { kind: SyntaxKind.TypeLiteral; members: NodeArray<TypeElement>; } export interface ArrayTypeNode extends TypeNode { kind: SyntaxKind.ArrayType; elementType: TypeNode; } export interface TupleTypeNode extends TypeNode { kind: SyntaxKind.TupleType; elementTypes: NodeArray<TypeNode>; } export interface OptionalTypeNode extends TypeNode { kind: SyntaxKind.OptionalType; type: TypeNode; } export interface RestTypeNode extends TypeNode { kind: SyntaxKind.RestType; type: TypeNode; } export type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode; export interface UnionTypeNode extends TypeNode { kind: SyntaxKind.UnionType; types: NodeArray<TypeNode>; } export interface IntersectionTypeNode extends TypeNode { kind: SyntaxKind.IntersectionType; types: NodeArray<TypeNode>; } export interface ConditionalTypeNode extends TypeNode { kind: SyntaxKind.ConditionalType; checkType: TypeNode; extendsType: TypeNode; trueType: TypeNode; falseType: TypeNode; } export interface InferTypeNode extends TypeNode { kind: SyntaxKind.InferType; typeParameter: TypeParameterDeclaration; } export interface ParenthesizedTypeNode extends TypeNode { kind: SyntaxKind.ParenthesizedType; type: TypeNode; } export interface TypeOperatorNode extends TypeNode { kind: SyntaxKind.TypeOperator; operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword; type: TypeNode; } export interface IndexedAccessTypeNode extends TypeNode { kind: SyntaxKind.IndexedAccessType; objectType: TypeNode; indexType: TypeNode; } export interface MappedTypeNode extends TypeNode, Declaration { kind: SyntaxKind.MappedType; readonlyToken?: ReadonlyToken | PlusToken | MinusToken; typeParameter: TypeParameterDeclaration; questionToken?: QuestionToken | PlusToken | MinusToken; type?: TypeNode; } export interface LiteralTypeNode extends TypeNode { kind: SyntaxKind.LiteralType; literal: BooleanLiteral | LiteralExpression | PrefixUnaryExpression; } export interface StringLiteral extends LiteralExpression, Declaration { kind: SyntaxKind.StringLiteral; } export type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral; export interface Expression extends Node { _expressionBrand: any; } export interface OmittedExpression extends Expression { kind: SyntaxKind.OmittedExpression; } export interface PartiallyEmittedExpression extends LeftHandSideExpression { kind: SyntaxKind.PartiallyEmittedExpression; expression: Expression; } export interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } /** Deprecated, please use UpdateExpression */ export type IncrementExpression = UpdateExpression; export interface UpdateExpression extends UnaryExpression { _updateExpressionBrand: any; } export type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken; export interface PrefixUnaryExpression extends UpdateExpression { kind: SyntaxKind.PrefixUnaryExpression; operator: PrefixUnaryOperator; operand: UnaryExpression; } export type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; export interface PostfixUnaryExpression extends UpdateExpression { kind: SyntaxKind.PostfixUnaryExpression; operand: LeftHandSideExpression; operator: PostfixUnaryOperator; } export interface LeftHandSideExpression extends UpdateExpression { _leftHandSideExpressionBrand: any; } export interface MemberExpression extends LeftHandSideExpression { _memberExpressionBrand: any; } export interface PrimaryExpression extends MemberExpression { _primaryExpressionBrand: any; } export interface NullLiteral extends PrimaryExpression, TypeNode { kind: SyntaxKind.NullKeyword; } export interface BooleanLiteral extends PrimaryExpression, TypeNode { kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; } export interface ThisExpression extends PrimaryExpression, KeywordTypeNode { kind: SyntaxKind.ThisKeyword; } export interface SuperExpression extends PrimaryExpression { kind: SyntaxKind.SuperKeyword; } export interface ImportExpression extends PrimaryExpression { kind: SyntaxKind.ImportKeyword; } export interface DeleteExpression extends UnaryExpression { kind: SyntaxKind.DeleteExpression; expression: UnaryExpression; } export interface TypeOfExpression extends UnaryExpression { kind: SyntaxKind.TypeOfExpression; expression: UnaryExpression; } export interface VoidExpression extends UnaryExpression { kind: SyntaxKind.VoidExpression; expression: UnaryExpression; } export interface AwaitExpression extends UnaryExpression { kind: SyntaxKind.AwaitExpression; expression: UnaryExpression; } export interface YieldExpression extends Expression { kind: SyntaxKind.YieldExpression; asteriskToken?: AsteriskToken; expression?: Expression; } export interface SyntheticExpression extends Expression { kind: SyntaxKind.SyntheticExpression; isSpread: boolean; type: Type; } export type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; export type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; export type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator; export type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken; export type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator; export type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken; export type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator; export type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword; export type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator; export type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken; export type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator; export type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken; export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; export type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; export 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; export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; export type AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator; export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; export type BinaryOperatorToken = Token<BinaryOperator>; export interface BinaryExpression extends Expression, Declaration { kind: SyntaxKind.BinaryExpression; left: Expression; operatorToken: BinaryOperatorToken; right: Expression; } export type AssignmentOperatorToken = Token<AssignmentOperator>; export interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression { left: LeftHandSideExpression; operatorToken: TOperator; } export interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> { left: ObjectLiteralExpression; } export interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> { left: ArrayLiteralExpression; } export type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; export type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression; export type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment; export type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Identifier | PropertyAccessExpression | ElementAccessExpression | OmittedExpression; export type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression; export type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression; export type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; export type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; export interface ConditionalExpression extends Expression { kind: SyntaxKind.ConditionalExpression; condition: Expression; questionToken: QuestionToken; whenTrue: Expression; colonToken: ColonToken; whenFalse: Expression; } export type FunctionBody = Block; export type ConciseBody = FunctionBody | Expression; export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclarationBase, JSDocContainer { kind: SyntaxKind.FunctionExpression; name?: Identifier; body: FunctionBody; } export interface ArrowFunction extends Expression, FunctionLikeDeclarationBase, JSDocContainer { kind: SyntaxKind.ArrowFunction; equalsGreaterThanToken: EqualsGreaterThanToken; body: ConciseBody; name: never; } export interface LiteralLikeNode extends Node { text: string; isUnterminated?: boolean; hasExtendedUnicodeEscape?: boolean; } export interface TemplateLiteralLikeNode extends LiteralLikeNode { rawText?: string; } export interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { _literalExpressionBrand: any; } export interface RegularExpressionLiteral extends LiteralExpression { kind: SyntaxKind.RegularExpressionLiteral; } export interface NoSubstitutionTemplateLiteral extends LiteralExpression, TemplateLiteralLikeNode, Declaration { kind: SyntaxKind.NoSubstitutionTemplateLiteral; } export enum TokenFlags { None = 0, Scientific = 16, Octal = 32, HexSpecifier = 64, BinarySpecifier = 128, OctalSpecifier = 256, } export interface NumericLiteral extends LiteralExpression, Declaration { kind: SyntaxKind.NumericLiteral; } export interface BigIntLiteral extends LiteralExpression { kind: SyntaxKind.BigIntLiteral; } export interface TemplateHead extends TemplateLiteralLikeNode { kind: SyntaxKind.TemplateHead; parent: TemplateExpression; } export interface TemplateMiddle extends TemplateLiteralLikeNode { kind: SyntaxKind.TemplateMiddle; parent: TemplateSpan; } export interface TemplateTail extends TemplateLiteralLikeNode { kind: SyntaxKind.TemplateTail; parent: TemplateSpan; } export type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; export interface TemplateExpression extends PrimaryExpression { kind: SyntaxKind.TemplateExpression; head: TemplateHead; templateSpans: NodeArray<TemplateSpan>; } export interface TemplateSpan extends Node { kind: SyntaxKind.TemplateSpan; parent: TemplateExpression; expression: Expression; literal: TemplateMiddle | TemplateTail; } export interface ParenthesizedExpression extends PrimaryExpression, JSDocContainer { kind: SyntaxKind.ParenthesizedExpression; expression: Expression; } export interface ArrayLiteralExpression extends PrimaryExpression { kind: SyntaxKind.ArrayLiteralExpression; elements: NodeArray<Expression>; } export interface SpreadElement extends Expression { kind: SyntaxKind.SpreadElement; parent: ArrayLiteralExpression | CallExpression | NewExpression; expression: Expression; } /** * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) */ export interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration { properties: NodeArray<T>; } export interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> { kind: SyntaxKind.ObjectLiteralExpression; } export type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; export type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; export interface PropertyAccessExpression extends MemberExpression, NamedDeclaration { kind: SyntaxKind.PropertyAccessExpression; expression: LeftHandSideExpression; questionDotToken?: QuestionDotToken; name: Identifier; } export interface PropertyAccessChain extends PropertyAccessExpression { _optionalChainBrand: any; } export interface SuperPropertyAccessExpression extends PropertyAccessExpression { expression: SuperExpression; } /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */ export interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { _propertyAccessExpressionLikeQualifiedNameBrand?: any; expression: EntityNameExpression; } export interface ElementAccessExpression extends MemberExpression { kind: SyntaxKind.ElementAccessExpression; expression: LeftHandSideExpression; questionDotToken?: QuestionDotToken; argumentExpression: Expression; } export interface ElementAccessChain extends ElementAccessExpression { _optionalChainBrand: any; } export interface SuperElementAccessExpression extends ElementAccessExpression { expression: SuperExpression; } export type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression; export interface CallExpression extends LeftHandSideExpression, Declaration { kind: SyntaxKind.CallExpression; expression: LeftHandSideExpression; questionDotToken?