@tsd/typescript
Version:
TypeScript with some extras for type-checking.
1,031 lines (1,028 loc) • 514 kB
TypeScript
/*! *****************************************************************************
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 = "4.9";
/** The version of the TypeScript compiler release */
const version: string;
/**
* 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;
}
/** Common read methods for ES6 Map/Set. */
interface ReadonlyCollection<K> {
readonly size: number;
has(key: K): boolean;
keys(): Iterator<K>;
}
/** Common write methods for ES6 Map/Set. */
interface Collection<K> extends ReadonlyCollection<K> {
delete(key: K): boolean;
clear(): void;
}
/** ES6 Map interface, only read methods included. */
interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
get(key: K): V | undefined;
values(): Iterator<V>;
entries(): Iterator<[K, V]>;
forEach(action: (value: V, key: K) => void): void;
}
/**
* ES6 Map interface, only read methods included.
*/
interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
}
/** ES6 Map interface. */
interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
set(key: K, value: V): this;
}
/**
* ES6 Map interface.
*/
interface Map<T> extends ESMap<string, T> {
}
/** ES6 Set interface, only read methods included. */
interface ReadonlySet<T> extends ReadonlyCollection<T> {
has(value: T): boolean;
values(): Iterator<T>;
entries(): Iterator<[T, T]>;
forEach(action: (value: T, key: T) => void): void;
}
/** ES6 Set interface. */
interface Set<T> extends ReadonlySet<T>, Collection<T> {
add(value: T): this;
delete(value: T): boolean;
}
/** ES6 Iterator type. */
interface Iterator<T> {
next(): {
value: T;
done?: false;
} | {
value: void;
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 interface ReadonlyTextRange {
readonly pos: number;
readonly end: number;
}
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,
/** Only the JSDoc scanner produces HashToken. The normal scanner produces PrivateIdentifier. */
HashToken = 62,
EqualsToken = 63,
PlusEqualsToken = 64,
MinusEqualsToken = 65,
AsteriskEqualsToken = 66,
AsteriskAsteriskEqualsToken = 67,
SlashEqualsToken = 68,
PercentEqualsToken = 69,
LessThanLessThanEqualsToken = 70,
GreaterThanGreaterThanEqualsToken = 71,
GreaterThanGreaterThanGreaterThanEqualsToken = 72,
AmpersandEqualsToken = 73,
BarEqualsToken = 74,
BarBarEqualsToken = 75,
AmpersandAmpersandEqualsToken = 76,
QuestionQuestionEqualsToken = 77,
CaretEqualsToken = 78,
Identifier = 79,
PrivateIdentifier = 80,
BreakKeyword = 81,
CaseKeyword = 82,
CatchKeyword = 83,
ClassKeyword = 84,
ConstKeyword = 85,
ContinueKeyword = 86,
DebuggerKeyword = 87,
DefaultKeyword = 88,
DeleteKeyword = 89,
DoKeyword = 90,
ElseKeyword = 91,
EnumKeyword = 92,
ExportKeyword = 93,
ExtendsKeyword = 94,
FalseKeyword = 95,
FinallyKeyword = 96,
ForKeyword = 97,
FunctionKeyword = 98,
IfKeyword = 99,
ImportKeyword = 100,
InKeyword = 101,
InstanceOfKeyword = 102,
NewKeyword = 103,
NullKeyword = 104,
ReturnKeyword = 105,
SuperKeyword = 106,
SwitchKeyword = 107,
ThisKeyword = 108,
ThrowKeyword = 109,
TrueKeyword = 110,
TryKeyword = 111,
TypeOfKeyword = 112,
VarKeyword = 113,
VoidKeyword = 114,
WhileKeyword = 115,
WithKeyword = 116,
ImplementsKeyword = 117,
InterfaceKeyword = 118,
LetKeyword = 119,
PackageKeyword = 120,
PrivateKeyword = 121,
ProtectedKeyword = 122,
PublicKeyword = 123,
StaticKeyword = 124,
YieldKeyword = 125,
AbstractKeyword = 126,
AccessorKeyword = 127,
AsKeyword = 128,
AssertsKeyword = 129,
AssertKeyword = 130,
AnyKeyword = 131,
AsyncKeyword = 132,
AwaitKeyword = 133,
BooleanKeyword = 134,
ConstructorKeyword = 135,
DeclareKeyword = 136,
GetKeyword = 137,
InferKeyword = 138,
IntrinsicKeyword = 139,
IsKeyword = 140,
KeyOfKeyword = 141,
ModuleKeyword = 142,
NamespaceKeyword = 143,
NeverKeyword = 144,
OutKeyword = 145,
ReadonlyKeyword = 146,
RequireKeyword = 147,
NumberKeyword = 148,
ObjectKeyword = 149,
SatisfiesKeyword = 150,
SetKeyword = 151,
StringKeyword = 152,
SymbolKeyword = 153,
TypeKeyword = 154,
UndefinedKeyword = 155,
UniqueKeyword = 156,
UnknownKeyword = 157,
FromKeyword = 158,
GlobalKeyword = 159,
BigIntKeyword = 160,
OverrideKeyword = 161,
OfKeyword = 162,
QualifiedName = 163,
ComputedPropertyName = 164,
TypeParameter = 165,
Parameter = 166,
Decorator = 167,
PropertySignature = 168,
PropertyDeclaration = 169,
MethodSignature = 170,
MethodDeclaration = 171,
ClassStaticBlockDeclaration = 172,
Constructor = 173,
GetAccessor = 174,
SetAccessor = 175,
CallSignature = 176,
ConstructSignature = 177,
IndexSignature = 178,
TypePredicate = 179,
TypeReference = 180,
FunctionType = 181,
ConstructorType = 182,
TypeQuery = 183,
TypeLiteral = 184,
ArrayType = 185,
TupleType = 186,
OptionalType = 187,
RestType = 188,
UnionType = 189,
IntersectionType = 190,
ConditionalType = 191,
InferType = 192,
ParenthesizedType = 193,
ThisType = 194,
TypeOperator = 195,
IndexedAccessType = 196,
MappedType = 197,
LiteralType = 198,
NamedTupleMember = 199,
TemplateLiteralType = 200,
TemplateLiteralTypeSpan = 201,
ImportType = 202,
ObjectBindingPattern = 203,
ArrayBindingPattern = 204,
BindingElement = 205,
ArrayLiteralExpression = 206,
ObjectLiteralExpression = 207,
PropertyAccessExpression = 208,
ElementAccessExpression = 209,
CallExpression = 210,
NewExpression = 211,
TaggedTemplateExpression = 212,
TypeAssertionExpression = 213,
ParenthesizedExpression = 214,
FunctionExpression = 215,
ArrowFunction = 216,
DeleteExpression = 217,
TypeOfExpression = 218,
VoidExpression = 219,
AwaitExpression = 220,
PrefixUnaryExpression = 221,
PostfixUnaryExpression = 222,
BinaryExpression = 223,
ConditionalExpression = 224,
TemplateExpression = 225,
YieldExpression = 226,
SpreadElement = 227,
ClassExpression = 228,
OmittedExpression = 229,
ExpressionWithTypeArguments = 230,
AsExpression = 231,
NonNullExpression = 232,
MetaProperty = 233,
SyntheticExpression = 234,
SatisfiesExpression = 235,
TemplateSpan = 236,
SemicolonClassElement = 237,
Block = 238,
EmptyStatement = 239,
VariableStatement = 240,
ExpressionStatement = 241,
IfStatement = 242,
DoStatement = 243,
WhileStatement = 244,
ForStatement = 245,
ForInStatement = 246,
ForOfStatement = 247,
ContinueStatement = 248,
BreakStatement = 249,
ReturnStatement = 250,
WithStatement = 251,
SwitchStatement = 252,
LabeledStatement = 253,
ThrowStatement = 254,
TryStatement = 255,
DebuggerStatement = 256,
VariableDeclaration = 257,
VariableDeclarationList = 258,
FunctionDeclaration = 259,
ClassDeclaration = 260,
InterfaceDeclaration = 261,
TypeAliasDeclaration = 262,
EnumDeclaration = 263,
ModuleDeclaration = 264,
ModuleBlock = 265,
CaseBlock = 266,
NamespaceExportDeclaration = 267,
ImportEqualsDeclaration = 268,
ImportDeclaration = 269,
ImportClause = 270,
NamespaceImport = 271,
NamedImports = 272,
ImportSpecifier = 273,
ExportAssignment = 274,
ExportDeclaration = 275,
NamedExports = 276,
NamespaceExport = 277,
ExportSpecifier = 278,
MissingDeclaration = 279,
ExternalModuleReference = 280,
JsxElement = 281,
JsxSelfClosingElement = 282,
JsxOpeningElement = 283,
JsxClosingElement = 284,
JsxFragment = 285,
JsxOpeningFragment = 286,
JsxClosingFragment = 287,
JsxAttribute = 288,
JsxAttributes = 289,
JsxSpreadAttribute = 290,
JsxExpression = 291,
CaseClause = 292,
DefaultClause = 293,
HeritageClause = 294,
CatchClause = 295,
AssertClause = 296,
AssertEntry = 297,
ImportTypeAssertionContainer = 298,
PropertyAssignment = 299,
ShorthandPropertyAssignment = 300,
SpreadAssignment = 301,
EnumMember = 302,
UnparsedPrologue = 303,
UnparsedPrepend = 304,
UnparsedText = 305,
UnparsedInternalText = 306,
UnparsedSyntheticReference = 307,
SourceFile = 308,
Bundle = 309,
UnparsedSource = 310,
InputFiles = 311,
JSDocTypeExpression = 312,
JSDocNameReference = 313,
JSDocMemberName = 314,
JSDocAllType = 315,
JSDocUnknownType = 316,
JSDocNullableType = 317,
JSDocNonNullableType = 318,
JSDocOptionalType = 319,
JSDocFunctionType = 320,
JSDocVariadicType = 321,
JSDocNamepathType = 322,
JSDoc = 323,
/** @deprecated Use SyntaxKind.JSDoc */
JSDocComment = 323,
JSDocText = 324,
JSDocTypeLiteral = 325,
JSDocSignature = 326,
JSDocLink = 327,
JSDocLinkCode = 328,
JSDocLinkPlain = 329,
JSDocTag = 330,
JSDocAugmentsTag = 331,
JSDocImplementsTag = 332,
JSDocAuthorTag = 333,
JSDocDeprecatedTag = 334,
JSDocClassTag = 335,
JSDocPublicTag = 336,
JSDocPrivateTag = 337,
JSDocProtectedTag = 338,
JSDocReadonlyTag = 339,
JSDocOverrideTag = 340,
JSDocCallbackTag = 341,
JSDocEnumTag = 342,
JSDocParameterTag = 343,
JSDocReturnTag = 344,
JSDocThisTag = 345,
JSDocTypeTag = 346,
JSDocTemplateTag = 347,
JSDocTypedefTag = 348,
JSDocSeeTag = 349,
JSDocPropertyTag = 350,
SyntaxList = 351,
NotEmittedStatement = 352,
PartiallyEmittedExpression = 353,
CommaListExpression = 354,
MergeDeclarationMarker = 355,
EndOfDeclarationMarker = 356,
SyntheticReferenceExpression = 357,
Count = 358,
FirstAssignment = 63,
LastAssignment = 78,
FirstCompoundAssignment = 64,
LastCompoundAssignment = 78,
FirstReservedWord = 81,
LastReservedWord = 116,
FirstKeyword = 81,
LastKeyword = 162,
FirstFutureReservedWord = 117,
LastFutureReservedWord = 125,
FirstTypeNode = 179,
LastTypeNode = 202,
FirstPunctuation = 18,
LastPunctuation = 78,
FirstToken = 0,
LastToken = 162,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
LastLiteralToken = 14,
FirstTemplateToken = 14,
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 78,
FirstStatement = 240,
LastStatement = 256,
FirstNode = 163,
FirstJSDocNode = 312,
LastJSDocNode = 350,
FirstJSDocTagNode = 330,
LastJSDocTagNode = 350,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail;
export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | 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.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | 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;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | 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.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | 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;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword;
export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
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.HashToken | SyntaxKind.Unknown | KeywordSyntaxKind;
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,
DisallowConditionalTypesContext = 65536,
ThisNodeHasError = 131072,
JavaScriptFile = 262144,
ThisNodeOrAnySubNodesHasError = 524288,
HasAggregatedChildData = 1048576,
JSDoc = 8388608,
JsonFile = 67108864,
BlockScoped = 3,
ReachabilityCheckFlags = 768,
ReachabilityAndEmitFlags = 2816,
ContextFlags = 50720768,
TypeExcludesFlags = 40960,
}
export enum ModifierFlags {
None = 0,
Export = 1,
Ambient = 2,
Public = 4,
Private = 8,
Protected = 16,
Static = 32,
Readonly = 64,
Accessor = 128,
Abstract = 256,
Async = 512,
Default = 1024,
Const = 2048,
HasComputedJSDocModifiers = 4096,
Deprecated = 8192,
Override = 16384,
In = 32768,
Out = 65536,
Decorator = 131072,
HasComputedFlags = 536870912,
AccessibilityModifier = 28,
ParameterPropertyModifier = 16476,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 117086,
ExportDefault = 1025,
All = 258047,
Modifier = 126975
}
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 ReadonlyTextRange {
readonly kind: SyntaxKind;
readonly flags: NodeFlags;
readonly parent: Node;
}
export interface JSDocContainer {
}
export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ClassStaticBlockDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | EmptyStatement | DebuggerStatement | Block | VariableStatement | ExpressionStatement | IfStatement | DoStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | BreakStatement | ContinueStatement | ReturnStatement | WithStatement | SwitchStatement | LabeledStatement | ThrowStatement | TryStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | VariableDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | ImportDeclaration | NamespaceExportDeclaration | ExportAssignment | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | NamedTupleMember | ExportSpecifier | CaseClause | EndOfFileToken;
export type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
export type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
export type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
export type HasExpressionInitializer = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertyAssignment | EnumMember;
export type HasDecorators = ParameterDeclaration | PropertyDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ClassExpression | ClassDeclaration;
export type HasModifiers = TypeParameterDeclaration | ParameterDeclaration | ConstructorTypeNode | PropertySignature | PropertyDeclaration | MethodSignature | MethodDeclaration | ConstructorDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | IndexSignatureDeclaration | FunctionExpression | ArrowFunction | ClassExpression | VariableStatement | FunctionDeclaration | ClassDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | ImportDeclaration | ExportAssignment | ExportDeclaration;
export interface NodeArray<T extends Node> extends ReadonlyArray<T>, ReadonlyTextRange {
readonly hasTrailingComma: boolean;
}
export interface Token<TKind extends SyntaxKind> extends Node {
readonly kind: TKind;
}
export type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & JSDocContainer;
export interface PunctuationToken<TKind extends PunctuationSyntaxKind> extends Token<TKind> {
}
export type DotToken = PunctuationToken<SyntaxKind.DotToken>;
export type DotDotDotToken = PunctuationToken<SyntaxKind.DotDotDotToken>;
export type QuestionToken = PunctuationToken<SyntaxKind.QuestionToken>;
export type ExclamationToken = PunctuationToken<SyntaxKind.ExclamationToken>;
export type ColonToken = PunctuationToken<SyntaxKind.ColonToken>;
export type EqualsToken = PunctuationToken<SyntaxKind.EqualsToken>;
export type AsteriskToken = PunctuationToken<SyntaxKind.AsteriskToken>;
export type EqualsGreaterThanToken = PunctuationToken<SyntaxKind.EqualsGreaterThanToken>;
export type PlusToken = PunctuationToken<SyntaxKind.PlusToken>;
export type MinusToken = PunctuationToken<SyntaxKind.MinusToken>;
export type QuestionDotToken = PunctuationToken<SyntaxKind.QuestionDotToken>;
export interface KeywordToken<TKind extends KeywordSyntaxKind> extends Token<TKind> {
}
export type AssertsKeyword = KeywordToken<SyntaxKind.AssertsKeyword>;
export type AssertKeyword = KeywordToken<SyntaxKind.AssertKeyword>;
export type AwaitKeyword = KeywordToken<SyntaxKind.AwaitKeyword>;
/** @deprecated Use `AwaitKeyword` instead. */
export type AwaitKeywordToken = AwaitKeyword;
/** @deprecated Use `AssertsKeyword` instead. */
export type AssertsToken = AssertsKeyword;
export interface ModifierToken<TKind extends ModifierSyntaxKind> extends KeywordToken<TKind> {
}
export type AbstractKeyword = ModifierToken<SyntaxKind.AbstractKeyword>;
export type AccessorKeyword = ModifierToken<SyntaxKind.AccessorKeyword>;
export type AsyncKeyword = ModifierToken<SyntaxKind.AsyncKeyword>;
export type ConstKeyword = ModifierToken<SyntaxKind.ConstKeyword>;
export type DeclareKeyword = ModifierToken<SyntaxKind.DeclareKeyword>;
export type DefaultKeyword = ModifierToken<SyntaxKind.DefaultKeyword>;
export type ExportKeyword = ModifierToken<SyntaxKind.ExportKeyword>;
export type InKeyword = ModifierToken<SyntaxKind.InKeyword>;
export type PrivateKeyword = ModifierToken<SyntaxKind.PrivateKeyword>;
export type ProtectedKeyword = ModifierToken<SyntaxKind.ProtectedKeyword>;
export type PublicKeyword = ModifierToken<SyntaxKind.PublicKeyword>;
export type ReadonlyKeyword = ModifierToken<SyntaxKind.ReadonlyKeyword>;
export type OutKeyword = ModifierToken<SyntaxKind.OutKeyword>;
export type OverrideKeyword = ModifierToken<SyntaxKind.OverrideKeyword>;
export type StaticKeyword = ModifierToken<SyntaxKind.StaticKeyword>;
/** @deprecated Use `ReadonlyKeyword` instead. */
export type ReadonlyToken = ReadonlyKeyword;
export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword;
export type ModifierLike = Modifier | Decorator;
export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword;
export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword;
export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword;
export type ModifiersArray = NodeArray<Modifier>;
export enum GeneratedIdentifierFlags {
None = 0,
ReservedInNestedScopes = 8,
Optimistic = 16,
FileLevel = 32,
AllowNameSubstitution = 64
}
export interface Identifier extends PrimaryExpression, Declaration {
readonly 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.
*/
readonly escapedText: __String;
readonly originalKeywordKind?: SyntaxKind;
isInJSDocNamespace?: boolean;
}
export interface TransientIdentifier extends Identifier {
resolvedSymbol: Symbol;
}
export interface QualifiedName extends Node {
readonly kind: SyntaxKind.QualifiedName;
readonly left: EntityName;
readonly right: Identifier;
}
export type EntityName = Identifier | QualifiedName;
export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
export type MemberName = Identifier | PrivateIdentifier;
export type DeclarationName = Identifier | PrivateIdentifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern | EntityNameExpression;
export interface Declaration extends Node {
_declarationBrand: any;
}
export interface NamedDeclaration extends Declaration {
readonly name?: DeclarationName;
}
export interface DeclarationStatement extends NamedDeclaration, Statement {
readonly name?: Identifier | StringLiteral | NumericLiteral;
}
export interface ComputedPropertyName extends Node {
readonly kind: SyntaxKind.ComputedPropertyName;
readonly parent: Declaration;
readonly expression: Expression;
}
export interface PrivateIdentifier extends PrimaryExpression {
readonly kind: SyntaxKind.PrivateIdentifier;
readonly escapedText: __String;
}
export interface Decorator extends Node {
readonly kind: SyntaxKind.Decorator;
readonly parent: NamedDeclaration;
readonly expression: LeftHandSideExpression;
}
export interface TypeParameterDeclaration extends NamedDeclaration {
readonly kind: SyntaxKind.TypeParameter;
readonly parent: DeclarationWithTypeParameterChildren | InferTypeNode;
readonly modifiers?: NodeArray<Modifier>;
readonly name: Identifier;
/** Note: Consider calling `getEffectiveConstraintOfTypeParameter` */
readonly constraint?: TypeNode;
readonly default?: TypeNode;
expression?: Expression;
}
export interface SignatureDeclarationBase extends NamedDeclaration, JSDocContainer {
readonly kind: SignatureDeclaration["kind"];
readonly name?: PropertyName;
readonly typeParameters?: NodeArray<TypeParameterDeclaration> | undefined;
readonly parameters: NodeArray<ParameterDeclaration>;
readonly type?: TypeNode | undefined;
}
export type SignatureDeclaration = CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction;
export interface CallSignatureDeclaration extends SignatureDeclarationBase, TypeElement {
readonly kind: SyntaxKind.CallSignature;
}
export interface ConstructSignatureDeclaration extends SignatureDeclarationBase, TypeElement {
readonly kind: SyntaxKind.ConstructSignature;
}
export type BindingName = Identifier | BindingPattern;
export interface VariableDeclaration extends NamedDeclaration, JSDocContainer {
readonly kind: SyntaxKind.VariableDeclaration;
readonly parent: VariableDeclarationList | CatchClause;
readonly name: BindingName;
readonly exclamationToken?: ExclamationToken;
readonly type?: TypeNode;
readonly initializer?: Expression;
}
export interface VariableDeclarationList extends Node {
readonly kind: SyntaxKind.VariableDeclarationList;
readonly parent: VariableStatement | ForStatement | ForOfStatement | ForInStatement;
readonly declarations: NodeArray<VariableDeclaration>;
}
export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer {
readonly kind: SyntaxKind.Parameter;
readonly parent: SignatureDeclaration;
readonly modifiers?: NodeArray<ModifierLike>;
readonly dotDotDotToken?: DotDotDotToken;
readonly name: BindingName;
readonly questionToken?: QuestionToken;
readonly type?: TypeNode;
readonly initializer?: Expression;
}
export interface BindingElement extends NamedDeclaration {
readonly kind: SyntaxKind.BindingElement;
readonly parent: BindingPattern;
readonly propertyName?: PropertyName;
readonly dotDotDotToken?: DotDotDotToken;
readonly name: BindingName;
readonly initializer?: Expression;
}
export interface PropertySignature extends TypeElement, JSDocContainer {
readonly kind: SyntaxKind.PropertySignature;
readonly modifiers?: NodeArray<Modifier>;
readonly name: PropertyName;
readonly questionToken?: QuestionToken;
readonly type?: TypeNode;
}
export interface PropertyDeclaration extends ClassElement, JSDocContainer {
readonly kind: SyntaxKind.PropertyDeclaration;
readonly parent: ClassLikeDeclaration;
readonly modifiers?: NodeArray<ModifierLike>;
readonly name: PropertyName;
readonly questionToken?: QuestionToken;
readonly exclamationToken?: ExclamationToken;
readonly type?: TypeNode;
readonly initializer?: Expression;
}
export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration {
_autoAccessorBrand: any;
}
export interface ObjectLiteralElement extends NamedDeclaration {
_objectLiteralBrand: any;
readonly name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
export type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer {
readonly kind: SyntaxKind.PropertyAssignment;
readonly parent: ObjectLiteralExpression;
readonly name: PropertyName;
readonly initializer: Expression;
}
export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer {
readonly kind: SyntaxKind.ShorthandPropertyAssignment;
readonly parent: ObjectLiteralExpression;
readonly name: Identifier;
readonly equalsToken?: EqualsToken;
readonly objectAssignmentInitializer?: Expression;
}
export interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer {
readonly kind: SyntaxKind.SpreadAssignment;
readonly parent: ObjectLiteralExpression;
readonly expression: Expression;
}
export type VariableLikeDeclaration = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertyAssignment | PropertySignature | JsxAttribute | ShorthandPropertyAssignment | EnumMember | JSDocPropertyTag | JSDocParameterTag;
export interface PropertyLikeDeclaration extends NamedDeclaration {
readonly name: PropertyName;
}
export interface ObjectBindingPattern extends Node {
readonly kind: SyntaxKind.ObjectBindingPattern;
readonly parent: VariableDeclaration | ParameterDeclaration | BindingElement;
readonly elements: NodeArray<BindingElement>;
}
export interface ArrayBindingPattern extends Node {
readonly kind: SyntaxKind.ArrayBindingPattern;
readonly parent: VariableDeclaration | ParameterDeclaration | BindingElement;
readonly 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;
readonly asteriskToken?: AsteriskToken | undefined;
readonly questionToken?: QuestionToken | undefined;
readonly exclamationToken?: ExclamationToken | undefined;
readonly body?: Block | Expression | undefined;
}
export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
/** @deprecated Use SignatureDeclaration */
export type FunctionLike = SignatureDeclaration;
export interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement {
readonly kind: SyntaxKind.FunctionDeclaration;
readonly modifiers?: NodeArray<Modifier>;
readonly name?: Identifier;
readonly body?: FunctionBody;
}
export interface MethodSignature extends SignatureDeclarationBase, TypeElement {
readonly kind: SyntaxKind.MethodSignature;
readonly parent: ObjectTypeDeclaration;
readonly modifiers?: NodeArray<Modifier>;
readonly name: PropertyName;
}
export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
readonly kind: SyntaxKind.MethodDeclaration;
readonly parent: ClassLikeDeclaration | ObjectLiteralExpression;
readonly modifiers?: NodeArray<ModifierLike> | undefined;
readonly name: PropertyName;
readonly body?: FunctionBody | undefined;
}
export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer {
readonly kind: SyntaxKind.Constructor;
readonly parent: ClassLikeDeclaration;
readonly modifiers?: NodeArray<Modifier> | undefined;
readonly body?: FunctionBody | undefined;
}
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
export interface SemicolonClassElement extends ClassElement {
readonly kind: SyntaxKind.SemicolonClassElement;
readonly parent: ClassLikeDeclaration;
}
export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer {
readonly kind: SyntaxKind.GetAccessor;
readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration;
readonly modifiers?: NodeArray<ModifierLike>;
readonly name: PropertyName;
readonly body?: FunctionBody;
}
export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer {
readonly kind: SyntaxKind.SetAccessor;
readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration;
readonly modifiers?: NodeArray<ModifierLike>;
readonly name: PropertyName;
readonly body?: FunctionBody;
}
export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement {
readonly kind: SyntaxKind.IndexSignature;
readonly parent: ObjectTypeDeclaration;
readonly modifiers?: NodeArray<Modifier>;
readonly type: TypeNode;
}
export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer {
readonly kind: SyntaxKind.ClassStaticBlockDeclaration;
readonly parent: ClassDeclaration | ClassExpression;
readonly body: Block;
}
export interface TypeNode extends Node {
_typeNodeBrand: any;
}
export interface KeywordTypeNode<TKind extends KeywordTypeSyntaxKind = KeywordTypeSyntaxKind> extends KeywordToken<TKind>, TypeNode {
readonly kind: TKind;
}
export interface ImportTypeAssertionContainer extends Node {
readonly kind: SyntaxKind.ImportTypeAssertionContainer;
readonly parent: ImportTypeNode;
readonly assertClause: AssertClause;
readonly multiLine?: boolean;
}
export interface ImportTypeNode extends NodeWithTypeArguments {
readonly kind: SyntaxKind.ImportType;
readonly isTypeOf: boolean;
readonly argument: TypeNode;
readonly assertions?: ImportTypeAssertionContainer;
readonly qualifier?: EntityName;
}
export interface ThisTypeNode extends TypeNode {
readonly kind: SyntaxKind.ThisType;
}
export type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode;
export interface FunctionOrConstructorTypeNodeBase extends TypeNode, SignatureDeclarationBase {
readonly kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType;
readonly type: TypeNode;
}
export interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase {
readonly kind: SyntaxKind.FunctionType;
}
export interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase {
readonly kind: SyntaxKind.ConstructorType;
readonly modifiers?: NodeArray<Modifier>;
}
export interface NodeWithTypeArguments extends TypeNode {
readonly typeArguments?: NodeArray<TypeNode>;
}
export type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments;
export interface TypeReferenceNode extends NodeWithTypeArguments {
readonly kind: SyntaxKind.TypeReference;
readonly typeName: EntityName;
}
export interface TypePredicateNode extends TypeNode {
readonly kind: SyntaxKind.TypePredicate;
readonly parent: SignatureDeclaration | JSDocTypeExpression;
readonly assertsModifier?: AssertsKeyword;
readonly parameterName: Identifier | ThisTypeNode;
readonly type?: TypeNode;
}
export interface TypeQueryNode extends NodeWithTypeArguments {
readonly kind: SyntaxKind.TypeQuery;
readonly exprName: EntityName;
}
export interface TypeLiteralNode extends TypeNode, Declaration {
readonly kind: SyntaxKind.TypeLiteral;
readonly members: NodeArray<TypeElement>;
}
export interface ArrayTypeNode extends TypeNode {
readonly kind: SyntaxKind.ArrayType;
readonly elementType: TypeNode;
}
export interface TupleTypeNode extends TypeNode {
readonly kind: SyntaxKind.TupleType;
readonly elements: NodeArray<TypeNode | NamedTupleMember>;
}
export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration {
readonly kind: SyntaxKind.NamedTupleMember;
readonly dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
readonly name: Identifier;
readonly questionToken?: Token<SyntaxKind.QuestionToken>;
readonly type: TypeNode;
}
export interface OptionalTypeNode extends TypeNode {
readonly kind: SyntaxKind.OptionalType;
readonly type: TypeNode;
}
export interface RestTypeNode extends TypeNode {
readonly kind: SyntaxKind.RestType;
readonly type: TypeNode;
}
export type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode;
export interface UnionTypeNode extends TypeNode {
readonly kind: SyntaxKind.UnionType;
readonly types: NodeArray<TypeNode>;
}
export interface IntersectionTypeNode extends TypeNode {
readonly kind: SyntaxKind.IntersectionType;
readonly types: NodeArray<TypeNode>;
}
export interface ConditionalTypeNode extends TypeNode {
readonly kind: SyntaxKind.ConditionalType;
readonly checkType: TypeNode;
readonly extendsType: TypeNode;
readonly trueType: TypeNode;
readonly falseType: TypeNode;
}
export interface InferTypeNode extends TypeNode {
readonly kind: SyntaxKind.InferType;
readonly typeParameter: TypeParameterDeclaration;
}
export interface ParenthesizedTypeNode extends TypeNode {
readonly kind: SyntaxKind.ParenthesizedType;
readonly type: TypeNode;
}
export interface TypeOperatorNode extends TypeNode {
readonly kind: SyntaxKind.TypeOperator;
readonly operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword;
readonly type: TypeNode;
}
export interface IndexedAccessTypeNode extends TypeNode {
readonly kind: SyntaxKind.IndexedAccessType;
readonly objectType: TypeNode;
readonly indexType: TypeNode;
}
export interface MappedTypeNode extends TypeNode, Declaration {
readonly kind: SyntaxKind.MappedType;
readonly readonlyToken?: ReadonlyKeyword | PlusToken | MinusToken;
readonly typeParameter: TypeParameterDeclaration;
readonly nameType?: TypeNode;
readonly questionToken?: QuestionToken | PlusToken | MinusToken;
readonly type?: TypeNode;
/** Used only to produce grammar errors */
readonly members?: NodeArray<TypeElement>;
}
export interface LiteralTypeNode extends TypeNode {
readonly kind: SyntaxKind.LiteralType;
readonly literal: NullLiteral | BooleanLiteral | LiteralExpression | PrefixUnaryExpression;
}
export interface StringLiteral extends LiteralExpression, Declaration {
readonly kind: SyntaxKind.StringLiteral;
}
export type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
export type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral;
export interface TemplateLiteralTypeNode extends TypeNode {
kind: SyntaxKind.TemplateLiteralType;
readonly head: TemplateHead;
readonly templateSpans: NodeArray<TemplateLiteralTypeSpan>;
}
export interface TemplateLiteralTypeSpan extends TypeNode {
readonly kind: SyntaxKind.TemplateLiteralTypeSpan;
readonly parent: TemplateLiteralTypeNode;
readonly type: TypeNode;
readonly litera