1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
16 declare namespace ts {
17 const versionMajorMinor = "4.2";
18 /** The version of the TypeScript compiler release */
19 const version: string;
21 * Type of objects whose values are all of the same type.
22 * The `in` and `for-in` operators can *not* be safely used,
23 * since `Object.prototype` may be modified by outside code.
25 interface MapLike<T> {
28 interface SortedReadonlyArray<T> extends ReadonlyArray<T> {
29 " __sortedArrayBrand": any;
31 interface SortedArray<T> extends Array<T> {
32 " __sortedArrayBrand": any;
34 /** Common read methods for ES6 Map/Set. */
35 interface ReadonlyCollection<K> {
36 readonly size: number;
40 /** Common write methods for ES6 Map/Set. */
41 interface Collection<K> extends ReadonlyCollection<K> {
42 delete(key: K): boolean;
45 /** ES6 Map interface, only read methods included. */
46 interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
47 get(key: K): V | undefined;
48 values(): Iterator<V>;
49 entries(): Iterator<[K, V]>;
50 forEach(action: (value: V, key: K) => void): void;
53 * ES6 Map interface, only read methods included.
55 interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
57 /** ES6 Map interface. */
58 interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
59 set(key: K, value: V): this;
64 interface Map<T> extends ESMap<string, T> {
66 /** ES6 Set interface, only read methods included. */
67 interface ReadonlySet<T> extends ReadonlyCollection<T> {
68 has(value: T): boolean;
69 values(): Iterator<T>;
70 entries(): Iterator<[T, T]>;
71 forEach(action: (value: T, key: T) => void): void;
73 /** ES6 Set interface. */
74 interface Set<T> extends ReadonlySet<T>, Collection<T> {
76 delete(value: T): boolean;
78 /** ES6 Iterator type. */
79 interface Iterator<T> {
88 /** Array that is only intended to be pushed to, never read. */
90 push(...values: T[]): void;
93 declare namespace ts {
94 export type Path = string & {
97 export interface TextRange {
101 export interface ReadonlyTextRange {
102 readonly pos: number;
103 readonly end: number;
105 export enum SyntaxKind {
108 SingleLineCommentTrivia = 2,
109 MultiLineCommentTrivia = 3,
111 WhitespaceTrivia = 5,
113 ConflictMarkerTrivia = 7,
118 JsxTextAllWhiteSpaces = 12,
119 RegularExpressionLiteral = 13,
120 NoSubstitutionTemplateLiteral = 14,
125 CloseBraceToken = 19,
127 CloseParenToken = 21,
128 OpenBracketToken = 22,
129 CloseBracketToken = 23,
134 QuestionDotToken = 28,
136 LessThanSlashToken = 30,
137 GreaterThanToken = 31,
138 LessThanEqualsToken = 32,
139 GreaterThanEqualsToken = 33,
140 EqualsEqualsToken = 34,
141 ExclamationEqualsToken = 35,
142 EqualsEqualsEqualsToken = 36,
143 ExclamationEqualsEqualsToken = 37,
144 EqualsGreaterThanToken = 38,
148 AsteriskAsteriskToken = 42,
152 MinusMinusToken = 46,
153 LessThanLessThanToken = 47,
154 GreaterThanGreaterThanToken = 48,
155 GreaterThanGreaterThanGreaterThanToken = 49,
159 ExclamationToken = 53,
161 AmpersandAmpersandToken = 55,
166 QuestionQuestionToken = 60,
167 /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
170 PlusEqualsToken = 63,
171 MinusEqualsToken = 64,
172 AsteriskEqualsToken = 65,
173 AsteriskAsteriskEqualsToken = 66,
174 SlashEqualsToken = 67,
175 PercentEqualsToken = 68,
176 LessThanLessThanEqualsToken = 69,
177 GreaterThanGreaterThanEqualsToken = 70,
178 GreaterThanGreaterThanGreaterThanEqualsToken = 71,
179 AmpersandEqualsToken = 72,
181 BarBarEqualsToken = 74,
182 AmpersandAmpersandEqualsToken = 75,
183 QuestionQuestionEqualsToken = 76,
184 CaretEqualsToken = 77,
186 PrivateIdentifier = 79,
192 ContinueKeyword = 85,
193 DebuggerKeyword = 86,
204 FunctionKeyword = 97,
208 InstanceOfKeyword = 101,
223 ImplementsKeyword = 116,
224 InterfaceKeyword = 117,
226 PackageKeyword = 119,
227 PrivateKeyword = 120,
228 ProtectedKeyword = 121,
232 AbstractKeyword = 125,
234 AssertsKeyword = 127,
238 BooleanKeyword = 131,
239 ConstructorKeyword = 132,
240 DeclareKeyword = 133,
243 IntrinsicKeyword = 136,
247 NamespaceKeyword = 140,
249 ReadonlyKeyword = 142,
250 RequireKeyword = 143,
257 UndefinedKeyword = 150,
259 UnknownKeyword = 152,
265 ComputedPropertyName = 158,
269 PropertySignature = 162,
270 PropertyDeclaration = 163,
271 MethodSignature = 164,
272 MethodDeclaration = 165,
277 ConstructSignature = 170,
278 IndexSignature = 171,
282 ConstructorType = 175,
290 IntersectionType = 183,
291 ConditionalType = 184,
293 ParenthesizedType = 186,
296 IndexedAccessType = 189,
299 NamedTupleMember = 192,
300 TemplateLiteralType = 193,
301 TemplateLiteralTypeSpan = 194,
303 ObjectBindingPattern = 196,
304 ArrayBindingPattern = 197,
305 BindingElement = 198,
306 ArrayLiteralExpression = 199,
307 ObjectLiteralExpression = 200,
308 PropertyAccessExpression = 201,
309 ElementAccessExpression = 202,
310 CallExpression = 203,
312 TaggedTemplateExpression = 205,
313 TypeAssertionExpression = 206,
314 ParenthesizedExpression = 207,
315 FunctionExpression = 208,
317 DeleteExpression = 210,
318 TypeOfExpression = 211,
319 VoidExpression = 212,
320 AwaitExpression = 213,
321 PrefixUnaryExpression = 214,
322 PostfixUnaryExpression = 215,
323 BinaryExpression = 216,
324 ConditionalExpression = 217,
325 TemplateExpression = 218,
326 YieldExpression = 219,
328 ClassExpression = 221,
329 OmittedExpression = 222,
330 ExpressionWithTypeArguments = 223,
332 NonNullExpression = 225,
334 SyntheticExpression = 227,
336 SemicolonClassElement = 229,
338 EmptyStatement = 231,
339 VariableStatement = 232,
340 ExpressionStatement = 233,
343 WhileStatement = 236,
345 ForInStatement = 238,
346 ForOfStatement = 239,
347 ContinueStatement = 240,
348 BreakStatement = 241,
349 ReturnStatement = 242,
351 SwitchStatement = 244,
352 LabeledStatement = 245,
353 ThrowStatement = 246,
355 DebuggerStatement = 248,
356 VariableDeclaration = 249,
357 VariableDeclarationList = 250,
358 FunctionDeclaration = 251,
359 ClassDeclaration = 252,
360 InterfaceDeclaration = 253,
361 TypeAliasDeclaration = 254,
362 EnumDeclaration = 255,
363 ModuleDeclaration = 256,
366 NamespaceExportDeclaration = 259,
367 ImportEqualsDeclaration = 260,
368 ImportDeclaration = 261,
370 NamespaceImport = 263,
372 ImportSpecifier = 265,
373 ExportAssignment = 266,
374 ExportDeclaration = 267,
376 NamespaceExport = 269,
377 ExportSpecifier = 270,
378 MissingDeclaration = 271,
379 ExternalModuleReference = 272,
381 JsxSelfClosingElement = 274,
382 JsxOpeningElement = 275,
383 JsxClosingElement = 276,
385 JsxOpeningFragment = 278,
386 JsxClosingFragment = 279,
389 JsxSpreadAttribute = 282,
393 HeritageClause = 286,
395 PropertyAssignment = 288,
396 ShorthandPropertyAssignment = 289,
397 SpreadAssignment = 290,
399 UnparsedPrologue = 292,
400 UnparsedPrepend = 293,
402 UnparsedInternalText = 295,
403 UnparsedSyntheticReference = 296,
406 UnparsedSource = 299,
408 JSDocTypeExpression = 301,
409 JSDocNameReference = 302,
411 JSDocUnknownType = 304,
412 JSDocNullableType = 305,
413 JSDocNonNullableType = 306,
414 JSDocOptionalType = 307,
415 JSDocFunctionType = 308,
416 JSDocVariadicType = 309,
417 JSDocNamepathType = 310,
419 JSDocTypeLiteral = 312,
420 JSDocSignature = 313,
422 JSDocAugmentsTag = 315,
423 JSDocImplementsTag = 316,
424 JSDocAuthorTag = 317,
425 JSDocDeprecatedTag = 318,
427 JSDocPublicTag = 320,
428 JSDocPrivateTag = 321,
429 JSDocProtectedTag = 322,
430 JSDocReadonlyTag = 323,
431 JSDocCallbackTag = 324,
433 JSDocParameterTag = 326,
434 JSDocReturnTag = 327,
437 JSDocTemplateTag = 330,
438 JSDocTypedefTag = 331,
440 JSDocPropertyTag = 333,
442 NotEmittedStatement = 335,
443 PartiallyEmittedExpression = 336,
444 CommaListExpression = 337,
445 MergeDeclarationMarker = 338,
446 EndOfDeclarationMarker = 339,
447 SyntheticReferenceExpression = 340,
449 FirstAssignment = 62,
451 FirstCompoundAssignment = 63,
452 LastCompoundAssignment = 77,
453 FirstReservedWord = 80,
454 LastReservedWord = 115,
457 FirstFutureReservedWord = 116,
458 LastFutureReservedWord = 124,
461 FirstPunctuation = 18,
462 LastPunctuation = 77,
465 FirstTriviaToken = 2,
467 FirstLiteralToken = 8,
468 LastLiteralToken = 14,
469 FirstTemplateToken = 14,
470 LastTemplateToken = 17,
471 FirstBinaryOperator = 29,
472 LastBinaryOperator = 77,
473 FirstStatement = 232,
476 FirstJSDocNode = 301,
478 FirstJSDocTagNode = 314,
479 LastJSDocTagNode = 333,
481 export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
482 export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
483 export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail;
484 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.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;
485 export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | 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.RequireKeyword | 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;
486 export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.StaticKeyword;
487 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;
488 export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
489 export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
490 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;
491 export enum NodeFlags {
501 HasImplicitReturn = 256,
502 HasExplicitReturn = 512,
503 GlobalAugmentation = 1024,
504 HasAsyncFunctions = 2048,
505 DisallowInContext = 4096,
507 DecoratorContext = 16384,
508 AwaitContext = 32768,
509 ThisNodeHasError = 65536,
510 JavaScriptFile = 131072,
511 ThisNodeOrAnySubNodesHasError = 262144,
512 HasAggregatedChildData = 524288,
516 ReachabilityCheckFlags = 768,
517 ReachabilityAndEmitFlags = 2816,
518 ContextFlags = 25358336,
519 TypeExcludesFlags = 40960,
521 export enum ModifierFlags {
534 HasComputedJSDocModifiers = 4096,
536 HasComputedFlags = 536870912,
537 AccessibilityModifier = 28,
538 ParameterPropertyModifier = 92,
539 NonPublicAccessibilityModifier = 24,
540 TypeScriptModifier = 2270,
544 export enum JsxFlags {
546 /** An element from a named property of the JSX.IntrinsicElements interface */
547 IntrinsicNamedElement = 1,
548 /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
549 IntrinsicIndexedElement = 2,
552 export interface Node extends ReadonlyTextRange {
553 readonly kind: SyntaxKind;
554 readonly flags: NodeFlags;
555 readonly decorators?: NodeArray<Decorator>;
556 readonly modifiers?: ModifiersArray;
557 readonly parent: Node;
559 export interface JSDocContainer {
561 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 | ImportDeclaration | NamespaceExportDeclaration | ExportAssignment | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | NamedTupleMember | EndOfFileToken;
562 export type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
563 export type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
564 export type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
565 export type HasExpressionInitializer = VariableDeclaration | ParameterDeclaration | BindingElement | PropertySignature | PropertyDeclaration | PropertyAssignment | EnumMember;
566 export interface NodeArray<T extends Node> extends ReadonlyArray<T>, ReadonlyTextRange {
567 hasTrailingComma?: boolean;
569 export interface Token<TKind extends SyntaxKind> extends Node {
570 readonly kind: TKind;
572 export type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & JSDocContainer;
573 export interface PunctuationToken<TKind extends PunctuationSyntaxKind> extends Token<TKind> {
575 export type DotToken = PunctuationToken<SyntaxKind.DotToken>;
576 export type DotDotDotToken = PunctuationToken<SyntaxKind.DotDotDotToken>;
577 export type QuestionToken = PunctuationToken<SyntaxKind.QuestionToken>;
578 export type ExclamationToken = PunctuationToken<SyntaxKind.ExclamationToken>;
579 export type ColonToken = PunctuationToken<SyntaxKind.ColonToken>;
580 export type EqualsToken = PunctuationToken<SyntaxKind.EqualsToken>;
581 export type AsteriskToken = PunctuationToken<SyntaxKind.AsteriskToken>;
582 export type EqualsGreaterThanToken = PunctuationToken<SyntaxKind.EqualsGreaterThanToken>;
583 export type PlusToken = PunctuationToken<SyntaxKind.PlusToken>;
584 export type MinusToken = PunctuationToken<SyntaxKind.MinusToken>;
585 export type QuestionDotToken = PunctuationToken<SyntaxKind.QuestionDotToken>;
586 export interface KeywordToken<TKind extends KeywordSyntaxKind> extends Token<TKind> {
588 export type AssertsKeyword = KeywordToken<SyntaxKind.AssertsKeyword>;
589 export type AwaitKeyword = KeywordToken<SyntaxKind.AwaitKeyword>;
590 /** @deprecated Use `AwaitKeyword` instead. */
591 export type AwaitKeywordToken = AwaitKeyword;
592 /** @deprecated Use `AssertsKeyword` instead. */
593 export type AssertsToken = AssertsKeyword;
594 export interface ModifierToken<TKind extends ModifierSyntaxKind> extends KeywordToken<TKind> {
596 export type AbstractKeyword = ModifierToken<SyntaxKind.AbstractKeyword>;
597 export type AsyncKeyword = ModifierToken<SyntaxKind.AsyncKeyword>;
598 export type ConstKeyword = ModifierToken<SyntaxKind.ConstKeyword>;
599 export type DeclareKeyword = ModifierToken<SyntaxKind.DeclareKeyword>;
600 export type DefaultKeyword = ModifierToken<SyntaxKind.DefaultKeyword>;
601 export type ExportKeyword = ModifierToken<SyntaxKind.ExportKeyword>;
602 export type PrivateKeyword = ModifierToken<SyntaxKind.PrivateKeyword>;
603 export type ProtectedKeyword = ModifierToken<SyntaxKind.ProtectedKeyword>;
604 export type PublicKeyword = ModifierToken<SyntaxKind.PublicKeyword>;
605 export type ReadonlyKeyword = ModifierToken<SyntaxKind.ReadonlyKeyword>;
606 export type StaticKeyword = ModifierToken<SyntaxKind.StaticKeyword>;
607 /** @deprecated Use `ReadonlyKeyword` instead. */
608 export type ReadonlyToken = ReadonlyKeyword;
609 export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | ReadonlyKeyword | StaticKeyword;
610 export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword;
611 export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword;
612 export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword;
613 export type ModifiersArray = NodeArray<Modifier>;
614 export enum GeneratedIdentifierFlags {
616 ReservedInNestedScopes = 8,
619 AllowNameSubstitution = 64
621 export interface Identifier extends PrimaryExpression, Declaration {
622 readonly kind: SyntaxKind.Identifier;
624 * Prefer to use `id.unescapedText`. (Note: This is available only in services, not internally to the TypeScript compiler.)
625 * Text of identifier, but if the identifier begins with two underscores, this will begin with three.
627 readonly escapedText: __String;
628 readonly originalKeywordKind?: SyntaxKind;
629 isInJSDocNamespace?: boolean;
631 export interface TransientIdentifier extends Identifier {
632 resolvedSymbol: Symbol;
634 export interface QualifiedName extends Node {
635 readonly kind: SyntaxKind.QualifiedName;
636 readonly left: EntityName;
637 readonly right: Identifier;
639 export type EntityName = Identifier | QualifiedName;
640 export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
641 export type DeclarationName = Identifier | PrivateIdentifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern | EntityNameExpression;
642 export interface Declaration extends Node {
643 _declarationBrand: any;
645 export interface NamedDeclaration extends Declaration {
646 readonly name?: DeclarationName;
648 export interface DeclarationStatement extends NamedDeclaration, Statement {
649 readonly name?: Identifier | StringLiteral | NumericLiteral;
651 export interface ComputedPropertyName extends Node {
652 readonly kind: SyntaxKind.ComputedPropertyName;
653 readonly parent: Declaration;
654 readonly expression: Expression;
656 export interface PrivateIdentifier extends Node {
657 readonly kind: SyntaxKind.PrivateIdentifier;
658 readonly escapedText: __String;
660 export interface Decorator extends Node {
661 readonly kind: SyntaxKind.Decorator;
662 readonly parent: NamedDeclaration;
663 readonly expression: LeftHandSideExpression;
665 export interface TypeParameterDeclaration extends NamedDeclaration {
666 readonly kind: SyntaxKind.TypeParameter;
667 readonly parent: DeclarationWithTypeParameterChildren | InferTypeNode;
668 readonly name: Identifier;
669 /** Note: Consider calling `getEffectiveConstraintOfTypeParameter` */
670 readonly constraint?: TypeNode;
671 readonly default?: TypeNode;
672 expression?: Expression;
674 export interface SignatureDeclarationBase extends NamedDeclaration, JSDocContainer {
675 readonly kind: SignatureDeclaration["kind"];
676 readonly name?: PropertyName;
677 readonly typeParameters?: NodeArray<TypeParameterDeclaration>;
678 readonly parameters: NodeArray<ParameterDeclaration>;
679 readonly type?: TypeNode;
681 export type SignatureDeclaration = CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction;
682 export interface CallSignatureDeclaration extends SignatureDeclarationBase, TypeElement {
683 readonly kind: SyntaxKind.CallSignature;
685 export interface ConstructSignatureDeclaration extends SignatureDeclarationBase, TypeElement {
686 readonly kind: SyntaxKind.ConstructSignature;
688 export type BindingName = Identifier | BindingPattern;
689 export interface VariableDeclaration extends NamedDeclaration {
690 readonly kind: SyntaxKind.VariableDeclaration;
691 readonly parent: VariableDeclarationList | CatchClause;
692 readonly name: BindingName;
693 readonly exclamationToken?: ExclamationToken;
694 readonly type?: TypeNode;
695 readonly initializer?: Expression;
697 export interface VariableDeclarationList extends Node {
698 readonly kind: SyntaxKind.VariableDeclarationList;
699 readonly parent: VariableStatement | ForStatement | ForOfStatement | ForInStatement;
700 readonly declarations: NodeArray<VariableDeclaration>;
702 export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer {
703 readonly kind: SyntaxKind.Parameter;
704 readonly parent: SignatureDeclaration;
705 readonly dotDotDotToken?: DotDotDotToken;
706 readonly name: BindingName;
707 readonly questionToken?: QuestionToken;
708 readonly type?: TypeNode;
709 readonly initializer?: Expression;
711 export interface BindingElement extends NamedDeclaration {
712 readonly kind: SyntaxKind.BindingElement;
713 readonly parent: BindingPattern;
714 readonly propertyName?: PropertyName;
715 readonly dotDotDotToken?: DotDotDotToken;
716 readonly name: BindingName;
717 readonly initializer?: Expression;
719 export interface PropertySignature extends TypeElement, JSDocContainer {
720 readonly kind: SyntaxKind.PropertySignature;
721 readonly name: PropertyName;
722 readonly questionToken?: QuestionToken;
723 readonly type?: TypeNode;
724 initializer?: Expression;
726 export interface PropertyDeclaration extends ClassElement, JSDocContainer {
727 readonly kind: SyntaxKind.PropertyDeclaration;
728 readonly parent: ClassLikeDeclaration;
729 readonly name: PropertyName;
730 readonly questionToken?: QuestionToken;
731 readonly exclamationToken?: ExclamationToken;
732 readonly type?: TypeNode;
733 readonly initializer?: Expression;
735 export interface ObjectLiteralElement extends NamedDeclaration {
736 _objectLiteralBrand: any;
737 readonly name?: PropertyName;
739 /** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
740 export type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
741 export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer {
742 readonly kind: SyntaxKind.PropertyAssignment;
743 readonly parent: ObjectLiteralExpression;
744 readonly name: PropertyName;
745 readonly questionToken?: QuestionToken;
746 readonly exclamationToken?: ExclamationToken;
747 readonly initializer: Expression;
749 export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer {
750 readonly kind: SyntaxKind.ShorthandPropertyAssignment;
751 readonly parent: ObjectLiteralExpression;
752 readonly name: Identifier;
753 readonly questionToken?: QuestionToken;
754 readonly exclamationToken?: ExclamationToken;
755 readonly equalsToken?: EqualsToken;
756 readonly objectAssignmentInitializer?: Expression;
758 export interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer {
759 readonly kind: SyntaxKind.SpreadAssignment;
760 readonly parent: ObjectLiteralExpression;
761 readonly expression: Expression;
763 export type VariableLikeDeclaration = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertyAssignment | PropertySignature | JsxAttribute | ShorthandPropertyAssignment | EnumMember | JSDocPropertyTag | JSDocParameterTag;
764 export interface PropertyLikeDeclaration extends NamedDeclaration {
765 readonly name: PropertyName;
767 export interface ObjectBindingPattern extends Node {
768 readonly kind: SyntaxKind.ObjectBindingPattern;
769 readonly parent: VariableDeclaration | ParameterDeclaration | BindingElement;
770 readonly elements: NodeArray<BindingElement>;
772 export interface ArrayBindingPattern extends Node {
773 readonly kind: SyntaxKind.ArrayBindingPattern;
774 readonly parent: VariableDeclaration | ParameterDeclaration | BindingElement;
775 readonly elements: NodeArray<ArrayBindingElement>;
777 export type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
778 export type ArrayBindingElement = BindingElement | OmittedExpression;
780 * Several node kinds share function-like features such as a signature,
781 * a name, and a body. These nodes should extend FunctionLikeDeclarationBase.
783 * - FunctionDeclaration
784 * - MethodDeclaration
785 * - AccessorDeclaration
787 export interface FunctionLikeDeclarationBase extends SignatureDeclarationBase {
788 _functionLikeDeclarationBrand: any;
789 readonly asteriskToken?: AsteriskToken;
790 readonly questionToken?: QuestionToken;
791 readonly exclamationToken?: ExclamationToken;
792 readonly body?: Block | Expression;
794 export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
795 /** @deprecated Use SignatureDeclaration */
796 export type FunctionLike = SignatureDeclaration;
797 export interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement {
798 readonly kind: SyntaxKind.FunctionDeclaration;
799 readonly name?: Identifier;
800 readonly body?: FunctionBody;
802 export interface MethodSignature extends SignatureDeclarationBase, TypeElement {
803 readonly kind: SyntaxKind.MethodSignature;
804 readonly parent: ObjectTypeDeclaration;
805 readonly name: PropertyName;
807 export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
808 readonly kind: SyntaxKind.MethodDeclaration;
809 readonly parent: ClassLikeDeclaration | ObjectLiteralExpression;
810 readonly name: PropertyName;
811 readonly body?: FunctionBody;
813 export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer {
814 readonly kind: SyntaxKind.Constructor;
815 readonly parent: ClassLikeDeclaration;
816 readonly body?: FunctionBody;
818 /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
819 export interface SemicolonClassElement extends ClassElement {
820 readonly kind: SyntaxKind.SemicolonClassElement;
821 readonly parent: ClassLikeDeclaration;
823 export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
824 readonly kind: SyntaxKind.GetAccessor;
825 readonly parent: ClassLikeDeclaration | ObjectLiteralExpression;
826 readonly name: PropertyName;
827 readonly body?: FunctionBody;
829 export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
830 readonly kind: SyntaxKind.SetAccessor;
831 readonly parent: ClassLikeDeclaration | ObjectLiteralExpression;
832 readonly name: PropertyName;
833 readonly body?: FunctionBody;
835 export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
836 export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement {
837 readonly kind: SyntaxKind.IndexSignature;
838 readonly parent: ObjectTypeDeclaration;
839 readonly type: TypeNode;
841 export interface TypeNode extends Node {
844 export interface KeywordTypeNode<TKind extends KeywordTypeSyntaxKind = KeywordTypeSyntaxKind> extends KeywordToken<TKind>, TypeNode {
845 readonly kind: TKind;
847 export interface ImportTypeNode extends NodeWithTypeArguments {
848 readonly kind: SyntaxKind.ImportType;
849 readonly isTypeOf: boolean;
850 readonly argument: TypeNode;
851 readonly qualifier?: EntityName;
853 export interface ThisTypeNode extends TypeNode {
854 readonly kind: SyntaxKind.ThisType;
856 export type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode;
857 export interface FunctionOrConstructorTypeNodeBase extends TypeNode, SignatureDeclarationBase {
858 readonly kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType;
859 readonly type: TypeNode;
861 export interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase {
862 readonly kind: SyntaxKind.FunctionType;
864 export interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase {
865 readonly kind: SyntaxKind.ConstructorType;
867 export interface NodeWithTypeArguments extends TypeNode {
868 readonly typeArguments?: NodeArray<TypeNode>;
870 export type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments;
871 export interface TypeReferenceNode extends NodeWithTypeArguments {
872 readonly kind: SyntaxKind.TypeReference;
873 readonly typeName: EntityName;
875 export interface TypePredicateNode extends TypeNode {
876 readonly kind: SyntaxKind.TypePredicate;
877 readonly parent: SignatureDeclaration | JSDocTypeExpression;
878 readonly assertsModifier?: AssertsToken;
879 readonly parameterName: Identifier | ThisTypeNode;
880 readonly type?: TypeNode;
882 export interface TypeQueryNode extends TypeNode {
883 readonly kind: SyntaxKind.TypeQuery;
884 readonly exprName: EntityName;
886 export interface TypeLiteralNode extends TypeNode, Declaration {
887 readonly kind: SyntaxKind.TypeLiteral;
888 readonly members: NodeArray<TypeElement>;
890 export interface ArrayTypeNode extends TypeNode {
891 readonly kind: SyntaxKind.ArrayType;
892 readonly elementType: TypeNode;
894 export interface TupleTypeNode extends TypeNode {
895 readonly kind: SyntaxKind.TupleType;
896 readonly elements: NodeArray<TypeNode | NamedTupleMember>;
898 export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration {
899 readonly kind: SyntaxKind.NamedTupleMember;
900 readonly dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
901 readonly name: Identifier;
902 readonly questionToken?: Token<SyntaxKind.QuestionToken>;
903 readonly type: TypeNode;
905 export interface OptionalTypeNode extends TypeNode {
906 readonly kind: SyntaxKind.OptionalType;
907 readonly type: TypeNode;
909 export interface RestTypeNode extends TypeNode {
910 readonly kind: SyntaxKind.RestType;
911 readonly type: TypeNode;
913 export type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode;
914 export interface UnionTypeNode extends TypeNode {
915 readonly kind: SyntaxKind.UnionType;
916 readonly types: NodeArray<TypeNode>;
918 export interface IntersectionTypeNode extends TypeNode {
919 readonly kind: SyntaxKind.IntersectionType;
920 readonly types: NodeArray<TypeNode>;
922 export interface ConditionalTypeNode extends TypeNode {
923 readonly kind: SyntaxKind.ConditionalType;
924 readonly checkType: TypeNode;
925 readonly extendsType: TypeNode;
926 readonly trueType: TypeNode;
927 readonly falseType: TypeNode;
929 export interface InferTypeNode extends TypeNode {
930 readonly kind: SyntaxKind.InferType;
931 readonly typeParameter: TypeParameterDeclaration;
933 export interface ParenthesizedTypeNode extends TypeNode {
934 readonly kind: SyntaxKind.ParenthesizedType;
935 readonly type: TypeNode;
937 export interface TypeOperatorNode extends TypeNode {
938 readonly kind: SyntaxKind.TypeOperator;
939 readonly operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword;
940 readonly type: TypeNode;
942 export interface IndexedAccessTypeNode extends TypeNode {
943 readonly kind: SyntaxKind.IndexedAccessType;
944 readonly objectType: TypeNode;
945 readonly indexType: TypeNode;
947 export interface MappedTypeNode extends TypeNode, Declaration {
948 readonly kind: SyntaxKind.MappedType;
949 readonly readonlyToken?: ReadonlyToken | PlusToken | MinusToken;
950 readonly typeParameter: TypeParameterDeclaration;
951 readonly nameType?: TypeNode;
952 readonly questionToken?: QuestionToken | PlusToken | MinusToken;
953 readonly type?: TypeNode;
955 export interface LiteralTypeNode extends TypeNode {
956 readonly kind: SyntaxKind.LiteralType;
957 readonly literal: NullLiteral | BooleanLiteral | LiteralExpression | PrefixUnaryExpression;
959 export interface StringLiteral extends LiteralExpression, Declaration {
960 readonly kind: SyntaxKind.StringLiteral;
962 export type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
963 export type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral;
964 export interface TemplateLiteralTypeNode extends TypeNode {
965 kind: SyntaxKind.TemplateLiteralType;
966 readonly head: TemplateHead;
967 readonly templateSpans: NodeArray<TemplateLiteralTypeSpan>;
969 export interface TemplateLiteralTypeSpan extends TypeNode {
970 readonly kind: SyntaxKind.TemplateLiteralTypeSpan;
971 readonly parent: TemplateLiteralTypeNode;
972 readonly type: TypeNode;
973 readonly literal: TemplateMiddle | TemplateTail;
975 export interface Expression extends Node {
976 _expressionBrand: any;
978 export interface OmittedExpression extends Expression {
979 readonly kind: SyntaxKind.OmittedExpression;
981 export interface PartiallyEmittedExpression extends LeftHandSideExpression {
982 readonly kind: SyntaxKind.PartiallyEmittedExpression;
983 readonly expression: Expression;
985 export interface UnaryExpression extends Expression {
986 _unaryExpressionBrand: any;
988 /** Deprecated, please use UpdateExpression */
989 export type IncrementExpression = UpdateExpression;
990 export interface UpdateExpression extends UnaryExpression {
991 _updateExpressionBrand: any;
993 export type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken;
994 export interface PrefixUnaryExpression extends UpdateExpression {
995 readonly kind: SyntaxKind.PrefixUnaryExpression;
996 readonly operator: PrefixUnaryOperator;
997 readonly operand: UnaryExpression;
999 export type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken;
1000 export interface PostfixUnaryExpression extends UpdateExpression {
1001 readonly kind: SyntaxKind.PostfixUnaryExpression;
1002 readonly operand: LeftHandSideExpression;
1003 readonly operator: PostfixUnaryOperator;
1005 export interface LeftHandSideExpression extends UpdateExpression {
1006 _leftHandSideExpressionBrand: any;
1008 export interface MemberExpression extends LeftHandSideExpression {
1009 _memberExpressionBrand: any;
1011 export interface PrimaryExpression extends MemberExpression {
1012 _primaryExpressionBrand: any;
1014 export interface NullLiteral extends PrimaryExpression {
1015 readonly kind: SyntaxKind.NullKeyword;
1017 export interface TrueLiteral extends PrimaryExpression {
1018 readonly kind: SyntaxKind.TrueKeyword;
1020 export interface FalseLiteral extends PrimaryExpression {
1021 readonly kind: SyntaxKind.FalseKeyword;
1023 export type BooleanLiteral = TrueLiteral | FalseLiteral;
1024 export interface ThisExpression extends PrimaryExpression {
1025 readonly kind: SyntaxKind.ThisKeyword;
1027 export interface SuperExpression extends PrimaryExpression {
1028 readonly kind: SyntaxKind.SuperKeyword;
1030 export interface ImportExpression extends PrimaryExpression {
1031 readonly kind: SyntaxKind.ImportKeyword;
1033 export interface DeleteExpression extends UnaryExpression {
1034 readonly kind: SyntaxKind.DeleteExpression;
1035 readonly expression: UnaryExpression;
1037 export interface TypeOfExpression extends UnaryExpression {
1038 readonly kind: SyntaxKind.TypeOfExpression;
1039 readonly expression: UnaryExpression;
1041 export interface VoidExpression extends UnaryExpression {
1042 readonly kind: SyntaxKind.VoidExpression;
1043 readonly expression: UnaryExpression;
1045 export interface AwaitExpression extends UnaryExpression {
1046 readonly kind: SyntaxKind.AwaitExpression;
1047 readonly expression: UnaryExpression;
1049 export interface YieldExpression extends Expression {
1050 readonly kind: SyntaxKind.YieldExpression;
1051 readonly asteriskToken?: AsteriskToken;
1052 readonly expression?: Expression;
1054 export interface SyntheticExpression extends Expression {
1055 readonly kind: SyntaxKind.SyntheticExpression;
1056 readonly isSpread: boolean;
1057 readonly type: Type;
1058 readonly tupleNameSource?: ParameterDeclaration | NamedTupleMember;
1060 export type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken;
1061 export type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken;
1062 export type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator;
1063 export type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken;
1064 export type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator;
1065 export type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken;
1066 export type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator;
1067 export type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword;
1068 export type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator;
1069 export type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken;
1070 export type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator;
1071 export type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken;
1072 export type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
1073 export type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
1074 export type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
1075 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 | SyntaxKind.BarBarEqualsToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.QuestionQuestionEqualsToken;
1076 export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
1077 export type AssignmentOperatorOrHigher = SyntaxKind.QuestionQuestionToken | LogicalOperatorOrHigher | AssignmentOperator;
1078 export type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
1079 export type LogicalOrCoalescingAssignmentOperator = SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionEqualsToken;
1080 export type BinaryOperatorToken = Token<BinaryOperator>;
1081 export interface BinaryExpression extends Expression, Declaration {
1082 readonly kind: SyntaxKind.BinaryExpression;
1083 readonly left: Expression;
1084 readonly operatorToken: BinaryOperatorToken;
1085 readonly right: Expression;
1087 export type AssignmentOperatorToken = Token<AssignmentOperator>;
1088 export interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
1089 readonly left: LeftHandSideExpression;
1090 readonly operatorToken: TOperator;
1092 export interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
1093 readonly left: ObjectLiteralExpression;
1095 export interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
1096 readonly left: ArrayLiteralExpression;
1098 export type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
1099 export type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | ObjectBindingOrAssignmentElement | ArrayBindingOrAssignmentElement;
1100 export type ObjectBindingOrAssignmentElement = BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment;
1101 export type ArrayBindingOrAssignmentElement = BindingElement | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
1102 export type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
1103 export type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Identifier | PropertyAccessExpression | ElementAccessExpression | OmittedExpression;
1104 export type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
1105 export type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
1106 export type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
1107 export type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
1108 export interface ConditionalExpression extends Expression {
1109 readonly kind: SyntaxKind.ConditionalExpression;
1110 readonly condition: Expression;
1111 readonly questionToken: QuestionToken;
1112 readonly whenTrue: Expression;
1113 readonly colonToken: ColonToken;
1114 readonly whenFalse: Expression;
1116 export type FunctionBody = Block;
1117 export type ConciseBody = FunctionBody | Expression;
1118 export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclarationBase, JSDocContainer {
1119 readonly kind: SyntaxKind.FunctionExpression;
1120 readonly name?: Identifier;
1121 readonly body: FunctionBody;
1123 export interface ArrowFunction extends Expression, FunctionLikeDeclarationBase, JSDocContainer {
1124 readonly kind: SyntaxKind.ArrowFunction;
1125 readonly equalsGreaterThanToken: EqualsGreaterThanToken;
1126 readonly body: ConciseBody;
1127 readonly name: never;
1129 export interface LiteralLikeNode extends Node {
1131 isUnterminated?: boolean;
1132 hasExtendedUnicodeEscape?: boolean;
1134 export interface TemplateLiteralLikeNode extends LiteralLikeNode {
1137 export interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
1138 _literalExpressionBrand: any;
1140 export interface RegularExpressionLiteral extends LiteralExpression {
1141 readonly kind: SyntaxKind.RegularExpressionLiteral;
1143 export interface NoSubstitutionTemplateLiteral extends LiteralExpression, TemplateLiteralLikeNode, Declaration {
1144 readonly kind: SyntaxKind.NoSubstitutionTemplateLiteral;
1146 export enum TokenFlags {
1151 BinarySpecifier = 128,
1152 OctalSpecifier = 256,
1154 export interface NumericLiteral extends LiteralExpression, Declaration {
1155 readonly kind: SyntaxKind.NumericLiteral;
1157 export interface BigIntLiteral extends LiteralExpression {
1158 readonly kind: SyntaxKind.BigIntLiteral;
1160 export type LiteralToken = NumericLiteral | BigIntLiteral | StringLiteral | JsxText | RegularExpressionLiteral | NoSubstitutionTemplateLiteral;
1161 export interface TemplateHead extends TemplateLiteralLikeNode {
1162 readonly kind: SyntaxKind.TemplateHead;
1163 readonly parent: TemplateExpression | TemplateLiteralTypeNode;
1165 export interface TemplateMiddle extends TemplateLiteralLikeNode {
1166 readonly kind: SyntaxKind.TemplateMiddle;
1167 readonly parent: TemplateSpan | TemplateLiteralTypeSpan;
1169 export interface TemplateTail extends TemplateLiteralLikeNode {
1170 readonly kind: SyntaxKind.TemplateTail;
1171 readonly parent: TemplateSpan | TemplateLiteralTypeSpan;
1173 export type PseudoLiteralToken = TemplateHead | TemplateMiddle | TemplateTail;
1174 export type TemplateLiteralToken = NoSubstitutionTemplateLiteral | PseudoLiteralToken;
1175 export interface TemplateExpression extends PrimaryExpression {
1176 readonly kind: SyntaxKind.TemplateExpression;
1177 readonly head: TemplateHead;
1178 readonly templateSpans: NodeArray<TemplateSpan>;
1180 export type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
1181 export interface TemplateSpan extends Node {
1182 readonly kind: SyntaxKind.TemplateSpan;
1183 readonly parent: TemplateExpression;
1184 readonly expression: Expression;
1185 readonly literal: TemplateMiddle | TemplateTail;
1187 export interface ParenthesizedExpression extends PrimaryExpression, JSDocContainer {
1188 readonly kind: SyntaxKind.ParenthesizedExpression;
1189 readonly expression: Expression;
1191 export interface ArrayLiteralExpression extends PrimaryExpression {
1192 readonly kind: SyntaxKind.ArrayLiteralExpression;
1193 readonly elements: NodeArray<Expression>;
1195 export interface SpreadElement extends Expression {
1196 readonly kind: SyntaxKind.SpreadElement;
1197 readonly parent: ArrayLiteralExpression | CallExpression | NewExpression;
1198 readonly expression: Expression;
1201 * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to
1202 * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be
1203 * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type
1204 * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.)
1206 export interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration {
1207 readonly properties: NodeArray<T>;
1209 export interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> {
1210 readonly kind: SyntaxKind.ObjectLiteralExpression;
1212 export type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
1213 export type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
1214 export type AccessExpression = PropertyAccessExpression | ElementAccessExpression;
1215 export interface PropertyAccessExpression extends MemberExpression, NamedDeclaration {
1216 readonly kind: SyntaxKind.PropertyAccessExpression;
1217 readonly expression: LeftHandSideExpression;
1218 readonly questionDotToken?: QuestionDotToken;
1219 readonly name: Identifier | PrivateIdentifier;
1221 export interface PropertyAccessChain extends PropertyAccessExpression {
1222 _optionalChainBrand: any;
1223 readonly name: Identifier | PrivateIdentifier;
1225 export interface SuperPropertyAccessExpression extends PropertyAccessExpression {
1226 readonly expression: SuperExpression;
1228 /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */
1229 export interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
1230 _propertyAccessExpressionLikeQualifiedNameBrand?: any;
1231 readonly expression: EntityNameExpression;
1232 readonly name: Identifier;
1234 export interface ElementAccessExpression extends MemberExpression {
1235 readonly kind: SyntaxKind.ElementAccessExpression;
1236 readonly expression: LeftHandSideExpression;
1237 readonly questionDotToken?: QuestionDotToken;
1238 readonly argumentExpression: Expression;
1240 export interface ElementAccessChain extends ElementAccessExpression {
1241 _optionalChainBrand: any;
1243 export interface SuperElementAccessExpression extends ElementAccessExpression {
1244 readonly expression: SuperExpression;
1246 export type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
1247 export interface CallExpression extends LeftHandSideExpression, Declaration {
1248 readonly kind: SyntaxKind.CallExpression;
1249 readonly expression: LeftHandSideExpression;
1250 readonly questionDotToken?: QuestionDotToken;
1251 readonly typeArguments?: NodeArray<TypeNode>;
1252 readonly arguments: NodeArray<Expression>;
1254 export interface CallChain extends CallExpression {
1255 _optionalChainBrand: any;
1257 export type OptionalChain = PropertyAccessChain | ElementAccessChain | CallChain | NonNullChain;
1258 export interface SuperCall extends CallExpression {
1259 readonly expression: SuperExpression;
1261 export interface ImportCall extends CallExpression {
1262 readonly expression: ImportExpression;
1264 export interface ExpressionWithTypeArguments extends NodeWithTypeArguments {
1265 readonly kind: SyntaxKind.ExpressionWithTypeArguments;
1266 readonly parent: HeritageClause | JSDocAugmentsTag | JSDocImplementsTag;
1267 readonly expression: LeftHandSideExpression;
1269 export interface NewExpression extends PrimaryExpression, Declaration {
1270 readonly kind: SyntaxKind.NewExpression;
1271 readonly expression: LeftHandSideExpression;
1272 readonly typeArguments?: NodeArray<TypeNode>;
1273 readonly arguments?: NodeArray<Expression>;
1275 export interface TaggedTemplateExpression extends MemberExpression {
1276 readonly kind: SyntaxKind.TaggedTemplateExpression;
1277 readonly tag: LeftHandSideExpression;
1278 readonly typeArguments?: NodeArray<TypeNode>;
1279 readonly template: TemplateLiteral;
1281 export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;
1282 export interface AsExpression extends Expression {
1283 readonly kind: SyntaxKind.AsExpression;
1284 readonly expression: Expression;
1285 readonly type: TypeNode;
1287 export interface TypeAssertion extends UnaryExpression {
1288 readonly kind: SyntaxKind.TypeAssertionExpression;
1289 readonly type: TypeNode;
1290 readonly expression: UnaryExpression;
1292 export type AssertionExpression = TypeAssertion | AsExpression;
1293 export interface NonNullExpression extends LeftHandSideExpression {
1294 readonly kind: SyntaxKind.NonNullExpression;
1295 readonly expression: Expression;
1297 export interface NonNullChain extends NonNullExpression {
1298 _optionalChainBrand: any;
1300 export interface MetaProperty extends PrimaryExpression {
1301 readonly kind: SyntaxKind.MetaProperty;
1302 readonly keywordToken: SyntaxKind.NewKeyword | SyntaxKind.ImportKeyword;
1303 readonly name: Identifier;
1305 export interface JsxElement extends PrimaryExpression {
1306 readonly kind: SyntaxKind.JsxElement;
1307 readonly openingElement: JsxOpeningElement;
1308 readonly children: NodeArray<JsxChild>;
1309 readonly closingElement: JsxClosingElement;
1311 export type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
1312 export type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
1313 export type JsxTagNameExpression = Identifier | ThisExpression | JsxTagNamePropertyAccess;
1314 export interface JsxTagNamePropertyAccess extends PropertyAccessExpression {
1315 readonly expression: JsxTagNameExpression;
1317 export interface JsxAttributes extends ObjectLiteralExpressionBase<JsxAttributeLike> {
1318 readonly kind: SyntaxKind.JsxAttributes;
1319 readonly parent: JsxOpeningLikeElement;
1321 export interface JsxOpeningElement extends Expression {
1322 readonly kind: SyntaxKind.JsxOpeningElement;
1323 readonly parent: JsxElement;
1324 readonly tagName: JsxTagNameExpression;
1325 readonly typeArguments?: NodeArray<TypeNode>;
1326 readonly attributes: JsxAttributes;
1328 export interface JsxSelfClosingElement extends PrimaryExpression {
1329 readonly kind: SyntaxKind.JsxSelfClosingElement;
1330 readonly tagName: JsxTagNameExpression;
1331 readonly typeArguments?: NodeArray<TypeNode>;
1332 readonly attributes: JsxAttributes;
1334 export interface JsxFragment extends PrimaryExpression {
1335 readonly kind: SyntaxKind.JsxFragment;
1336 readonly openingFragment: JsxOpeningFragment;
1337 readonly children: NodeArray<JsxChild>;
1338 readonly closingFragment: JsxClosingFragment;
1340 export interface JsxOpeningFragment extends Expression {
1341 readonly kind: SyntaxKind.JsxOpeningFragment;
1342 readonly parent: JsxFragment;
1344 export interface JsxClosingFragment extends Expression {
1345 readonly kind: SyntaxKind.JsxClosingFragment;
1346 readonly parent: JsxFragment;
1348 export interface JsxAttribute extends ObjectLiteralElement {
1349 readonly kind: SyntaxKind.JsxAttribute;
1350 readonly parent: JsxAttributes;
1351 readonly name: Identifier;
1352 readonly initializer?: StringLiteral | JsxExpression;
1354 export interface JsxSpreadAttribute extends ObjectLiteralElement {
1355 readonly kind: SyntaxKind.JsxSpreadAttribute;
1356 readonly parent: JsxAttributes;
1357 readonly expression: Expression;
1359 export interface JsxClosingElement extends Node {
1360 readonly kind: SyntaxKind.JsxClosingElement;
1361 readonly parent: JsxElement;
1362 readonly tagName: JsxTagNameExpression;
1364 export interface JsxExpression extends Expression {
1365 readonly kind: SyntaxKind.JsxExpression;
1366 readonly parent: JsxElement | JsxAttributeLike;
1367 readonly dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
1368 readonly expression?: Expression;
1370 export interface JsxText extends LiteralLikeNode {
1371 readonly kind: SyntaxKind.JsxText;
1372 readonly parent: JsxElement;
1373 readonly containsOnlyTriviaWhiteSpaces: boolean;
1375 export type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
1376 export interface Statement extends Node {
1377 _statementBrand: any;
1379 export interface NotEmittedStatement extends Statement {
1380 readonly kind: SyntaxKind.NotEmittedStatement;
1383 * A list of comma-separated expressions. This node is only created by transformations.
1385 export interface CommaListExpression extends Expression {
1386 readonly kind: SyntaxKind.CommaListExpression;
1387 readonly elements: NodeArray<Expression>;
1389 export interface EmptyStatement extends Statement {
1390 readonly kind: SyntaxKind.EmptyStatement;
1392 export interface DebuggerStatement extends Statement {
1393 readonly kind: SyntaxKind.DebuggerStatement;
1395 export interface MissingDeclaration extends DeclarationStatement {
1396 readonly kind: SyntaxKind.MissingDeclaration;
1397 readonly name?: Identifier;
1399 export type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause;
1400 export interface Block extends Statement {
1401 readonly kind: SyntaxKind.Block;
1402 readonly statements: NodeArray<Statement>;
1404 export interface VariableStatement extends Statement, JSDocContainer {
1405 readonly kind: SyntaxKind.VariableStatement;
1406 readonly declarationList: VariableDeclarationList;
1408 export interface ExpressionStatement extends Statement, JSDocContainer {
1409 readonly kind: SyntaxKind.ExpressionStatement;
1410 readonly expression: Expression;
1412 export interface IfStatement extends Statement {
1413 readonly kind: SyntaxKind.IfStatement;
1414 readonly expression: Expression;
1415 readonly thenStatement: Statement;
1416 readonly elseStatement?: Statement;
1418 export interface IterationStatement extends Statement {
1419 readonly statement: Statement;
1421 export interface DoStatement extends IterationStatement {
1422 readonly kind: SyntaxKind.DoStatement;
1423 readonly expression: Expression;
1425 export interface WhileStatement extends IterationStatement {
1426 readonly kind: SyntaxKind.WhileStatement;
1427 readonly expression: Expression;
1429 export type ForInitializer = VariableDeclarationList | Expression;
1430 export interface ForStatement extends IterationStatement {
1431 readonly kind: SyntaxKind.ForStatement;
1432 readonly initializer?: ForInitializer;
1433 readonly condition?: Expression;
1434 readonly incrementor?: Expression;
1436 export type ForInOrOfStatement = ForInStatement | ForOfStatement;
1437 export interface ForInStatement extends IterationStatement {
1438 readonly kind: SyntaxKind.ForInStatement;
1439 readonly initializer: ForInitializer;
1440 readonly expression: Expression;
1442 export interface ForOfStatement extends IterationStatement {
1443 readonly kind: SyntaxKind.ForOfStatement;
1444 readonly awaitModifier?: AwaitKeywordToken;
1445 readonly initializer: ForInitializer;
1446 readonly expression: Expression;
1448 export interface BreakStatement extends Statement {
1449 readonly kind: SyntaxKind.BreakStatement;
1450 readonly label?: Identifier;
1452 export interface ContinueStatement extends Statement {
1453 readonly kind: SyntaxKind.ContinueStatement;
1454 readonly label?: Identifier;
1456 export type BreakOrContinueStatement = BreakStatement | ContinueStatement;
1457 export interface ReturnStatement extends Statement {
1458 readonly kind: SyntaxKind.ReturnStatement;
1459 readonly expression?: Expression;
1461 export interface WithStatement extends Statement {
1462 readonly kind: SyntaxKind.WithStatement;
1463 readonly expression: Expression;
1464 readonly statement: Statement;
1466 export interface SwitchStatement extends Statement {
1467 readonly kind: SyntaxKind.SwitchStatement;
1468 readonly expression: Expression;
1469 readonly caseBlock: CaseBlock;
1470 possiblyExhaustive?: boolean;
1472 export interface CaseBlock extends Node {
1473 readonly kind: SyntaxKind.CaseBlock;
1474 readonly parent: SwitchStatement;
1475 readonly clauses: NodeArray<CaseOrDefaultClause>;
1477 export interface CaseClause extends Node {
1478 readonly kind: SyntaxKind.CaseClause;
1479 readonly parent: CaseBlock;
1480 readonly expression: Expression;
1481 readonly statements: NodeArray<Statement>;
1483 export interface DefaultClause extends Node {
1484 readonly kind: SyntaxKind.DefaultClause;
1485 readonly parent: CaseBlock;
1486 readonly statements: NodeArray<Statement>;
1488 export type CaseOrDefaultClause = CaseClause | DefaultClause;
1489 export interface LabeledStatement extends Statement, JSDocContainer {
1490 readonly kind: SyntaxKind.LabeledStatement;
1491 readonly label: Identifier;
1492 readonly statement: Statement;
1494 export interface ThrowStatement extends Statement {
1495 readonly kind: SyntaxKind.ThrowStatement;
1496 readonly expression: Expression;
1498 export interface TryStatement extends Statement {
1499 readonly kind: SyntaxKind.TryStatement;
1500 readonly tryBlock: Block;
1501 readonly catchClause?: CatchClause;
1502 readonly finallyBlock?: Block;
1504 export interface CatchClause extends Node {
1505 readonly kind: SyntaxKind.CatchClause;
1506 readonly parent: TryStatement;
1507 readonly variableDeclaration?: VariableDeclaration;
1508 readonly block: Block;
1510 export type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
1511 export type DeclarationWithTypeParameters = DeclarationWithTypeParameterChildren | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
1512 export type DeclarationWithTypeParameterChildren = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
1513 export interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
1514 readonly kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
1515 readonly name?: Identifier;
1516 readonly typeParameters?: NodeArray<TypeParameterDeclaration>;
1517 readonly heritageClauses?: NodeArray<HeritageClause>;
1518 readonly members: NodeArray<ClassElement>;
1520 export interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement {
1521 readonly kind: SyntaxKind.ClassDeclaration;
1522 /** May be undefined in `export default class { ... }`. */
1523 readonly name?: Identifier;
1525 export interface ClassExpression extends ClassLikeDeclarationBase, PrimaryExpression {
1526 readonly kind: SyntaxKind.ClassExpression;
1528 export type ClassLikeDeclaration = ClassDeclaration | ClassExpression;
1529 export interface ClassElement extends NamedDeclaration {
1530 _classElementBrand: any;
1531 readonly name?: PropertyName;
1533 export interface TypeElement extends NamedDeclaration {
1534 _typeElementBrand: any;
1535 readonly name?: PropertyName;
1536 readonly questionToken?: QuestionToken;
1538 export interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer {
1539 readonly kind: SyntaxKind.InterfaceDeclaration;
1540 readonly name: Identifier;
1541 readonly typeParameters?: NodeArray<TypeParameterDeclaration>;
1542 readonly heritageClauses?: NodeArray<HeritageClause>;
1543 readonly members: NodeArray<TypeElement>;
1545 export interface HeritageClause extends Node {
1546 readonly kind: SyntaxKind.HeritageClause;
1547 readonly parent: InterfaceDeclaration | ClassLikeDeclaration;
1548 readonly token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword;
1549 readonly types: NodeArray<ExpressionWithTypeArguments>;
1551 export interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer {
1552 readonly kind: SyntaxKind.TypeAliasDeclaration;
1553 readonly name: Identifier;
1554 readonly typeParameters?: NodeArray<TypeParameterDeclaration>;
1555 readonly type: TypeNode;
1557 export interface EnumMember extends NamedDeclaration, JSDocContainer {
1558 readonly kind: SyntaxKind.EnumMember;
1559 readonly parent: EnumDeclaration;
1560 readonly name: PropertyName;
1561 readonly initializer?: Expression;
1563 export interface EnumDeclaration extends DeclarationStatement, JSDocContainer {
1564 readonly kind: SyntaxKind.EnumDeclaration;
1565 readonly name: Identifier;
1566 readonly members: NodeArray<EnumMember>;
1568 export type ModuleName = Identifier | StringLiteral;
1569 export type ModuleBody = NamespaceBody | JSDocNamespaceBody;
1570 export interface ModuleDeclaration extends DeclarationStatement, JSDocContainer {
1571 readonly kind: SyntaxKind.ModuleDeclaration;
1572 readonly parent: ModuleBody | SourceFile;
1573 readonly name: ModuleName;
1574 readonly body?: ModuleBody | JSDocNamespaceDeclaration;
1576 export type NamespaceBody = ModuleBlock | NamespaceDeclaration;
1577 export interface NamespaceDeclaration extends ModuleDeclaration {
1578 readonly name: Identifier;
1579 readonly body: NamespaceBody;
1581 export type JSDocNamespaceBody = Identifier | JSDocNamespaceDeclaration;
1582 export interface JSDocNamespaceDeclaration extends ModuleDeclaration {
1583 readonly name: Identifier;
1584 readonly body?: JSDocNamespaceBody;
1586 export interface ModuleBlock extends Node, Statement {
1587 readonly kind: SyntaxKind.ModuleBlock;
1588 readonly parent: ModuleDeclaration;
1589 readonly statements: NodeArray<Statement>;
1591 export type ModuleReference = EntityName | ExternalModuleReference;
1594 * - import x = require("mod");
1597 export interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer {
1598 readonly kind: SyntaxKind.ImportEqualsDeclaration;
1599 readonly parent: SourceFile | ModuleBlock;
1600 readonly name: Identifier;
1601 readonly isTypeOnly: boolean;
1602 readonly moduleReference: ModuleReference;
1604 export interface ExternalModuleReference extends Node {
1605 readonly kind: SyntaxKind.ExternalModuleReference;
1606 readonly parent: ImportEqualsDeclaration;
1607 readonly expression: Expression;
1609 export interface ImportDeclaration extends Statement, JSDocContainer {
1610 readonly kind: SyntaxKind.ImportDeclaration;
1611 readonly parent: SourceFile | ModuleBlock;
1612 readonly importClause?: ImportClause;
1613 /** If this is not a StringLiteral it will be a grammar error. */
1614 readonly moduleSpecifier: Expression;
1616 export type NamedImportBindings = NamespaceImport | NamedImports;
1617 export type NamedExportBindings = NamespaceExport | NamedExports;
1618 export interface ImportClause extends NamedDeclaration {
1619 readonly kind: SyntaxKind.ImportClause;
1620 readonly parent: ImportDeclaration;
1621 readonly isTypeOnly: boolean;
1622 readonly name?: Identifier;
1623 readonly namedBindings?: NamedImportBindings;
1625 export interface NamespaceImport extends NamedDeclaration {
1626 readonly kind: SyntaxKind.NamespaceImport;
1627 readonly parent: ImportClause;
1628 readonly name: Identifier;
1630 export interface NamespaceExport extends NamedDeclaration {
1631 readonly kind: SyntaxKind.NamespaceExport;
1632 readonly parent: ExportDeclaration;
1633 readonly name: Identifier;
1635 export interface NamespaceExportDeclaration extends DeclarationStatement, JSDocContainer {
1636 readonly kind: SyntaxKind.NamespaceExportDeclaration;
1637 readonly name: Identifier;
1639 export interface ExportDeclaration extends DeclarationStatement, JSDocContainer {
1640 readonly kind: SyntaxKind.ExportDeclaration;
1641 readonly parent: SourceFile | ModuleBlock;
1642 readonly isTypeOnly: boolean;
1643 /** Will not be assigned in the case of `export * from "foo";` */
1644 readonly exportClause?: NamedExportBindings;
1645 /** If this is not a StringLiteral it will be a grammar error. */
1646 readonly moduleSpecifier?: Expression;
1648 export interface NamedImports extends Node {
1649 readonly kind: SyntaxKind.NamedImports;
1650 readonly parent: ImportClause;
1651 readonly elements: NodeArray<ImportSpecifier>;
1653 export interface NamedExports extends Node {
1654 readonly kind: SyntaxKind.NamedExports;
1655 readonly parent: ExportDeclaration;
1656 readonly elements: NodeArray<ExportSpecifier>;
1658 export type NamedImportsOrExports = NamedImports | NamedExports;
1659 export interface ImportSpecifier extends NamedDeclaration {
1660 readonly kind: SyntaxKind.ImportSpecifier;
1661 readonly parent: NamedImports;
1662 readonly propertyName?: Identifier;
1663 readonly name: Identifier;
1665 export interface ExportSpecifier extends NamedDeclaration {
1666 readonly kind: SyntaxKind.ExportSpecifier;
1667 readonly parent: NamedExports;
1668 readonly propertyName?: Identifier;
1669 readonly name: Identifier;
1671 export type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
1672 export type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier;
1674 * This is either an `export =` or an `export default` declaration.
1675 * Unless `isExportEquals` is set, this node was parsed as an `export default`.
1677 export interface ExportAssignment extends DeclarationStatement, JSDocContainer {
1678 readonly kind: SyntaxKind.ExportAssignment;
1679 readonly parent: SourceFile;
1680 readonly isExportEquals?: boolean;
1681 readonly expression: Expression;
1683 export interface FileReference extends TextRange {
1686 export interface CheckJsDirective extends TextRange {
1689 export type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia;
1690 export interface CommentRange extends TextRange {
1691 hasTrailingNewLine?: boolean;
1694 export interface SynthesizedComment extends CommentRange {
1698 hasLeadingNewline?: boolean;
1700 export interface JSDocTypeExpression extends TypeNode {
1701 readonly kind: SyntaxKind.JSDocTypeExpression;
1702 readonly type: TypeNode;
1704 export interface JSDocNameReference extends Node {
1705 readonly kind: SyntaxKind.JSDocNameReference;
1706 readonly name: EntityName;
1708 export interface JSDocType extends TypeNode {
1709 _jsDocTypeBrand: any;
1711 export interface JSDocAllType extends JSDocType {
1712 readonly kind: SyntaxKind.JSDocAllType;
1714 export interface JSDocUnknownType extends JSDocType {
1715 readonly kind: SyntaxKind.JSDocUnknownType;
1717 export interface JSDocNonNullableType extends JSDocType {
1718 readonly kind: SyntaxKind.JSDocNonNullableType;
1719 readonly type: TypeNode;
1721 export interface JSDocNullableType extends JSDocType {
1722 readonly kind: SyntaxKind.JSDocNullableType;
1723 readonly type: TypeNode;
1725 export interface JSDocOptionalType extends JSDocType {
1726 readonly kind: SyntaxKind.JSDocOptionalType;
1727 readonly type: TypeNode;
1729 export interface JSDocFunctionType extends JSDocType, SignatureDeclarationBase {
1730 readonly kind: SyntaxKind.JSDocFunctionType;
1732 export interface JSDocVariadicType extends JSDocType {
1733 readonly kind: SyntaxKind.JSDocVariadicType;
1734 readonly type: TypeNode;
1736 export interface JSDocNamepathType extends JSDocType {
1737 readonly kind: SyntaxKind.JSDocNamepathType;
1738 readonly type: TypeNode;
1740 export type JSDocTypeReferencingNode = JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
1741 export interface JSDoc extends Node {
1742 readonly kind: SyntaxKind.JSDocComment;
1743 readonly parent: HasJSDoc;
1744 readonly tags?: NodeArray<JSDocTag>;
1745 readonly comment?: string;
1747 export interface JSDocTag extends Node {
1748 readonly parent: JSDoc | JSDocTypeLiteral;
1749 readonly tagName: Identifier;
1750 readonly comment?: string;
1752 export interface JSDocUnknownTag extends JSDocTag {
1753 readonly kind: SyntaxKind.JSDocTag;
1756 * Note that `@extends` is a synonym of `@augments`.
1757 * Both tags are represented by this interface.
1759 export interface JSDocAugmentsTag extends JSDocTag {
1760 readonly kind: SyntaxKind.JSDocAugmentsTag;
1761 readonly class: ExpressionWithTypeArguments & {
1762 readonly expression: Identifier | PropertyAccessEntityNameExpression;
1765 export interface JSDocImplementsTag extends JSDocTag {
1766 readonly kind: SyntaxKind.JSDocImplementsTag;
1767 readonly class: ExpressionWithTypeArguments & {
1768 readonly expression: Identifier | PropertyAccessEntityNameExpression;
1771 export interface JSDocAuthorTag extends JSDocTag {
1772 readonly kind: SyntaxKind.JSDocAuthorTag;
1774 export interface JSDocDeprecatedTag extends JSDocTag {
1775 kind: SyntaxKind.JSDocDeprecatedTag;
1777 export interface JSDocClassTag extends JSDocTag {
1778 readonly kind: SyntaxKind.JSDocClassTag;
1780 export interface JSDocPublicTag extends JSDocTag {
1781 readonly kind: SyntaxKind.JSDocPublicTag;
1783 export interface JSDocPrivateTag extends JSDocTag {
1784 readonly kind: SyntaxKind.JSDocPrivateTag;
1786 export interface JSDocProtectedTag extends JSDocTag {
1787 readonly kind: SyntaxKind.JSDocProtectedTag;
1789 export interface JSDocReadonlyTag extends JSDocTag {
1790 readonly kind: SyntaxKind.JSDocReadonlyTag;
1792 export interface JSDocEnumTag extends JSDocTag, Declaration {
1793 readonly kind: SyntaxKind.JSDocEnumTag;
1794 readonly parent: JSDoc;
1795 readonly typeExpression: JSDocTypeExpression;
1797 export interface JSDocThisTag extends JSDocTag {
1798 readonly kind: SyntaxKind.JSDocThisTag;
1799 readonly typeExpression: JSDocTypeExpression;
1801 export interface JSDocTemplateTag extends JSDocTag {
1802 readonly kind: SyntaxKind.JSDocTemplateTag;
1803 readonly constraint: JSDocTypeExpression | undefined;
1804 readonly typeParameters: NodeArray<TypeParameterDeclaration>;
1806 export interface JSDocSeeTag extends JSDocTag {
1807 readonly kind: SyntaxKind.JSDocSeeTag;
1808 readonly name?: JSDocNameReference;
1810 export interface JSDocReturnTag extends JSDocTag {
1811 readonly kind: SyntaxKind.JSDocReturnTag;
1812 readonly typeExpression?: JSDocTypeExpression;
1814 export interface JSDocTypeTag extends JSDocTag {
1815 readonly kind: SyntaxKind.JSDocTypeTag;
1816 readonly typeExpression: JSDocTypeExpression;
1818 export interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
1819 readonly kind: SyntaxKind.JSDocTypedefTag;
1820 readonly parent: JSDoc;
1821 readonly fullName?: JSDocNamespaceDeclaration | Identifier;
1822 readonly name?: Identifier;
1823 readonly typeExpression?: JSDocTypeExpression | JSDocTypeLiteral;
1825 export interface JSDocCallbackTag extends JSDocTag, NamedDeclaration {
1826 readonly kind: SyntaxKind.JSDocCallbackTag;
1827 readonly parent: JSDoc;
1828 readonly fullName?: JSDocNamespaceDeclaration | Identifier;
1829 readonly name?: Identifier;
1830 readonly typeExpression: JSDocSignature;
1832 export interface JSDocSignature extends JSDocType, Declaration {
1833 readonly kind: SyntaxKind.JSDocSignature;
1834 readonly typeParameters?: readonly JSDocTemplateTag[];
1835 readonly parameters: readonly JSDocParameterTag[];
1836 readonly type: JSDocReturnTag | undefined;
1838 export interface JSDocPropertyLikeTag extends JSDocTag, Declaration {
1839 readonly parent: JSDoc;
1840 readonly name: EntityName;
1841 readonly typeExpression?: JSDocTypeExpression;
1842 /** Whether the property name came before the type -- non-standard for JSDoc, but Typescript-like */
1843 readonly isNameFirst: boolean;
1844 readonly isBracketed: boolean;
1846 export interface JSDocPropertyTag extends JSDocPropertyLikeTag {
1847 readonly kind: SyntaxKind.JSDocPropertyTag;
1849 export interface JSDocParameterTag extends JSDocPropertyLikeTag {
1850 readonly kind: SyntaxKind.JSDocParameterTag;
1852 export interface JSDocTypeLiteral extends JSDocType {
1853 readonly kind: SyntaxKind.JSDocTypeLiteral;
1854 readonly jsDocPropertyTags?: readonly JSDocPropertyLikeTag[];
1855 /** If true, then this type literal represents an *array* of its type. */
1856 readonly isArrayType: boolean;
1858 export enum FlowFlags {
1865 FalseCondition = 64,
1867 ArrayMutation = 256,
1875 export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel;
1876 export interface FlowNodeBase {
1880 export interface FlowStart extends FlowNodeBase {
1881 node?: FunctionExpression | ArrowFunction | MethodDeclaration;
1883 export interface FlowLabel extends FlowNodeBase {
1884 antecedents: FlowNode[] | undefined;
1886 export interface FlowAssignment extends FlowNodeBase {
1887 node: Expression | VariableDeclaration | BindingElement;
1888 antecedent: FlowNode;
1890 export interface FlowCall extends FlowNodeBase {
1891 node: CallExpression;
1892 antecedent: FlowNode;
1894 export interface FlowCondition extends FlowNodeBase {
1896 antecedent: FlowNode;
1898 export interface FlowSwitchClause extends FlowNodeBase {
1899 switchStatement: SwitchStatement;
1900 clauseStart: number;
1902 antecedent: FlowNode;
1904 export interface FlowArrayMutation extends FlowNodeBase {
1905 node: CallExpression | BinaryExpression;
1906 antecedent: FlowNode;
1908 export interface FlowReduceLabel extends FlowNodeBase {
1910 antecedents: FlowNode[];
1911 antecedent: FlowNode;
1913 export type FlowType = Type | IncompleteType;
1914 export interface IncompleteType {
1918 export interface AmdDependency {
1922 export interface SourceFile extends Declaration {
1923 readonly kind: SyntaxKind.SourceFile;
1924 readonly statements: NodeArray<Statement>;
1925 readonly endOfFileToken: Token<SyntaxKind.EndOfFileToken>;
1928 amdDependencies: readonly AmdDependency[];
1929 moduleName?: string;
1930 referencedFiles: readonly FileReference[];
1931 typeReferenceDirectives: readonly FileReference[];
1932 libReferenceDirectives: readonly FileReference[];
1933 languageVariant: LanguageVariant;
1934 isDeclarationFile: boolean;
1936 * lib.d.ts should have a reference comment like
1938 * /// <reference no-default-lib="true"/>
1940 * If any other file has this comment, it signals not to include lib.d.ts
1941 * because this containing file is intended to act as a default library.
1943 hasNoDefaultLib: boolean;
1944 languageVersion: ScriptTarget;
1946 export interface Bundle extends Node {
1947 readonly kind: SyntaxKind.Bundle;
1948 readonly prepends: readonly (InputFiles | UnparsedSource)[];
1949 readonly sourceFiles: readonly SourceFile[];
1951 export interface InputFiles extends Node {
1952 readonly kind: SyntaxKind.InputFiles;
1953 javascriptPath?: string;
1954 javascriptText: string;
1955 javascriptMapPath?: string;
1956 javascriptMapText?: string;
1957 declarationPath?: string;
1958 declarationText: string;
1959 declarationMapPath?: string;
1960 declarationMapText?: string;
1962 export interface UnparsedSource extends Node {
1963 readonly kind: SyntaxKind.UnparsedSource;
1966 readonly prologues: readonly UnparsedPrologue[];
1967 helpers: readonly UnscopedEmitHelper[] | undefined;
1968 referencedFiles: readonly FileReference[];
1969 typeReferenceDirectives: readonly string[] | undefined;
1970 libReferenceDirectives: readonly FileReference[];
1971 hasNoDefaultLib?: boolean;
1972 sourceMapPath?: string;
1973 sourceMapText?: string;
1974 readonly syntheticReferences?: readonly UnparsedSyntheticReference[];
1975 readonly texts: readonly UnparsedSourceText[];
1977 export type UnparsedSourceText = UnparsedPrepend | UnparsedTextLike;
1978 export type UnparsedNode = UnparsedPrologue | UnparsedSourceText | UnparsedSyntheticReference;
1979 export interface UnparsedSection extends Node {
1980 readonly kind: SyntaxKind;
1981 readonly parent: UnparsedSource;
1982 readonly data?: string;
1984 export interface UnparsedPrologue extends UnparsedSection {
1985 readonly kind: SyntaxKind.UnparsedPrologue;
1986 readonly parent: UnparsedSource;
1987 readonly data: string;
1989 export interface UnparsedPrepend extends UnparsedSection {
1990 readonly kind: SyntaxKind.UnparsedPrepend;
1991 readonly parent: UnparsedSource;
1992 readonly data: string;
1993 readonly texts: readonly UnparsedTextLike[];
1995 export interface UnparsedTextLike extends UnparsedSection {
1996 readonly kind: SyntaxKind.UnparsedText | SyntaxKind.UnparsedInternalText;
1997 readonly parent: UnparsedSource;
1999 export interface UnparsedSyntheticReference extends UnparsedSection {
2000 readonly kind: SyntaxKind.UnparsedSyntheticReference;
2001 readonly parent: UnparsedSource;
2003 export interface JsonSourceFile extends SourceFile {
2004 readonly statements: NodeArray<JsonObjectExpressionStatement>;
2006 export interface TsConfigSourceFile extends JsonSourceFile {
2007 extendedSourceFiles?: string[];
2009 export interface JsonMinusNumericLiteral extends PrefixUnaryExpression {
2010 readonly kind: SyntaxKind.PrefixUnaryExpression;
2011 readonly operator: SyntaxKind.MinusToken;
2012 readonly operand: NumericLiteral;
2014 export type JsonObjectExpression = ObjectLiteralExpression | ArrayLiteralExpression | JsonMinusNumericLiteral | NumericLiteral | StringLiteral | BooleanLiteral | NullLiteral;
2015 export interface JsonObjectExpressionStatement extends ExpressionStatement {
2016 readonly expression: JsonObjectExpression;
2018 export interface ScriptReferenceHost {
2019 getCompilerOptions(): CompilerOptions;
2020 getSourceFile(fileName: string): SourceFile | undefined;
2021 getSourceFileByPath(path: Path): SourceFile | undefined;
2022 getCurrentDirectory(): string;
2024 export interface ParseConfigHost {
2025 useCaseSensitiveFileNames: boolean;
2026 readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): readonly string[];
2028 * Gets a value indicating whether the specified path exists and is a file.
2029 * @param path The path to test.
2031 fileExists(path: string): boolean;
2032 readFile(path: string): string | undefined;
2033 trace?(s: string): void;
2036 * Branded string for keeping track of when we've turned an ambiguous path
2037 * specified like "./blah" to an absolute path to an actual
2038 * tsconfig file, e.g. "/root/blah/tsconfig.json"
2040 export type ResolvedConfigFileName = string & {
2041 _isResolvedConfigFileName: never;
2043 export type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: readonly SourceFile[]) => void;
2044 export class OperationCanceledException {
2046 export interface CancellationToken {
2047 isCancellationRequested(): boolean;
2048 /** @throws OperationCanceledException if isCancellationRequested is true */
2049 throwIfCancellationRequested(): void;
2051 export interface Program extends ScriptReferenceHost {
2052 getCurrentDirectory(): string;
2054 * Get a list of root file names that were passed to a 'createProgram'
2056 getRootFileNames(): readonly string[];
2058 * Get a list of files in the program
2060 getSourceFiles(): readonly SourceFile[];
2062 * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
2063 * the JavaScript and declaration files will be produced for all the files in this program.
2064 * If targetSourceFile is specified, then only the JavaScript and declaration for that
2065 * specific file will be generated.
2067 * If writeFile is not specified then the writeFile callback from the compiler host will be
2068 * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
2069 * will be invoked when writing the JavaScript and declaration files.
2071 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
2072 getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[];
2073 getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[];
2074 getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[];
2075 /** The first time this is called, it will return global diagnostics (no location). */
2076 getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
2077 getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[];
2078 getConfigFileParsingDiagnostics(): readonly Diagnostic[];
2080 * Gets a type checker that can be used to semantically analyze source files in the program.
2082 getTypeChecker(): TypeChecker;
2083 getTypeCatalog(): readonly Type[];
2084 getNodeCount(): number;
2085 getIdentifierCount(): number;
2086 getSymbolCount(): number;
2087 getTypeCount(): number;
2088 getInstantiationCount(): number;
2089 getRelationCacheSizes(): {
2093 strictSubtype: number;
2095 isSourceFileFromExternalLibrary(file: SourceFile): boolean;
2096 isSourceFileDefaultLibrary(file: SourceFile): boolean;
2097 getProjectReferences(): readonly ProjectReference[] | undefined;
2098 getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined;
2100 export interface ResolvedProjectReference {
2101 commandLine: ParsedCommandLine;
2102 sourceFile: SourceFile;
2103 references?: readonly (ResolvedProjectReference | undefined)[];
2105 export type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer;
2106 export interface CustomTransformer {
2107 transformSourceFile(node: SourceFile): SourceFile;
2108 transformBundle(node: Bundle): Bundle;
2110 export interface CustomTransformers {
2111 /** Custom transformers to evaluate before built-in .js transformations. */
2112 before?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
2113 /** Custom transformers to evaluate after built-in .js transformations. */
2114 after?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
2115 /** Custom transformers to evaluate after built-in .d.ts transformations. */
2116 afterDeclarations?: (TransformerFactory<Bundle | SourceFile> | CustomTransformerFactory)[];
2118 export interface SourceMapSpan {
2119 /** Line number in the .js file. */
2120 emittedLine: number;
2121 /** Column number in the .js file. */
2122 emittedColumn: number;
2123 /** Line number in the .ts file. */
2125 /** Column number in the .ts file. */
2126 sourceColumn: number;
2127 /** Optional name (index into names array) associated with this span. */
2129 /** .ts file (index into sources array) associated with this span */
2130 sourceIndex: number;
2132 /** Return code used by getEmitOutput function to indicate status of the function */
2133 export enum ExitStatus {
2135 DiagnosticsPresent_OutputsSkipped = 1,
2136 DiagnosticsPresent_OutputsGenerated = 2,
2137 InvalidProject_OutputsSkipped = 3,
2138 ProjectReferenceCycle_OutputsSkipped = 4,
2139 /** @deprecated Use ProjectReferenceCycle_OutputsSkipped instead. */
2140 ProjectReferenceCycle_OutputsSkupped = 4
2142 export interface EmitResult {
2143 emitSkipped: boolean;
2144 /** Contains declaration emit diagnostics */
2145 diagnostics: readonly Diagnostic[];
2146 emittedFiles?: string[];
2148 export interface TypeChecker {
2149 getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
2150 getDeclaredTypeOfSymbol(symbol: Symbol): Type;
2151 getPropertiesOfType(type: Type): Symbol[];
2152 getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
2153 getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined;
2154 getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
2155 getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[];
2156 getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
2157 getBaseTypes(type: InterfaceType): BaseType[];
2158 getBaseTypeOfLiteralType(type: Type): Type;
2159 getWidenedType(type: Type): Type;
2160 getReturnTypeOfSignature(signature: Signature): Type;
2161 getNullableType(type: Type, flags: TypeFlags): Type;
2162 getNonNullableType(type: Type): Type;
2163 getTypeArguments(type: TypeReference): readonly Type[];
2164 /** Note that the resulting nodes cannot be checked. */
2165 typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeNode | undefined;
2166 /** Note that the resulting nodes cannot be checked. */
2167 signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): SignatureDeclaration & {
2168 typeArguments?: NodeArray<TypeNode>;
2170 /** Note that the resulting nodes cannot be checked. */
2171 indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): IndexSignatureDeclaration | undefined;
2172 /** Note that the resulting nodes cannot be checked. */
2173 symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): EntityName | undefined;
2174 /** Note that the resulting nodes cannot be checked. */
2175 symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): Expression | undefined;
2176 /** Note that the resulting nodes cannot be checked. */
2177 symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeArray<TypeParameterDeclaration> | undefined;
2178 /** Note that the resulting nodes cannot be checked. */
2179 symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined;
2180 /** Note that the resulting nodes cannot be checked. */
2181 typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined;
2182 getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
2183 getSymbolAtLocation(node: Node): Symbol | undefined;
2184 getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
2186 * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment.
2187 * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value.
2189 getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
2190 getExportSpecifierLocalTargetSymbol(location: ExportSpecifier | Identifier): Symbol | undefined;
2192 * If a symbol is a local symbol with an associated exported symbol, returns the exported symbol.
2193 * Otherwise returns its input.
2194 * For example, at `export type T = number;`:
2195 * - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`.
2196 * - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol.
2197 * - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol.
2199 getExportSymbolOfSymbol(symbol: Symbol): Symbol;
2200 getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
2201 getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type;
2202 getTypeAtLocation(node: Node): Type;
2203 getTypeFromTypeNode(node: TypeNode): Type;
2204 signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
2205 typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
2206 symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string;
2207 typePredicateToString(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
2208 getFullyQualifiedName(symbol: Symbol): string;
2209 getAugmentedPropertiesOfType(type: Type): Symbol[];
2210 getRootSymbols(symbol: Symbol): readonly Symbol[];
2211 getSymbolOfExpando(node: Node, allowDeclaration: boolean): Symbol | undefined;
2212 getContextualType(node: Expression): Type | undefined;
2214 * returns unknownSignature in the case of an error.
2215 * returns undefined if the node is not valid.
2216 * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`.
2218 getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined;
2219 getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined;
2220 isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined;
2221 isUndefinedSymbol(symbol: Symbol): boolean;
2222 isArgumentsSymbol(symbol: Symbol): boolean;
2223 isUnknownSymbol(symbol: Symbol): boolean;
2224 getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined;
2225 isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean;
2226 /** Follow all aliases to get the original symbol. */
2227 getAliasedSymbol(symbol: Symbol): Symbol;
2228 getExportsOfModule(moduleSymbol: Symbol): Symbol[];
2229 getJsxIntrinsicTagNamesAt(location: Node): Symbol[];
2230 isOptionalParameter(node: ParameterDeclaration): boolean;
2231 getAmbientModules(): Symbol[];
2232 tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
2233 getApparentType(type: Type): Type;
2234 getBaseConstraintOfType(type: Type): Type | undefined;
2235 getDefaultFromTypeParameter(type: Type): Type | undefined;
2237 * Depending on the operation performed, it may be appropriate to throw away the checker
2238 * if the cancellation token is triggered. Typically, if it is used for error checking
2239 * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep.
2241 runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
2243 export enum NodeBuilderFlags {
2246 WriteArrayAsGenericType = 2,
2247 GenerateNamesForShadowedTypeParams = 4,
2248 UseStructuralFallback = 8,
2249 ForbidIndexedAccessSymbolReferences = 16,
2250 WriteTypeArgumentsOfSignature = 32,
2251 UseFullyQualifiedType = 64,
2252 UseOnlyExternalAliasing = 128,
2253 SuppressAnyReturnType = 256,
2254 WriteTypeParametersInQualifiedName = 512,
2255 MultilineObjectLiterals = 1024,
2256 WriteClassExpressionAsTypeLiteral = 2048,
2257 UseTypeOfFunction = 4096,
2258 OmitParameterModifiers = 8192,
2259 UseAliasDefinedOutsideCurrentScope = 16384,
2260 UseSingleQuotesForStringLiteralType = 268435456,
2261 NoTypeReduction = 536870912,
2262 NoUndefinedOptionalParameterType = 1073741824,
2263 AllowThisInObjectLiteral = 32768,
2264 AllowQualifedNameInPlaceOfIdentifier = 65536,
2265 AllowAnonymousIdentifier = 131072,
2266 AllowEmptyUnionOrIntersection = 262144,
2267 AllowEmptyTuple = 524288,
2268 AllowUniqueESSymbolType = 1048576,
2269 AllowEmptyIndexInfoType = 2097152,
2270 AllowNodeModulesRelativePaths = 67108864,
2271 IgnoreErrors = 70221824,
2272 InObjectTypeLiteral = 4194304,
2273 InTypeAlias = 8388608,
2274 InInitialEntityName = 16777216,
2275 InReverseMappedType = 33554432
2277 export enum TypeFormatFlags {
2280 WriteArrayAsGenericType = 2,
2281 UseStructuralFallback = 8,
2282 WriteTypeArgumentsOfSignature = 32,
2283 UseFullyQualifiedType = 64,
2284 SuppressAnyReturnType = 256,
2285 MultilineObjectLiterals = 1024,
2286 WriteClassExpressionAsTypeLiteral = 2048,
2287 UseTypeOfFunction = 4096,
2288 OmitParameterModifiers = 8192,
2289 UseAliasDefinedOutsideCurrentScope = 16384,
2290 UseSingleQuotesForStringLiteralType = 268435456,
2291 NoTypeReduction = 536870912,
2292 AllowUniqueESSymbolType = 1048576,
2293 AddUndefined = 131072,
2294 WriteArrowStyleSignature = 262144,
2295 InArrayType = 524288,
2296 InElementType = 2097152,
2297 InFirstTypeArgument = 4194304,
2298 InTypeAlias = 8388608,
2299 /** @deprecated */ WriteOwnNameForAnyLike = 0,
2300 NodeBuilderFlagsMask = 814775659
2302 export enum SymbolFormatFlags {
2304 WriteTypeParametersOrArguments = 1,
2305 UseOnlyExternalAliasing = 2,
2306 AllowAnyNodeKind = 4,
2307 UseAliasDefinedOutsideCurrentScope = 8,
2309 export enum TypePredicateKind {
2313 AssertsIdentifier = 3
2315 export interface TypePredicateBase {
2316 kind: TypePredicateKind;
2317 type: Type | undefined;
2319 export interface ThisTypePredicate extends TypePredicateBase {
2320 kind: TypePredicateKind.This;
2321 parameterName: undefined;
2322 parameterIndex: undefined;
2325 export interface IdentifierTypePredicate extends TypePredicateBase {
2326 kind: TypePredicateKind.Identifier;
2327 parameterName: string;
2328 parameterIndex: number;
2331 export interface AssertsThisTypePredicate extends TypePredicateBase {
2332 kind: TypePredicateKind.AssertsThis;
2333 parameterName: undefined;
2334 parameterIndex: undefined;
2335 type: Type | undefined;
2337 export interface AssertsIdentifierTypePredicate extends TypePredicateBase {
2338 kind: TypePredicateKind.AssertsIdentifier;
2339 parameterName: string;
2340 parameterIndex: number;
2341 type: Type | undefined;
2343 export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate;
2344 export enum SymbolFlags {
2346 FunctionScopedVariable = 1,
2347 BlockScopedVariable = 2,
2356 NamespaceModule = 1024,
2358 ObjectLiteral = 4096,
2360 Constructor = 16384,
2361 GetAccessor = 32768,
2362 SetAccessor = 65536,
2364 TypeParameter = 262144,
2366 ExportValue = 1048576,
2368 Prototype = 4194304,
2369 ExportStar = 8388608,
2370 Optional = 16777216,
2371 Transient = 33554432,
2372 Assignment = 67108864,
2373 ModuleExports = 134217728,
2381 FunctionScopedVariableExcludes = 111550,
2382 BlockScopedVariableExcludes = 111551,
2383 ParameterExcludes = 111551,
2384 PropertyExcludes = 0,
2385 EnumMemberExcludes = 900095,
2386 FunctionExcludes = 110991,
2387 ClassExcludes = 899503,
2388 InterfaceExcludes = 788872,
2389 RegularEnumExcludes = 899327,
2390 ConstEnumExcludes = 899967,
2391 ValueModuleExcludes = 110735,
2392 NamespaceModuleExcludes = 0,
2393 MethodExcludes = 103359,
2394 GetAccessorExcludes = 46015,
2395 SetAccessorExcludes = 78783,
2396 TypeParameterExcludes = 526824,
2397 TypeAliasExcludes = 788968,
2398 AliasExcludes = 2097152,
2399 ModuleMember = 2623475,
2400 ExportHasLocal = 944,
2402 PropertyOrAccessor = 98308,
2403 ClassMember = 106500,
2405 export interface Symbol {
2407 escapedName: __String;
2408 declarations: Declaration[];
2409 valueDeclaration: Declaration;
2410 members?: SymbolTable;
2411 exports?: SymbolTable;
2412 globalExports?: SymbolTable;
2414 export enum InternalSymbolName {
2416 Constructor = "__constructor",
2419 ExportStar = "__export",
2420 Global = "__global",
2421 Missing = "__missing",
2423 Object = "__object",
2424 JSXAttributes = "__jsxAttributes",
2426 Function = "__function",
2427 Computed = "__computed",
2428 Resolving = "__resolving__",
2429 ExportEquals = "export=",
2430 Default = "default",
2434 * This represents a string whose leading underscore have been escaped by adding extra leading underscores.
2435 * The shape of this brand is rather unique compared to others we've used.
2436 * Instead of just an intersection of a string and an object, it is that union-ed
2437 * with an intersection of void and an object. This makes it wholly incompatible
2438 * with a normal string (which is good, it cannot be misused on assignment or on usage),
2439 * while still being comparable with a normal string via === (also good) and castable from a string.
2441 export type __String = (string & {
2442 __escapedIdentifier: void;
2444 __escapedIdentifier: void;
2445 }) | InternalSymbolName;
2446 /** ReadonlyMap where keys are `__String`s. */
2447 export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyESMap<__String, T> {
2449 /** Map where keys are `__String`s. */
2450 export interface UnderscoreEscapedMap<T> extends ESMap<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
2452 /** SymbolTable based on ES6 Map interface. */
2453 export type SymbolTable = UnderscoreEscapedMap<Symbol>;
2454 export enum TypeFlags {
2462 StringLiteral = 128,
2463 NumberLiteral = 256,
2464 BooleanLiteral = 512,
2466 BigIntLiteral = 2048,
2468 UniqueESSymbol = 8192,
2473 TypeParameter = 262144,
2476 Intersection = 2097152,
2478 IndexedAccess = 8388608,
2479 Conditional = 16777216,
2480 Substitution = 33554432,
2481 NonPrimitive = 67108864,
2482 TemplateLiteral = 134217728,
2483 StringMapping = 268435456,
2486 StringOrNumberLiteral = 384,
2487 PossiblyFalsy = 117724,
2488 StringLike = 402653316,
2493 ESSymbolLike = 12288,
2495 UnionOrIntersection = 3145728,
2496 StructuredType = 3670016,
2497 TypeVariable = 8650752,
2498 InstantiableNonPrimitive = 58982400,
2499 InstantiablePrimitive = 406847488,
2500 Instantiable = 465829888,
2501 StructuredOrInstantiable = 469499904,
2502 Narrowable = 536624127,
2504 export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
2505 export interface Type {
2508 pattern?: DestructuringPattern;
2509 aliasSymbol?: Symbol;
2510 aliasTypeArguments?: readonly Type[];
2512 export interface LiteralType extends Type {
2513 value: string | number | PseudoBigInt;
2514 freshType: LiteralType;
2515 regularType: LiteralType;
2517 export interface UniqueESSymbolType extends Type {
2519 escapedName: __String;
2521 export interface StringLiteralType extends LiteralType {
2524 export interface NumberLiteralType extends LiteralType {
2527 export interface BigIntLiteralType extends LiteralType {
2528 value: PseudoBigInt;
2530 export interface EnumType extends Type {
2532 export enum ObjectFlags {
2540 ObjectLiteral = 128,
2541 EvolvingArray = 256,
2542 ObjectLiteralPatternWithComputedProperties = 512,
2543 ContainsSpread = 1024,
2544 ReverseMapped = 2048,
2545 JsxAttributes = 4096,
2548 FreshLiteral = 32768,
2549 ArrayLiteral = 65536,
2550 ObjectRestType = 131072,
2551 ClassOrInterface = 3,
2553 export interface ObjectType extends Type {
2554 objectFlags: ObjectFlags;
2556 /** Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). */
2557 export interface InterfaceType extends ObjectType {
2558 typeParameters: TypeParameter[] | undefined;
2559 outerTypeParameters: TypeParameter[] | undefined;
2560 localTypeParameters: TypeParameter[] | undefined;
2561 thisType: TypeParameter | undefined;
2563 export type BaseType = ObjectType | IntersectionType | TypeVariable;
2564 export interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
2565 declaredProperties: Symbol[];
2566 declaredCallSignatures: Signature[];
2567 declaredConstructSignatures: Signature[];
2568 declaredStringIndexInfo?: IndexInfo;
2569 declaredNumberIndexInfo?: IndexInfo;
2572 * Type references (ObjectFlags.Reference). When a class or interface has type parameters or
2573 * a "this" type, references to the class or interface are made using type references. The
2574 * typeArguments property specifies the types to substitute for the type parameters of the
2575 * class or interface and optionally includes an extra element that specifies the type to
2576 * substitute for "this" in the resulting instantiation. When no extra argument is present,
2577 * the type reference itself is substituted for "this". The typeArguments property is undefined
2578 * if the class or interface has no type parameters and the reference isn't specifying an
2579 * explicit "this" argument.
2581 export interface TypeReference extends ObjectType {
2582 target: GenericType;
2583 node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
2585 export interface DeferredTypeReference extends TypeReference {
2587 export interface GenericType extends InterfaceType, TypeReference {
2589 export enum ElementFlags {
2599 export interface TupleType extends GenericType {
2600 elementFlags: readonly ElementFlags[];
2602 fixedLength: number;
2603 hasRestElement: boolean;
2604 combinedFlags: ElementFlags;
2606 labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
2608 export interface TupleTypeReference extends TypeReference {
2611 export interface UnionOrIntersectionType extends Type {
2614 export interface UnionType extends UnionOrIntersectionType {
2616 export interface IntersectionType extends UnionOrIntersectionType {
2618 export type StructuredType = ObjectType | UnionType | IntersectionType;
2619 export interface EvolvingArrayType extends ObjectType {
2621 finalArrayType?: Type;
2623 export interface InstantiableType extends Type {
2625 export interface TypeParameter extends InstantiableType {
2627 export interface IndexedAccessType extends InstantiableType {
2631 simplifiedForReading?: Type;
2632 simplifiedForWriting?: Type;
2634 export type TypeVariable = TypeParameter | IndexedAccessType;
2635 export interface IndexType extends InstantiableType {
2636 type: InstantiableType | UnionOrIntersectionType;
2638 export interface ConditionalRoot {
2639 node: ConditionalTypeNode;
2642 isDistributive: boolean;
2643 inferTypeParameters?: TypeParameter[];
2644 outerTypeParameters?: TypeParameter[];
2645 instantiations?: Map<Type>;
2646 aliasSymbol?: Symbol;
2647 aliasTypeArguments?: Type[];
2649 export interface ConditionalType extends InstantiableType {
2650 root: ConditionalRoot;
2653 resolvedTrueType: Type;
2654 resolvedFalseType: Type;
2656 export interface TemplateLiteralType extends InstantiableType {
2657 texts: readonly string[];
2658 types: readonly Type[];
2660 export interface StringMappingType extends InstantiableType {
2664 export interface SubstitutionType extends InstantiableType {
2668 export enum SignatureKind {
2672 export interface Signature {
2673 declaration?: SignatureDeclaration | JSDocSignature;
2674 typeParameters?: readonly TypeParameter[];
2675 parameters: readonly Symbol[];
2677 export enum IndexKind {
2681 export interface IndexInfo {
2683 isReadonly: boolean;
2684 declaration?: IndexSignatureDeclaration;
2686 export enum InferencePriority {
2687 NakedTypeVariable = 1,
2688 SpeculativeTuple = 2,
2689 HomomorphicMappedType = 4,
2690 PartialHomomorphicMappedType = 8,
2691 MappedTypeConstraint = 16,
2692 ContravariantConditional = 32,
2695 NoConstraints = 256,
2698 PriorityImpliesCombination = 208,
2701 /** @deprecated Use FileExtensionInfo instead. */
2702 export type JsFileExtensionInfo = FileExtensionInfo;
2703 export interface FileExtensionInfo {
2705 isMixedContent: boolean;
2706 scriptKind?: ScriptKind;
2708 export interface DiagnosticMessage {
2710 category: DiagnosticCategory;
2713 reportsUnnecessary?: {};
2714 reportsDeprecated?: {};
2717 * A linked list of formatted diagnostic messages to be used as part of a multiline message.
2718 * It is built from the bottom up, leaving the head to be the "main" diagnostic.
2719 * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
2720 * the difference is that messages are all preformatted in DMC.
2722 export interface DiagnosticMessageChain {
2723 messageText: string;
2724 category: DiagnosticCategory;
2726 next?: DiagnosticMessageChain[];
2728 export interface Diagnostic extends DiagnosticRelatedInformation {
2729 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
2730 reportsUnnecessary?: {};
2731 reportsDeprecated?: {};
2733 relatedInformation?: DiagnosticRelatedInformation[];
2735 export interface DiagnosticRelatedInformation {
2736 category: DiagnosticCategory;
2738 file: SourceFile | undefined;
2739 start: number | undefined;
2740 length: number | undefined;
2741 messageText: string | DiagnosticMessageChain;
2743 export interface DiagnosticWithLocation extends Diagnostic {
2748 export enum DiagnosticCategory {
2754 export enum ModuleResolutionKind {
2758 export interface PluginImport {
2761 export interface ProjectReference {
2762 /** A normalized path on disk */
2764 /** The path as the user originally wrote it */
2765 originalPath?: string;
2766 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
2768 /** True if it is intended that this reference form a circularity */
2771 export enum WatchFileKind {
2772 FixedPollingInterval = 0,
2773 PriorityPollingInterval = 1,
2774 DynamicPriorityPolling = 2,
2776 UseFsEventsOnParentDirectory = 4
2778 export enum WatchDirectoryKind {
2780 FixedPollingInterval = 1,
2781 DynamicPriorityPolling = 2
2783 export enum PollingWatchKind {
2785 PriorityInterval = 1,
2788 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined;
2789 export interface CompilerOptions {
2791 allowSyntheticDefaultImports?: boolean;
2792 allowUmdGlobalAccess?: boolean;
2793 allowUnreachableCode?: boolean;
2794 allowUnusedLabels?: boolean;
2795 alwaysStrict?: boolean;
2799 declaration?: boolean;
2800 declarationMap?: boolean;
2801 emitDeclarationOnly?: boolean;
2802 declarationDir?: string;
2803 disableSizeLimit?: boolean;
2804 disableSourceOfProjectReferenceRedirect?: boolean;
2805 disableSolutionSearching?: boolean;
2806 disableReferencedProjectLoad?: boolean;
2807 downlevelIteration?: boolean;
2809 emitDecoratorMetadata?: boolean;
2810 experimentalDecorators?: boolean;
2811 forceConsistentCasingInFileNames?: boolean;
2812 importHelpers?: boolean;
2813 importsNotUsedAsValues?: ImportsNotUsedAsValues;
2814 inlineSourceMap?: boolean;
2815 inlineSources?: boolean;
2816 isolatedModules?: boolean;
2818 keyofStringsOnly?: boolean;
2822 maxNodeModuleJsDepth?: number;
2823 module?: ModuleKind;
2824 moduleResolution?: ModuleResolutionKind;
2825 newLine?: NewLineKind;
2827 noEmitHelpers?: boolean;
2828 noEmitOnError?: boolean;
2829 noErrorTruncation?: boolean;
2830 noFallthroughCasesInSwitch?: boolean;
2831 noImplicitAny?: boolean;
2832 noImplicitReturns?: boolean;
2833 noImplicitThis?: boolean;
2834 noStrictGenericChecks?: boolean;
2835 noUnusedLocals?: boolean;
2836 noUnusedParameters?: boolean;
2837 noImplicitUseStrict?: boolean;
2838 noPropertyAccessFromIndexSignature?: boolean;
2839 assumeChangesOnlyAffectDirectDependencies?: boolean;
2841 noResolve?: boolean;
2842 noUncheckedIndexedAccess?: boolean;
2846 paths?: MapLike<string[]>;
2847 preserveConstEnums?: boolean;
2848 preserveSymlinks?: boolean;
2850 reactNamespace?: string;
2851 jsxFactory?: string;
2852 jsxFragmentFactory?: string;
2853 jsxImportSource?: string;
2854 composite?: boolean;
2855 incremental?: boolean;
2856 tsBuildInfoFile?: string;
2857 removeComments?: boolean;
2859 rootDirs?: string[];
2860 skipLibCheck?: boolean;
2861 skipDefaultLibCheck?: boolean;
2862 sourceMap?: boolean;
2863 sourceRoot?: string;
2865 strictFunctionTypes?: boolean;
2866 strictBindCallApply?: boolean;
2867 strictNullChecks?: boolean;
2868 strictPropertyInitialization?: boolean;
2869 stripInternal?: boolean;
2870 suppressExcessPropertyErrors?: boolean;
2871 suppressImplicitAnyIndexErrors?: boolean;
2872 target?: ScriptTarget;
2873 traceResolution?: boolean;
2874 resolveJsonModule?: boolean;
2876 /** Paths used to compute primary types search locations */
2877 typeRoots?: string[];
2878 esModuleInterop?: boolean;
2879 useDefineForClassFields?: boolean;
2880 [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined;
2882 export interface WatchOptions {
2883 watchFile?: WatchFileKind;
2884 watchDirectory?: WatchDirectoryKind;
2885 fallbackPolling?: PollingWatchKind;
2886 synchronousWatchDirectory?: boolean;
2887 excludeDirectories?: string[];
2888 excludeFiles?: string[];
2889 [option: string]: CompilerOptionsValue | undefined;
2891 export interface TypeAcquisition {
2893 * @deprecated typingOptions.enableAutoDiscovery
2894 * Use typeAcquisition.enable instead.
2896 enableAutoDiscovery?: boolean;
2900 disableFilenameBasedTypeAcquisition?: boolean;
2901 [option: string]: CompilerOptionsValue | undefined;
2903 export enum ModuleKind {
2913 export enum JsxEmit {
2921 export enum ImportsNotUsedAsValues {
2926 export enum NewLineKind {
2927 CarriageReturnLineFeed = 0,
2930 export interface LineAndCharacter {
2935 export enum ScriptKind {
2944 * Used on extensions that doesn't define the ScriptKind but the content defines it.
2945 * Deferred extensions are going to be included in all project contexts.
2949 export enum ScriptTarget {
2962 export enum LanguageVariant {
2966 /** Either a parsed command line or a parsed tsconfig.json */
2967 export interface ParsedCommandLine {
2968 options: CompilerOptions;
2969 typeAcquisition?: TypeAcquisition;
2970 fileNames: string[];
2971 projectReferences?: readonly ProjectReference[];
2972 watchOptions?: WatchOptions;
2974 errors: Diagnostic[];
2975 wildcardDirectories?: MapLike<WatchDirectoryFlags>;
2976 compileOnSave?: boolean;
2978 export enum WatchDirectoryFlags {
2982 export interface CreateProgramOptions {
2983 rootNames: readonly string[];
2984 options: CompilerOptions;
2985 projectReferences?: readonly ProjectReference[];
2986 host?: CompilerHost;
2987 oldProgram?: Program;
2988 configFileParsingDiagnostics?: readonly Diagnostic[];
2990 export interface ModuleResolutionHost {
2991 fileExists(fileName: string): boolean;
2992 readFile(fileName: string): string | undefined;
2993 trace?(s: string): void;
2994 directoryExists?(directoryName: string): boolean;
2996 * Resolve a symbolic link.
2997 * @see https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options
2999 realpath?(path: string): string;
3000 getCurrentDirectory?(): string;
3001 getDirectories?(path: string): string[];
3004 * Represents the result of module resolution.
3005 * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
3006 * The Program will then filter results based on these flags.
3008 * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
3010 export interface ResolvedModule {
3011 /** Path of the file the module was resolved to. */
3012 resolvedFileName: string;
3013 /** True if `resolvedFileName` comes from `node_modules`. */
3014 isExternalLibraryImport?: boolean;
3017 * ResolvedModule with an explicitly provided `extension` property.
3018 * Prefer this over `ResolvedModule`.
3019 * If changing this, remember to change `moduleResolutionIsEqualTo`.
3021 export interface ResolvedModuleFull extends ResolvedModule {
3023 * Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
3024 * This is optional for backwards-compatibility, but will be added if not provided.
3026 extension: Extension;
3027 packageId?: PackageId;
3030 * Unique identifier with a package name and version.
3031 * If changing this, remember to change `packageIdIsEqual`.
3033 export interface PackageId {
3035 * Name of the package.
3036 * Should not include `@types`.
3037 * If accessing a non-index file, this should include its name e.g. "foo/bar".
3041 * Name of a submodule within this package.
3044 subModuleName: string;
3045 /** Version of the package, e.g. "1.2.3" */
3048 export enum Extension {
3055 TsBuildInfo = ".tsbuildinfo"
3057 export interface ResolvedModuleWithFailedLookupLocations {
3058 readonly resolvedModule: ResolvedModuleFull | undefined;
3060 export interface ResolvedTypeReferenceDirective {
3062 resolvedFileName: string | undefined;
3063 packageId?: PackageId;
3064 /** True if `resolvedFileName` comes from `node_modules`. */
3065 isExternalLibraryImport?: boolean;
3067 export interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
3068 readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined;
3069 readonly failedLookupLocations: string[];
3071 export interface CompilerHost extends ModuleResolutionHost {
3072 getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3073 getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3074 getCancellationToken?(): CancellationToken;
3075 getDefaultLibFileName(options: CompilerOptions): string;
3076 getDefaultLibLocation?(): string;
3077 writeFile: WriteFileCallback;
3078 getCurrentDirectory(): string;
3079 getCanonicalFileName(fileName: string): string;
3080 useCaseSensitiveFileNames(): boolean;
3081 getNewLine(): string;
3082 readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
3083 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
3085 * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
3087 resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
3088 getEnvironmentVariable?(name: string): string | undefined;
3089 createHash?(data: string): string;
3090 getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
3092 export interface SourceMapRange extends TextRange {
3093 source?: SourceMapSource;
3095 export interface SourceMapSource {
3098 skipTrivia?: (pos: number) => number;
3100 export enum EmitFlags {
3103 AdviseOnEmitNode = 2,
3106 NoLeadingSourceMap = 16,
3107 NoTrailingSourceMap = 32,
3109 NoNestedSourceMaps = 64,
3110 NoTokenLeadingSourceMaps = 128,
3111 NoTokenTrailingSourceMaps = 256,
3112 NoTokenSourceMaps = 384,
3113 NoLeadingComments = 512,
3114 NoTrailingComments = 1024,
3116 NoNestedComments = 2048,
3120 InternalName = 32768,
3122 NoIndentation = 131072,
3123 AsyncFunctionBody = 262144,
3124 ReuseTempVariableScope = 524288,
3125 CustomPrologue = 1048576,
3126 NoHoisting = 2097152,
3127 HasEndOfDeclarationMarker = 4194304,
3129 NoAsciiEscaping = 16777216,
3131 export interface EmitHelper {
3132 readonly name: string;
3133 readonly scoped: boolean;
3134 readonly text: string | ((node: EmitHelperUniqueNameCallback) => string);
3135 readonly priority?: number;
3136 readonly dependencies?: EmitHelper[];
3138 export interface UnscopedEmitHelper extends EmitHelper {
3139 readonly scoped: false;
3140 readonly text: string;
3142 export type EmitHelperUniqueNameCallback = (name: string) => string;
3143 export enum EmitHint {
3147 MappedTypeParameter = 3,
3149 EmbeddedStatement = 5,
3150 JsxAttributeValue = 6
3152 export enum OuterExpressionKinds {
3155 NonNullAssertions = 4,
3156 PartiallyEmittedExpressions = 8,
3160 export type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function";
3161 export interface NodeFactory {
3162 createNodeArray<T extends Node>(elements?: readonly T[], hasTrailingComma?: boolean): NodeArray<T>;
3163 createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral;
3164 createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral;
3165 createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral;
3166 createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral;
3167 createRegularExpressionLiteral(text: string): RegularExpressionLiteral;
3168 createIdentifier(text: string): Identifier;
3169 /** Create a unique temporary variable. */
3170 createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier;
3171 /** Create a unique temporary variable for use in a loop. */
3172 createLoopVariable(): Identifier;
3173 /** Create a unique name based on the supplied text. */
3174 createUniqueName(text: string, flags?: GeneratedIdentifierFlags): Identifier;
3175 /** Create a unique name generated for a node. */
3176 getGeneratedNameForNode(node: Node | undefined): Identifier;
3177 createPrivateIdentifier(text: string): PrivateIdentifier;
3178 createToken(token: SyntaxKind.SuperKeyword): SuperExpression;
3179 createToken(token: SyntaxKind.ThisKeyword): ThisExpression;
3180 createToken(token: SyntaxKind.NullKeyword): NullLiteral;
3181 createToken(token: SyntaxKind.TrueKeyword): TrueLiteral;
3182 createToken(token: SyntaxKind.FalseKeyword): FalseLiteral;
3183 createToken<TKind extends PunctuationSyntaxKind>(token: TKind): PunctuationToken<TKind>;
3184 createToken<TKind extends KeywordTypeSyntaxKind>(token: TKind): KeywordTypeNode<TKind>;
3185 createToken<TKind extends ModifierSyntaxKind>(token: TKind): ModifierToken<TKind>;
3186 createToken<TKind extends KeywordSyntaxKind>(token: TKind): KeywordToken<TKind>;
3187 createToken<TKind extends SyntaxKind.Unknown | SyntaxKind.EndOfFileToken>(token: TKind): Token<TKind>;
3188 createSuper(): SuperExpression;
3189 createThis(): ThisExpression;
3190 createNull(): NullLiteral;
3191 createTrue(): TrueLiteral;
3192 createFalse(): FalseLiteral;
3193 createModifier<T extends ModifierSyntaxKind>(kind: T): ModifierToken<T>;
3194 createModifiersFromModifierFlags(flags: ModifierFlags): Modifier[];
3195 createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName;
3196 updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName;
3197 createComputedPropertyName(expression: Expression): ComputedPropertyName;
3198 updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName;
3199 createTypeParameterDeclaration(name: string | Identifier, constraint?: TypeNode, defaultType?: TypeNode): TypeParameterDeclaration;
3200 updateTypeParameterDeclaration(node: TypeParameterDeclaration, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration;
3201 createParameterDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration;
3202 updateParameterDeclaration(node: ParameterDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration;
3203 createDecorator(expression: Expression): Decorator;
3204 updateDecorator(node: Decorator, expression: Expression): Decorator;
3205 createPropertySignature(modifiers: readonly Modifier[] | undefined, name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined): PropertySignature;
3206 updatePropertySignature(node: PropertySignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined): PropertySignature;
3207 createPropertyDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration;
3208 updatePropertyDeclaration(node: PropertyDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration;
3209 createMethodSignature(modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): MethodSignature;
3210 updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): MethodSignature;
3211 createMethodDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration;
3212 updateMethodDeclaration(node: MethodDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration;
3213 createConstructorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration;
3214 updateConstructorDeclaration(node: ConstructorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration;
3215 createGetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration;
3216 updateGetAccessorDeclaration(node: GetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration;
3217 createSetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration;
3218 updateSetAccessorDeclaration(node: SetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration;
3219 createCallSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration;
3220 updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration;
3221 createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration;
3222 updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): ConstructSignatureDeclaration;
3223 createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration;
3224 updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration;
3225 createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan;
3226 updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan;
3227 createKeywordTypeNode<TKind extends KeywordTypeSyntaxKind>(kind: TKind): KeywordTypeNode<TKind>;
3228 createTypePredicateNode(assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode;
3229 updateTypePredicateNode(node: TypePredicateNode, assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode;
3230 createTypeReferenceNode(typeName: string | EntityName, typeArguments?: readonly TypeNode[]): TypeReferenceNode;
3231 updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray<TypeNode> | undefined): TypeReferenceNode;
3232 createFunctionTypeNode(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): FunctionTypeNode;
3233 updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode): FunctionTypeNode;
3234 createConstructorTypeNode(modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): ConstructorTypeNode;
3236 createConstructorTypeNode(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): ConstructorTypeNode;
3237 updateConstructorTypeNode(node: ConstructorTypeNode, modifiers: readonly Modifier[] | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode): ConstructorTypeNode;
3239 updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode): ConstructorTypeNode;
3240 createTypeQueryNode(exprName: EntityName): TypeQueryNode;
3241 updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode;
3242 createTypeLiteralNode(members: readonly TypeElement[] | undefined): TypeLiteralNode;
3243 updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray<TypeElement>): TypeLiteralNode;
3244 createArrayTypeNode(elementType: TypeNode): ArrayTypeNode;
3245 updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode;
3246 createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode;
3247 updateTupleTypeNode(node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode;
3248 createNamedTupleMember(dotDotDotToken: DotDotDotToken | undefined, name: Identifier, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember;
3249 updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: DotDotDotToken | undefined, name: Identifier, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember;
3250 createOptionalTypeNode(type: TypeNode): OptionalTypeNode;
3251 updateOptionalTypeNode(node: OptionalTypeNode, type: TypeNode): OptionalTypeNode;
3252 createRestTypeNode(type: TypeNode): RestTypeNode;
3253 updateRestTypeNode(node: RestTypeNode, type: TypeNode): RestTypeNode;
3254 createUnionTypeNode(types: readonly TypeNode[]): UnionTypeNode;
3255 updateUnionTypeNode(node: UnionTypeNode, types: NodeArray<TypeNode>): UnionTypeNode;
3256 createIntersectionTypeNode(types: readonly TypeNode[]): IntersectionTypeNode;
3257 updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray<TypeNode>): IntersectionTypeNode;
3258 createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode;
3259 updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode;
3260 createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode;
3261 updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode;
3262 createImportTypeNode(argument: TypeNode, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode;
3263 updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode;
3264 createParenthesizedType(type: TypeNode): ParenthesizedTypeNode;
3265 updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode;
3266 createThisTypeNode(): ThisTypeNode;
3267 createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode;
3268 updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode;
3269 createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
3270 updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
3271 createMappedTypeNode(readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode;
3272 updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode;
3273 createLiteralTypeNode(literal: LiteralTypeNode["literal"]): LiteralTypeNode;
3274 updateLiteralTypeNode(node: LiteralTypeNode, literal: LiteralTypeNode["literal"]): LiteralTypeNode;
3275 createTemplateLiteralType(head: TemplateHead, templateSpans: readonly TemplateLiteralTypeSpan[]): TemplateLiteralTypeNode;
3276 updateTemplateLiteralType(node: TemplateLiteralTypeNode, head: TemplateHead, templateSpans: readonly TemplateLiteralTypeSpan[]): TemplateLiteralTypeNode;
3277 createObjectBindingPattern(elements: readonly BindingElement[]): ObjectBindingPattern;
3278 updateObjectBindingPattern(node: ObjectBindingPattern, elements: readonly BindingElement[]): ObjectBindingPattern;
3279 createArrayBindingPattern(elements: readonly ArrayBindingElement[]): ArrayBindingPattern;
3280 updateArrayBindingPattern(node: ArrayBindingPattern, elements: readonly ArrayBindingElement[]): ArrayBindingPattern;
3281 createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement;
3282 updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement;
3283 createArrayLiteralExpression(elements?: readonly Expression[], multiLine?: boolean): ArrayLiteralExpression;
3284 updateArrayLiteralExpression(node: ArrayLiteralExpression, elements: readonly Expression[]): ArrayLiteralExpression;
3285 createObjectLiteralExpression(properties?: readonly ObjectLiteralElementLike[], multiLine?: boolean): ObjectLiteralExpression;
3286 updateObjectLiteralExpression(node: ObjectLiteralExpression, properties: readonly ObjectLiteralElementLike[]): ObjectLiteralExpression;
3287 createPropertyAccessExpression(expression: Expression, name: string | Identifier | PrivateIdentifier): PropertyAccessExpression;
3288 updatePropertyAccessExpression(node: PropertyAccessExpression, expression: Expression, name: Identifier | PrivateIdentifier): PropertyAccessExpression;
3289 createPropertyAccessChain(expression: Expression, questionDotToken: QuestionDotToken | undefined, name: string | Identifier | PrivateIdentifier): PropertyAccessChain;
3290 updatePropertyAccessChain(node: PropertyAccessChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, name: Identifier | PrivateIdentifier): PropertyAccessChain;
3291 createElementAccessExpression(expression: Expression, index: number | Expression): ElementAccessExpression;
3292 updateElementAccessExpression(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
3293 createElementAccessChain(expression: Expression, questionDotToken: QuestionDotToken | undefined, index: number | Expression): ElementAccessChain;
3294 updateElementAccessChain(node: ElementAccessChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, argumentExpression: Expression): ElementAccessChain;
3295 createCallExpression(expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): CallExpression;
3296 updateCallExpression(node: CallExpression, expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[]): CallExpression;
3297 createCallChain(expression: Expression, questionDotToken: QuestionDotToken | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): CallChain;
3298 updateCallChain(node: CallChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[]): CallChain;
3299 createNewExpression(expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): NewExpression;
3300 updateNewExpression(node: NewExpression, expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined): NewExpression;
3301 createTaggedTemplateExpression(tag: Expression, typeArguments: readonly TypeNode[] | undefined, template: TemplateLiteral): TaggedTemplateExpression;
3302 updateTaggedTemplateExpression(node: TaggedTemplateExpression, tag: Expression, typeArguments: readonly TypeNode[] | undefined, template: TemplateLiteral): TaggedTemplateExpression;
3303 createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion;
3304 updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion;
3305 createParenthesizedExpression(expression: Expression): ParenthesizedExpression;
3306 updateParenthesizedExpression(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression;
3307 createFunctionExpression(modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[] | undefined, type: TypeNode | undefined, body: Block): FunctionExpression;
3308 updateFunctionExpression(node: FunctionExpression, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression;
3309 createArrowFunction(modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction;
3310 updateArrowFunction(node: ArrowFunction, modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody): ArrowFunction;
3311 createDeleteExpression(expression: Expression): DeleteExpression;
3312 updateDeleteExpression(node: DeleteExpression, expression: Expression): DeleteExpression;
3313 createTypeOfExpression(expression: Expression): TypeOfExpression;
3314 updateTypeOfExpression(node: TypeOfExpression, expression: Expression): TypeOfExpression;
3315 createVoidExpression(expression: Expression): VoidExpression;
3316 updateVoidExpression(node: VoidExpression, expression: Expression): VoidExpression;
3317 createAwaitExpression(expression: Expression): AwaitExpression;
3318 updateAwaitExpression(node: AwaitExpression, expression: Expression): AwaitExpression;
3319 createPrefixUnaryExpression(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression;
3320 updatePrefixUnaryExpression(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression;
3321 createPostfixUnaryExpression(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression;
3322 updatePostfixUnaryExpression(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression;
3323 createBinaryExpression(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression;
3324 updateBinaryExpression(node: BinaryExpression, left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression;
3325 createConditionalExpression(condition: Expression, questionToken: QuestionToken | undefined, whenTrue: Expression, colonToken: ColonToken | undefined, whenFalse: Expression): ConditionalExpression;
3326 updateConditionalExpression(node: ConditionalExpression, condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression;
3327 createTemplateExpression(head: TemplateHead, templateSpans: readonly TemplateSpan[]): TemplateExpression;
3328 updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: readonly TemplateSpan[]): TemplateExpression;
3329 createTemplateHead(text: string, rawText?: string, templateFlags?: TokenFlags): TemplateHead;
3330 createTemplateHead(text: string | undefined, rawText: string, templateFlags?: TokenFlags): TemplateHead;
3331 createTemplateMiddle(text: string, rawText?: string, templateFlags?: TokenFlags): TemplateMiddle;
3332 createTemplateMiddle(text: string | undefined, rawText: string, templateFlags?: TokenFlags): TemplateMiddle;
3333 createTemplateTail(text: string, rawText?: string, templateFlags?: TokenFlags): TemplateTail;
3334 createTemplateTail(text: string | undefined, rawText: string, templateFlags?: TokenFlags): TemplateTail;
3335 createNoSubstitutionTemplateLiteral(text: string, rawText?: string): NoSubstitutionTemplateLiteral;
3336 createNoSubstitutionTemplateLiteral(text: string | undefined, rawText: string): NoSubstitutionTemplateLiteral;
3337 createYieldExpression(asteriskToken: AsteriskToken, expression: Expression): YieldExpression;
3338 createYieldExpression(asteriskToken: undefined, expression: Expression | undefined): YieldExpression;
3339 updateYieldExpression(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression | undefined): YieldExpression;
3340 createSpreadElement(expression: Expression): SpreadElement;
3341 updateSpreadElement(node: SpreadElement, expression: Expression): SpreadElement;
3342 createClassExpression(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression;
3343 updateClassExpression(node: ClassExpression, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression;
3344 createOmittedExpression(): OmittedExpression;
3345 createExpressionWithTypeArguments(expression: Expression, typeArguments: readonly TypeNode[] | undefined): ExpressionWithTypeArguments;
3346 updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, expression: Expression, typeArguments: readonly TypeNode[] | undefined): ExpressionWithTypeArguments;
3347 createAsExpression(expression: Expression, type: TypeNode): AsExpression;
3348 updateAsExpression(node: AsExpression, expression: Expression, type: TypeNode): AsExpression;
3349 createNonNullExpression(expression: Expression): NonNullExpression;
3350 updateNonNullExpression(node: NonNullExpression, expression: Expression): NonNullExpression;
3351 createNonNullChain(expression: Expression): NonNullChain;
3352 updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain;
3353 createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty;
3354 updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty;
3355 createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan;
3356 updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan;
3357 createSemicolonClassElement(): SemicolonClassElement;
3358 createBlock(statements: readonly Statement[], multiLine?: boolean): Block;
3359 updateBlock(node: Block, statements: readonly Statement[]): Block;
3360 createVariableStatement(modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement;
3361 updateVariableStatement(node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement;
3362 createEmptyStatement(): EmptyStatement;
3363 createExpressionStatement(expression: Expression): ExpressionStatement;
3364 updateExpressionStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement;
3365 createIfStatement(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement;
3366 updateIfStatement(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined): IfStatement;
3367 createDoStatement(statement: Statement, expression: Expression): DoStatement;
3368 updateDoStatement(node: DoStatement, statement: Statement, expression: Expression): DoStatement;
3369 createWhileStatement(expression: Expression, statement: Statement): WhileStatement;
3370 updateWhileStatement(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement;
3371 createForStatement(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement;
3372 updateForStatement(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement;
3373 createForInStatement(initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement;
3374 updateForInStatement(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement;
3375 createForOfStatement(awaitModifier: AwaitKeyword | undefined, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement;
3376 updateForOfStatement(node: ForOfStatement, awaitModifier: AwaitKeyword | undefined, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement;
3377 createContinueStatement(label?: string | Identifier): ContinueStatement;
3378 updateContinueStatement(node: ContinueStatement, label: Identifier | undefined): ContinueStatement;
3379 createBreakStatement(label?: string | Identifier): BreakStatement;
3380 updateBreakStatement(node: BreakStatement, label: Identifier | undefined): BreakStatement;
3381 createReturnStatement(expression?: Expression): ReturnStatement;
3382 updateReturnStatement(node: ReturnStatement, expression: Expression | undefined): ReturnStatement;
3383 createWithStatement(expression: Expression, statement: Statement): WithStatement;
3384 updateWithStatement(node: WithStatement, expression: Expression, statement: Statement): WithStatement;
3385 createSwitchStatement(expression: Expression, caseBlock: CaseBlock): SwitchStatement;
3386 updateSwitchStatement(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement;
3387 createLabeledStatement(label: string | Identifier, statement: Statement): LabeledStatement;
3388 updateLabeledStatement(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement;
3389 createThrowStatement(expression: Expression): ThrowStatement;
3390 updateThrowStatement(node: ThrowStatement, expression: Expression): ThrowStatement;
3391 createTryStatement(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement;
3392 updateTryStatement(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement;
3393 createDebuggerStatement(): DebuggerStatement;
3394 createVariableDeclaration(name: string | BindingName, exclamationToken?: ExclamationToken, type?: TypeNode, initializer?: Expression): VariableDeclaration;
3395 updateVariableDeclaration(node: VariableDeclaration, name: BindingName, exclamationToken: ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration;
3396 createVariableDeclarationList(declarations: readonly VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList;
3397 updateVariableDeclarationList(node: VariableDeclarationList, declarations: readonly VariableDeclaration[]): VariableDeclarationList;
3398 createFunctionDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration;
3399 updateFunctionDeclaration(node: FunctionDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration;
3400 createClassDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration;
3401 updateClassDeclaration(node: ClassDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration;
3402 createInterfaceDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration;
3403 updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration;
3404 createTypeAliasDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration;
3405 updateTypeAliasDeclaration(node: TypeAliasDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration;
3406 createEnumDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration;
3407 updateEnumDeclaration(node: EnumDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration;
3408 createModuleDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration;
3409 updateModuleDeclaration(node: ModuleDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration;
3410 createModuleBlock(statements: readonly Statement[]): ModuleBlock;
3411 updateModuleBlock(node: ModuleBlock, statements: readonly Statement[]): ModuleBlock;
3412 createCaseBlock(clauses: readonly CaseOrDefaultClause[]): CaseBlock;
3413 updateCaseBlock(node: CaseBlock, clauses: readonly CaseOrDefaultClause[]): CaseBlock;
3414 createNamespaceExportDeclaration(name: string | Identifier): NamespaceExportDeclaration;
3415 updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
3416 createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
3417 updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
3418 createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
3419 updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
3420 createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3421 updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3422 createNamespaceImport(name: Identifier): NamespaceImport;
3423 updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
3424 createNamespaceExport(name: Identifier): NamespaceExport;
3425 updateNamespaceExport(node: NamespaceExport, name: Identifier): NamespaceExport;
3426 createNamedImports(elements: readonly ImportSpecifier[]): NamedImports;
3427 updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports;
3428 createImportSpecifier(propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
3429 updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
3430 createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
3431 updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment;
3432 createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression): ExportDeclaration;
3433 updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration;
3434 createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
3435 updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
3436 createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
3437 updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier;
3438 createExternalModuleReference(expression: Expression): ExternalModuleReference;
3439 updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference;
3440 createJSDocAllType(): JSDocAllType;
3441 createJSDocUnknownType(): JSDocUnknownType;
3442 createJSDocNonNullableType(type: TypeNode): JSDocNonNullableType;
3443 updateJSDocNonNullableType(node: JSDocNonNullableType, type: TypeNode): JSDocNonNullableType;
3444 createJSDocNullableType(type: TypeNode): JSDocNullableType;
3445 updateJSDocNullableType(node: JSDocNullableType, type: TypeNode): JSDocNullableType;
3446 createJSDocOptionalType(type: TypeNode): JSDocOptionalType;
3447 updateJSDocOptionalType(node: JSDocOptionalType, type: TypeNode): JSDocOptionalType;
3448 createJSDocFunctionType(parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): JSDocFunctionType;
3449 updateJSDocFunctionType(node: JSDocFunctionType, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): JSDocFunctionType;
3450 createJSDocVariadicType(type: TypeNode): JSDocVariadicType;
3451 updateJSDocVariadicType(node: JSDocVariadicType, type: TypeNode): JSDocVariadicType;
3452 createJSDocNamepathType(type: TypeNode): JSDocNamepathType;
3453 updateJSDocNamepathType(node: JSDocNamepathType, type: TypeNode): JSDocNamepathType;
3454 createJSDocTypeExpression(type: TypeNode): JSDocTypeExpression;
3455 updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression;
3456 createJSDocNameReference(name: EntityName): JSDocNameReference;
3457 updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference;
3458 createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral;
3459 updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral;
3460 createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature;
3461 updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature;
3462 createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string): JSDocTemplateTag;
3463 updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | undefined): JSDocTemplateTag;
3464 createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocTypedefTag;
3465 updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocTypedefTag;
3466 createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocParameterTag;
3467 updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocParameterTag;
3468 createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string): JSDocPropertyTag;
3469 updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | undefined): JSDocPropertyTag;
3470 createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocTypeTag;
3471 updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag;
3472 createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag;
3473 updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string): JSDocSeeTag;
3474 createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag;
3475 updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag;
3476 createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag;
3477 updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag;
3478 createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag;
3479 updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag;
3480 createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag;
3481 updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag;
3482 createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string): JSDocAugmentsTag;
3483 updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | undefined): JSDocAugmentsTag;
3484 createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string): JSDocImplementsTag;
3485 updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | undefined): JSDocImplementsTag;
3486 createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string): JSDocAuthorTag;
3487 updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | undefined): JSDocAuthorTag;
3488 createJSDocClassTag(tagName: Identifier | undefined, comment?: string): JSDocClassTag;
3489 updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | undefined): JSDocClassTag;
3490 createJSDocPublicTag(tagName: Identifier | undefined, comment?: string): JSDocPublicTag;
3491 updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPublicTag;
3492 createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string): JSDocPrivateTag;
3493 updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | undefined): JSDocPrivateTag;
3494 createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string): JSDocProtectedTag;
3495 updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag;
3496 createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag;
3497 updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag;
3498 createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag;
3499 updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag;
3500 createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag;
3501 updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string): JSDocDeprecatedTag;
3502 createJSDocComment(comment?: string | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc;
3503 updateJSDocComment(node: JSDoc, comment: string | undefined, tags: readonly JSDocTag[] | undefined): JSDoc;
3504 createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement;
3505 updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement;
3506 createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
3507 updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
3508 createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxOpeningElement;
3509 updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxOpeningElement;
3510 createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement;
3511 updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement;
3512 createJsxFragment(openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment): JsxFragment;
3513 createJsxText(text: string, containsOnlyTriviaWhiteSpaces?: boolean): JsxText;
3514 updateJsxText(node: JsxText, text: string, containsOnlyTriviaWhiteSpaces?: boolean): JsxText;
3515 createJsxOpeningFragment(): JsxOpeningFragment;
3516 createJsxJsxClosingFragment(): JsxClosingFragment;
3517 updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment): JsxFragment;
3518 createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression | undefined): JsxAttribute;
3519 updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression | undefined): JsxAttribute;
3520 createJsxAttributes(properties: readonly JsxAttributeLike[]): JsxAttributes;
3521 updateJsxAttributes(node: JsxAttributes, properties: readonly JsxAttributeLike[]): JsxAttributes;
3522 createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute;
3523 updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute;
3524 createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined): JsxExpression;
3525 updateJsxExpression(node: JsxExpression, expression: Expression | undefined): JsxExpression;
3526 createCaseClause(expression: Expression, statements: readonly Statement[]): CaseClause;
3527 updateCaseClause(node: CaseClause, expression: Expression, statements: readonly Statement[]): CaseClause;
3528 createDefaultClause(statements: readonly Statement[]): DefaultClause;
3529 updateDefaultClause(node: DefaultClause, statements: readonly Statement[]): DefaultClause;
3530 createHeritageClause(token: HeritageClause["token"], types: readonly ExpressionWithTypeArguments[]): HeritageClause;
3531 updateHeritageClause(node: HeritageClause, types: readonly ExpressionWithTypeArguments[]): HeritageClause;
3532 createCatchClause(variableDeclaration: string | VariableDeclaration | undefined, block: Block): CatchClause;
3533 updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration | undefined, block: Block): CatchClause;
3534 createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment;
3535 updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment;
3536 createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression): ShorthandPropertyAssignment;
3537 updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined): ShorthandPropertyAssignment;
3538 createSpreadAssignment(expression: Expression): SpreadAssignment;
3539 updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment;
3540 createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember;
3541 updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember;
3542 createSourceFile(statements: readonly Statement[], endOfFileToken: EndOfFileToken, flags: NodeFlags): SourceFile;
3543 updateSourceFile(node: SourceFile, statements: readonly Statement[], isDeclarationFile?: boolean, referencedFiles?: readonly FileReference[], typeReferences?: readonly FileReference[], hasNoDefaultLib?: boolean, libReferences?: readonly FileReference[]): SourceFile;
3544 createNotEmittedStatement(original: Node): NotEmittedStatement;
3545 createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression;
3546 updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression;
3547 createCommaListExpression(elements: readonly Expression[]): CommaListExpression;
3548 updateCommaListExpression(node: CommaListExpression, elements: readonly Expression[]): CommaListExpression;
3549 createBundle(sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[]): Bundle;
3550 updateBundle(node: Bundle, sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[]): Bundle;
3551 createComma(left: Expression, right: Expression): BinaryExpression;
3552 createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment;
3553 createAssignment(left: Expression, right: Expression): AssignmentExpression<EqualsToken>;
3554 createLogicalOr(left: Expression, right: Expression): BinaryExpression;
3555 createLogicalAnd(left: Expression, right: Expression): BinaryExpression;
3556 createBitwiseOr(left: Expression, right: Expression): BinaryExpression;
3557 createBitwiseXor(left: Expression, right: Expression): BinaryExpression;
3558 createBitwiseAnd(left: Expression, right: Expression): BinaryExpression;
3559 createStrictEquality(left: Expression, right: Expression): BinaryExpression;
3560 createStrictInequality(left: Expression, right: Expression): BinaryExpression;
3561 createEquality(left: Expression, right: Expression): BinaryExpression;
3562 createInequality(left: Expression, right: Expression): BinaryExpression;
3563 createLessThan(left: Expression, right: Expression): BinaryExpression;
3564 createLessThanEquals(left: Expression, right: Expression): BinaryExpression;
3565 createGreaterThan(left: Expression, right: Expression): BinaryExpression;
3566 createGreaterThanEquals(left: Expression, right: Expression): BinaryExpression;
3567 createLeftShift(left: Expression, right: Expression): BinaryExpression;
3568 createRightShift(left: Expression, right: Expression): BinaryExpression;
3569 createUnsignedRightShift(left: Expression, right: Expression): BinaryExpression;
3570 createAdd(left: Expression, right: Expression): BinaryExpression;
3571 createSubtract(left: Expression, right: Expression): BinaryExpression;
3572 createMultiply(left: Expression, right: Expression): BinaryExpression;
3573 createDivide(left: Expression, right: Expression): BinaryExpression;
3574 createModulo(left: Expression, right: Expression): BinaryExpression;
3575 createExponent(left: Expression, right: Expression): BinaryExpression;
3576 createPrefixPlus(operand: Expression): PrefixUnaryExpression;
3577 createPrefixMinus(operand: Expression): PrefixUnaryExpression;
3578 createPrefixIncrement(operand: Expression): PrefixUnaryExpression;
3579 createPrefixDecrement(operand: Expression): PrefixUnaryExpression;
3580 createBitwiseNot(operand: Expression): PrefixUnaryExpression;
3581 createLogicalNot(operand: Expression): PrefixUnaryExpression;
3582 createPostfixIncrement(operand: Expression): PostfixUnaryExpression;
3583 createPostfixDecrement(operand: Expression): PostfixUnaryExpression;
3584 createImmediatelyInvokedFunctionExpression(statements: readonly Statement[]): CallExpression;
3585 createImmediatelyInvokedFunctionExpression(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression;
3586 createImmediatelyInvokedArrowFunction(statements: readonly Statement[]): CallExpression;
3587 createImmediatelyInvokedArrowFunction(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression;
3588 createVoidZero(): VoidExpression;
3589 createExportDefault(expression: Expression): ExportAssignment;
3590 createExternalModuleExport(exportName: Identifier): ExportDeclaration;
3591 restoreOuterExpressions(outerExpression: Expression | undefined, innerExpression: Expression, kinds?: OuterExpressionKinds): Expression;
3593 export interface CoreTransformationContext {
3594 readonly factory: NodeFactory;
3595 /** Gets the compiler options supplied to the transformer. */
3596 getCompilerOptions(): CompilerOptions;
3597 /** Starts a new lexical environment. */
3598 startLexicalEnvironment(): void;
3599 /** Suspends the current lexical environment, usually after visiting a parameter list. */
3600 suspendLexicalEnvironment(): void;
3601 /** Resumes a suspended lexical environment, usually before visiting a function body. */
3602 resumeLexicalEnvironment(): void;
3603 /** Ends a lexical environment, returning any declarations. */
3604 endLexicalEnvironment(): Statement[] | undefined;
3605 /** Hoists a function declaration to the containing scope. */
3606 hoistFunctionDeclaration(node: FunctionDeclaration): void;
3607 /** Hoists a variable declaration to the containing scope. */
3608 hoistVariableDeclaration(node: Identifier): void;
3610 export interface TransformationContext extends CoreTransformationContext {
3611 /** Records a request for a non-scoped emit helper in the current context. */
3612 requestEmitHelper(helper: EmitHelper): void;
3613 /** Gets and resets the requested non-scoped emit helpers. */
3614 readEmitHelpers(): EmitHelper[] | undefined;
3615 /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */
3616 enableSubstitution(kind: SyntaxKind): void;
3617 /** Determines whether expression substitutions are enabled for the provided node. */
3618 isSubstitutionEnabled(node: Node): boolean;
3620 * Hook used by transformers to substitute expressions just before they
3621 * are emitted by the pretty printer.
3623 * NOTE: Transformation hooks should only be modified during `Transformer` initialization,
3624 * before returning the `NodeTransformer` callback.
3626 onSubstituteNode: (hint: EmitHint, node: Node) => Node;
3628 * Enables before/after emit notifications in the pretty printer for the provided
3631 enableEmitNotification(kind: SyntaxKind): void;
3633 * Determines whether before/after emit notifications should be raised in the pretty
3634 * printer when it emits a node.
3636 isEmitNotificationEnabled(node: Node): boolean;
3638 * Hook used to allow transformers to capture state before or after
3639 * the printer emits a node.
3641 * NOTE: Transformation hooks should only be modified during `Transformer` initialization,
3642 * before returning the `NodeTransformer` callback.
3644 onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void;
3646 export interface TransformationResult<T extends Node> {
3647 /** Gets the transformed source files. */
3649 /** Gets diagnostics for the transformation. */
3650 diagnostics?: DiagnosticWithLocation[];
3652 * Gets a substitute for a node, if one is available; otherwise, returns the original node.
3654 * @param hint A hint as to the intended usage of the node.
3655 * @param node The node to substitute.
3657 substituteNode(hint: EmitHint, node: Node): Node;
3659 * Emits a node with possible notification.
3661 * @param hint A hint as to the intended usage of the node.
3662 * @param node The node to emit.
3663 * @param emitCallback A callback used to emit the node.
3665 emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void;
3667 * Indicates if a given node needs an emit notification
3669 * @param node The node to emit.
3671 isEmitNotificationEnabled?(node: Node): boolean;
3673 * Clean up EmitNode entries on any parse-tree nodes.
3678 * A function that is used to initialize and return a `Transformer` callback, which in turn
3679 * will be used to transform one or more nodes.
3681 export type TransformerFactory<T extends Node> = (context: TransformationContext) => Transformer<T>;
3683 * A function that transforms a node.
3685 export type Transformer<T extends Node> = (node: T) => T;
3687 * A function that accepts and possibly transforms a node.
3689 export type Visitor = (node: Node) => VisitResult<Node>;
3690 export interface NodeVisitor {
3691 <T extends Node>(nodes: T, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T;
3692 <T extends Node>(nodes: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T | undefined;
3694 export interface NodesVisitor {
3695 <T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
3696 <T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
3698 export type VisitResult<T extends Node> = T | T[] | undefined;
3699 export interface Printer {
3701 * Print a node and its subtree as-is, without any emit transformations.
3702 * @param hint A value indicating the purpose of a node. This is primarily used to
3703 * distinguish between an `Identifier` used in an expression position, versus an
3704 * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you
3705 * should just pass `Unspecified`.
3706 * @param node The node to print. The node and its subtree are printed as-is, without any
3707 * emit transformations.
3708 * @param sourceFile A source file that provides context for the node. The source text of
3709 * the file is used to emit the original source content for literals and identifiers, while
3710 * the identifiers of the source file are used when generating unique names to avoid
3713 printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string;
3715 * Prints a list of nodes using the given format flags
3717 printList<T extends Node>(format: ListFormat, list: NodeArray<T>, sourceFile: SourceFile): string;
3719 * Prints a source file as-is, without any emit transformations.
3721 printFile(sourceFile: SourceFile): string;
3723 * Prints a bundle of source files as-is, without any emit transformations.
3725 printBundle(bundle: Bundle): string;
3727 export interface PrintHandlers {
3729 * A hook used by the Printer when generating unique names to avoid collisions with
3730 * globally defined names that exist outside of the current source file.
3732 hasGlobalName?(name: string): boolean;
3734 * A hook used by the Printer to provide notifications prior to emitting a node. A
3735 * compatible implementation **must** invoke `emitCallback` with the provided `hint` and
3737 * @param hint A hint indicating the intended purpose of the node.
3738 * @param node The node to emit.
3739 * @param emitCallback A callback that, when invoked, will emit the node.
3742 * var printer = createPrinter(printerOptions, {
3743 * onEmitNode(hint, node, emitCallback) {
3744 * // set up or track state prior to emitting the node...
3745 * emitCallback(hint, node);
3746 * // restore state after emitting the node...
3751 onEmitNode?(hint: EmitHint, node: Node | undefined, emitCallback: (hint: EmitHint, node: Node | undefined) => void): void;
3753 * A hook used to check if an emit notification is required for a node.
3754 * @param node The node to emit.
3756 isEmitNotificationEnabled?(node: Node | undefined): boolean;
3758 * A hook used by the Printer to perform just-in-time substitution of a node. This is
3759 * primarily used by node transformations that need to substitute one node for another,
3760 * such as replacing `myExportedVar` with `exports.myExportedVar`.
3761 * @param hint A hint indicating the intended purpose of the node.
3762 * @param node The node to emit.
3765 * var printer = createPrinter(printerOptions, {
3766 * substituteNode(hint, node) {
3767 * // perform substitution if necessary...
3773 substituteNode?(hint: EmitHint, node: Node): Node;
3775 export interface PrinterOptions {
3776 removeComments?: boolean;
3777 newLine?: NewLineKind;
3778 omitTrailingSemicolon?: boolean;
3779 noEmitHelpers?: boolean;
3781 export interface GetEffectiveTypeRootsHost {
3782 directoryExists?(directoryName: string): boolean;
3783 getCurrentDirectory?(): string;
3785 export interface TextSpan {
3789 export interface TextChangeRange {
3793 export interface SyntaxList extends Node {
3794 kind: SyntaxKind.SyntaxList;
3797 export enum ListFormat {
3805 AmpersandDelimited = 8,
3806 CommaDelimited = 16,
3807 AsteriskDelimited = 32,
3808 DelimitersMask = 60,
3809 AllowTrailingComma = 64,
3811 SpaceBetweenBraces = 256,
3812 SpaceBetweenSiblings = 512,
3815 AngleBrackets = 4096,
3816 SquareBrackets = 8192,
3817 BracketsMask = 15360,
3818 OptionalIfUndefined = 16384,
3819 OptionalIfEmpty = 32768,
3821 PreferNewLine = 65536,
3822 NoTrailingNewLine = 131072,
3823 NoInterveningComments = 262144,
3824 NoSpaceIfEmpty = 524288,
3825 SingleElement = 1048576,
3826 SpaceAfterList = 2097152,
3828 HeritageClauses = 512,
3829 SingleLineTypeLiteralMembers = 768,
3830 MultiLineTypeLiteralMembers = 32897,
3831 SingleLineTupleTypeElements = 528,
3832 MultiLineTupleTypeElements = 657,
3833 UnionTypeConstituents = 516,
3834 IntersectionTypeConstituents = 520,
3835 ObjectBindingPatternElements = 525136,
3836 ArrayBindingPatternElements = 524880,
3837 ObjectLiteralExpressionProperties = 526226,
3838 ArrayLiteralExpressionElements = 8914,
3839 CommaListElements = 528,
3840 CallExpressionArguments = 2576,
3841 NewExpressionArguments = 18960,
3842 TemplateExpressionSpans = 262144,
3843 SingleLineBlockStatements = 768,
3844 MultiLineBlockStatements = 129,
3845 VariableDeclarationList = 528,
3846 SingleLineFunctionBodyStatements = 768,
3847 MultiLineFunctionBodyStatements = 1,
3848 ClassHeritageClauses = 0,
3850 InterfaceMembers = 129,
3852 CaseBlockClauses = 129,
3853 NamedImportsOrExportsElements = 525136,
3854 JsxElementOrFragmentChildren = 262144,
3855 JsxElementAttributes = 262656,
3856 CaseOrDefaultClauseStatements = 163969,
3857 HeritageClauseTypes = 528,
3858 SourceFileStatements = 131073,
3859 Decorators = 2146305,
3860 TypeArguments = 53776,
3861 TypeParameters = 53776,
3863 IndexSignatureParameters = 8848,
3866 export interface UserPreferences {
3867 readonly disableSuggestions?: boolean;
3868 readonly quotePreference?: "auto" | "double" | "single";
3869 readonly includeCompletionsForModuleExports?: boolean;
3870 readonly includeAutomaticOptionalChainCompletions?: boolean;
3871 readonly includeCompletionsWithInsertText?: boolean;
3872 readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
3873 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
3874 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
3875 readonly allowTextChangesInNewFiles?: boolean;
3876 readonly providePrefixAndSuffixTextForRename?: boolean;
3877 readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
3878 readonly provideRefactorNotApplicableReason?: boolean;
3880 /** Represents a bigint literal value without requiring bigint support */
3881 export interface PseudoBigInt {
3883 base10Value: string;
3887 declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
3888 declare function clearTimeout(handle: any): void;
3889 declare namespace ts {
3890 export enum FileWatcherEventKind {
3895 export type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind) => void;
3896 export type DirectoryWatcherCallback = (fileName: string) => void;
3897 export interface System {
3900 useCaseSensitiveFileNames: boolean;
3901 write(s: string): void;
3902 writeOutputIsTTY?(): boolean;
3903 readFile(path: string, encoding?: string): string | undefined;
3904 getFileSize?(path: string): number;
3905 writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
3907 * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
3908 * use native OS file watching
3910 watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
3911 watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
3912 resolvePath(path: string): string;
3913 fileExists(path: string): boolean;
3914 directoryExists(path: string): boolean;
3915 createDirectory(path: string): void;
3916 getExecutingFilePath(): string;
3917 getCurrentDirectory(): string;
3918 getDirectories(path: string): string[];
3919 readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
3920 getModifiedTime?(path: string): Date | undefined;
3921 setModifiedTime?(path: string, time: Date): void;
3922 deleteFile?(path: string): void;
3924 * A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm)
3926 createHash?(data: string): string;
3927 /** This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. */
3928 createSHA256Hash?(data: string): string;
3929 getMemoryUsage?(): number;
3930 exit(exitCode?: number): void;
3931 realpath?(path: string): string;
3932 setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
3933 clearTimeout?(timeoutId: any): void;
3934 clearScreen?(): void;
3935 base64decode?(input: string): string;
3936 base64encode?(input: string): string;
3938 export interface FileWatcher {
3941 export function getNodeMajorVersion(): number | undefined;
3942 export let sys: System;
3945 declare namespace ts {
3946 type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
3948 getStartPos(): number;
3949 getToken(): SyntaxKind;
3950 getTextPos(): number;
3951 getTokenPos(): number;
3952 getTokenText(): string;
3953 getTokenValue(): string;
3954 hasUnicodeEscape(): boolean;
3955 hasExtendedUnicodeEscape(): boolean;
3956 hasPrecedingLineBreak(): boolean;
3957 isIdentifier(): boolean;
3958 isReservedWord(): boolean;
3959 isUnterminated(): boolean;
3960 reScanGreaterToken(): SyntaxKind;
3961 reScanSlashToken(): SyntaxKind;
3962 reScanAsteriskEqualsToken(): SyntaxKind;
3963 reScanTemplateToken(isTaggedTemplate: boolean): SyntaxKind;
3964 reScanTemplateHeadOrNoSubstitutionTemplate(): SyntaxKind;
3965 scanJsxIdentifier(): SyntaxKind;
3966 scanJsxAttributeValue(): SyntaxKind;
3967 reScanJsxAttributeValue(): SyntaxKind;
3968 reScanJsxToken(): JsxTokenSyntaxKind;
3969 reScanLessThanToken(): SyntaxKind;
3970 reScanQuestionToken(): SyntaxKind;
3971 reScanInvalidIdentifier(): SyntaxKind;
3972 scanJsxToken(): JsxTokenSyntaxKind;
3973 scanJsDocToken(): JSDocSyntaxKind;
3976 setText(text: string | undefined, start?: number, length?: number): void;
3977 setOnError(onError: ErrorCallback | undefined): void;
3978 setScriptTarget(scriptTarget: ScriptTarget): void;
3979 setLanguageVariant(variant: LanguageVariant): void;
3980 setTextPos(textPos: number): void;
3981 lookAhead<T>(callback: () => T): T;
3982 scanRange<T>(start: number, length: number, callback: () => T): T;
3983 tryScan<T>(callback: () => T): T;
3985 function tokenToString(t: SyntaxKind): string | undefined;
3986 function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
3987 function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
3988 function isWhiteSpaceLike(ch: number): boolean;
3989 /** Does not include line breaks. For that, see isWhiteSpaceLike. */
3990 function isWhiteSpaceSingleLine(ch: number): boolean;
3991 function isLineBreak(ch: number): boolean;
3992 function couldStartTrivia(text: string, pos: number): boolean;
3993 function forEachLeadingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
3994 function forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
3995 function forEachTrailingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
3996 function forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
3997 function reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U | undefined;
3998 function reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U | undefined;
3999 function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
4000 function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
4001 /** Optionally, get the shebang */
4002 function getShebang(text: string): string | undefined;
4003 function isIdentifierStart(ch: number, languageVersion: ScriptTarget | undefined): boolean;
4004 function isIdentifierPart(ch: number, languageVersion: ScriptTarget | undefined, identifierVariant?: LanguageVariant): boolean;
4005 function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, textInitial?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
4007 declare namespace ts {
4008 function isExternalModuleNameRelative(moduleName: string): boolean;
4009 function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics: readonly T[]): SortedReadonlyArray<T>;
4010 function getDefaultLibFileName(options: CompilerOptions): string;
4011 function textSpanEnd(span: TextSpan): number;
4012 function textSpanIsEmpty(span: TextSpan): boolean;
4013 function textSpanContainsPosition(span: TextSpan, position: number): boolean;
4014 function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
4015 function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
4016 function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan | undefined;
4017 function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
4018 function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
4019 function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
4020 function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
4021 function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan | undefined;
4022 function createTextSpan(start: number, length: number): TextSpan;
4023 function createTextSpanFromBounds(start: number, end: number): TextSpan;
4024 function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
4025 function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
4026 function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
4027 let unchangedTextChangeRange: TextChangeRange;
4029 * Called to merge all the changes that occurred across several versions of a script snapshot
4030 * into a single change. i.e. if a user keeps making successive edits to a script we will
4031 * have a text change from V1 to V2, V2 to V3, ..., Vn.
4033 * This function will then merge those changes into a single change range valid between V1 and
4036 function collapseTextChangeRangesAcrossMultipleVersions(changes: readonly TextChangeRange[]): TextChangeRange;
4037 function getTypeParameterOwner(d: Declaration): Declaration | undefined;
4038 type ParameterPropertyDeclaration = ParameterDeclaration & {
4039 parent: ConstructorDeclaration;
4042 function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration;
4043 function isEmptyBindingPattern(node: BindingName): node is BindingPattern;
4044 function isEmptyBindingElement(node: BindingElement): boolean;
4045 function walkUpBindingElementsAndPatterns(binding: BindingElement): VariableDeclaration | ParameterDeclaration;
4046 function getCombinedModifierFlags(node: Declaration): ModifierFlags;
4047 function getCombinedNodeFlags(node: Node): NodeFlags;
4049 * Checks to see if the locale is in the appropriate format,
4050 * and if it is, attempts to set the appropriate language.
4052 function validateLocaleAndSetLanguage(locale: string, sys: {
4053 getExecutingFilePath(): string;
4054 resolvePath(path: string): string;
4055 fileExists(fileName: string): boolean;
4056 readFile(fileName: string): string | undefined;
4057 }, errors?: Push<Diagnostic>): void;
4058 function getOriginalNode(node: Node): Node;
4059 function getOriginalNode<T extends Node>(node: Node, nodeTest: (node: Node) => node is T): T;
4060 function getOriginalNode(node: Node | undefined): Node | undefined;
4061 function getOriginalNode<T extends Node>(node: Node | undefined, nodeTest: (node: Node | undefined) => node is T): T | undefined;
4063 * Iterates through the parent chain of a node and performs the callback on each parent until the callback
4064 * returns a truthy value, then returns that value.
4065 * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit"
4066 * At that point findAncestor returns undefined.
4068 function findAncestor<T extends Node>(node: Node | undefined, callback: (element: Node) => element is T): T | undefined;
4069 function findAncestor(node: Node | undefined, callback: (element: Node) => boolean | "quit"): Node | undefined;
4071 * Gets a value indicating whether a node originated in the parse tree.
4073 * @param node The node to test.
4075 function isParseTreeNode(node: Node): boolean;
4077 * Gets the original parse tree node for a node.
4079 * @param node The original node.
4080 * @returns The original parse tree node if found; otherwise, undefined.
4082 function getParseTreeNode(node: Node | undefined): Node | undefined;
4084 * Gets the original parse tree node for a node.
4086 * @param node The original node.
4087 * @param nodeTest A callback used to ensure the correct type of parse tree node is returned.
4088 * @returns The original parse tree node if found; otherwise, undefined.
4090 function getParseTreeNode<T extends Node>(node: T | undefined, nodeTest?: (node: Node) => node is T): T | undefined;
4091 /** Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' */
4092 function escapeLeadingUnderscores(identifier: string): __String;
4094 * Remove extra underscore from escaped identifier text content.
4096 * @param identifier The escaped identifier text.
4097 * @returns The unescaped identifier text.
4099 function unescapeLeadingUnderscores(identifier: __String): string;
4100 function idText(identifierOrPrivateName: Identifier | PrivateIdentifier): string;
4101 function symbolName(symbol: Symbol): string;
4102 function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined;
4103 function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined;
4105 * Gets the JSDoc parameter tags for the node if present.
4107 * @remarks Returns any JSDoc param tag whose name matches the provided
4108 * parameter, whether a param tag on a containing function
4109 * expression, or a param tag on a variable declaration whose
4110 * initializer is the containing function. The tags closest to the
4111 * node are returned first, so in the previous example, the param
4112 * tag on the containing function expression would be first.
4114 * For binding patterns, parameter tags are matched by position.
4116 function getJSDocParameterTags(param: ParameterDeclaration): readonly JSDocParameterTag[];
4118 * Gets the JSDoc type parameter tags for the node if present.
4120 * @remarks Returns any JSDoc template tag whose names match the provided
4121 * parameter, whether a template tag on a containing function
4122 * expression, or a template tag on a variable declaration whose
4123 * initializer is the containing function. The tags closest to the
4124 * node are returned first, so in the previous example, the template
4125 * tag on the containing function expression would be first.
4127 function getJSDocTypeParameterTags(param: TypeParameterDeclaration): readonly JSDocTemplateTag[];
4129 * Return true if the node has JSDoc parameter tags.
4131 * @remarks Includes parameter tags that are not directly on the node,
4132 * for example on a variable declaration whose initializer is a function expression.
4134 function hasJSDocParameterTags(node: FunctionLikeDeclaration | SignatureDeclaration): boolean;
4135 /** Gets the JSDoc augments tag for the node if present */
4136 function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag | undefined;
4137 /** Gets the JSDoc implements tags for the node if present */
4138 function getJSDocImplementsTags(node: Node): readonly JSDocImplementsTag[];
4139 /** Gets the JSDoc class tag for the node if present */
4140 function getJSDocClassTag(node: Node): JSDocClassTag | undefined;
4141 /** Gets the JSDoc public tag for the node if present */
4142 function getJSDocPublicTag(node: Node): JSDocPublicTag | undefined;
4143 /** Gets the JSDoc private tag for the node if present */
4144 function getJSDocPrivateTag(node: Node): JSDocPrivateTag | undefined;
4145 /** Gets the JSDoc protected tag for the node if present */
4146 function getJSDocProtectedTag(node: Node): JSDocProtectedTag | undefined;
4147 /** Gets the JSDoc protected tag for the node if present */
4148 function getJSDocReadonlyTag(node: Node): JSDocReadonlyTag | undefined;
4149 /** Gets the JSDoc deprecated tag for the node if present */
4150 function getJSDocDeprecatedTag(node: Node): JSDocDeprecatedTag | undefined;
4151 /** Gets the JSDoc enum tag for the node if present */
4152 function getJSDocEnumTag(node: Node): JSDocEnumTag | undefined;
4153 /** Gets the JSDoc this tag for the node if present */
4154 function getJSDocThisTag(node: Node): JSDocThisTag | undefined;
4155 /** Gets the JSDoc return tag for the node if present */
4156 function getJSDocReturnTag(node: Node): JSDocReturnTag | undefined;
4157 /** Gets the JSDoc template tag for the node if present */
4158 function getJSDocTemplateTag(node: Node): JSDocTemplateTag | undefined;
4159 /** Gets the JSDoc type tag for the node if present and valid */
4160 function getJSDocTypeTag(node: Node): JSDocTypeTag | undefined;
4162 * Gets the type node for the node if provided via JSDoc.
4164 * @remarks The search includes any JSDoc param tag that relates
4165 * to the provided parameter, for example a type tag on the
4166 * parameter itself, or a param tag on a containing function
4167 * expression, or a param tag on a variable declaration whose
4168 * initializer is the containing function. The tags closest to the
4169 * node are examined first, so in the previous example, the type
4170 * tag directly on the node would be returned.
4172 function getJSDocType(node: Node): TypeNode | undefined;
4174 * Gets the return type node for the node if provided via JSDoc return tag or type tag.
4176 * @remarks `getJSDocReturnTag` just gets the whole JSDoc tag. This function
4177 * gets the type from inside the braces, after the fat arrow, etc.
4179 function getJSDocReturnType(node: Node): TypeNode | undefined;
4180 /** Get all JSDoc tags related to a node, including those on parent nodes. */
4181 function getJSDocTags(node: Node): readonly JSDocTag[];
4182 /** Gets all JSDoc tags that match a specified predicate */
4183 function getAllJSDocTags<T extends JSDocTag>(node: Node, predicate: (tag: JSDocTag) => tag is T): readonly T[];
4184 /** Gets all JSDoc tags of a specified kind */
4185 function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): readonly JSDocTag[];
4187 * Gets the effective type parameters. If the node was parsed in a
4188 * JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
4190 function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): readonly TypeParameterDeclaration[];
4191 function getEffectiveConstraintOfTypeParameter(node: TypeParameterDeclaration): TypeNode | undefined;
4192 function isIdentifierOrPrivateIdentifier(node: Node): node is Identifier | PrivateIdentifier;
4193 function isPropertyAccessChain(node: Node): node is PropertyAccessChain;
4194 function isElementAccessChain(node: Node): node is ElementAccessChain;
4195 function isCallChain(node: Node): node is CallChain;
4196 function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain | NonNullChain;
4197 function isNullishCoalesce(node: Node): boolean;
4198 function isConstTypeReference(node: Node): boolean;
4199 function skipPartiallyEmittedExpressions(node: Expression): Expression;
4200 function skipPartiallyEmittedExpressions(node: Node): Node;
4201 function isNonNullChain(node: Node): node is NonNullChain;
4202 function isBreakOrContinueStatement(node: Node): node is BreakOrContinueStatement;
4203 function isNamedExportBindings(node: Node): node is NamedExportBindings;
4204 function isUnparsedTextLike(node: Node): node is UnparsedTextLike;
4205 function isUnparsedNode(node: Node): node is UnparsedNode;
4206 function isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag;
4208 * True if node is of some token syntax kind.
4209 * For example, this is true for an IfKeyword but not for an IfStatement.
4210 * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
4212 function isToken(n: Node): boolean;
4213 function isLiteralExpression(node: Node): node is LiteralExpression;
4214 function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken;
4215 function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
4216 function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
4217 function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyCompatibleAliasDeclaration;
4218 function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
4219 function isModifier(node: Node): node is Modifier;
4220 function isEntityName(node: Node): node is EntityName;
4221 function isPropertyName(node: Node): node is PropertyName;
4222 function isBindingName(node: Node): node is BindingName;
4223 function isFunctionLike(node: Node): node is SignatureDeclaration;
4224 function isClassElement(node: Node): node is ClassElement;
4225 function isClassLike(node: Node): node is ClassLikeDeclaration;
4226 function isAccessor(node: Node): node is AccessorDeclaration;
4227 function isTypeElement(node: Node): node is TypeElement;
4228 function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
4229 function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
4231 * Node test that determines whether a node is a valid type node.
4232 * This differs from the `isPartOfTypeNode` function which determines whether a node is *part*
4235 function isTypeNode(node: Node): node is TypeNode;
4236 function isFunctionOrConstructorTypeNode(node: Node): node is FunctionTypeNode | ConstructorTypeNode;
4237 function isPropertyAccessOrQualifiedName(node: Node): node is PropertyAccessExpression | QualifiedName;
4238 function isCallLikeExpression(node: Node): node is CallLikeExpression;
4239 function isCallOrNewExpression(node: Node): node is CallExpression | NewExpression;
4240 function isTemplateLiteral(node: Node): node is TemplateLiteral;
4241 function isAssertionExpression(node: Node): node is AssertionExpression;
4242 function isIterationStatement(node: Node, lookInLabeledStatements: false): node is IterationStatement;
4243 function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement | LabeledStatement;
4244 function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement;
4245 function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause;
4246 /** True if node is of a kind that may contain comment text. */
4247 function isJSDocCommentContainingNode(node: Node): boolean;
4248 function isSetAccessor(node: Node): node is SetAccessorDeclaration;
4249 function isGetAccessor(node: Node): node is GetAccessorDeclaration;
4250 /** True if has initializer node attached to it. */
4251 function hasOnlyExpressionInitializer(node: Node): node is HasExpressionInitializer;
4252 function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
4253 function isStringLiteralLike(node: Node): node is StringLiteralLike;
4255 declare namespace ts {
4256 const factory: NodeFactory;
4257 function createUnparsedSourceFile(text: string): UnparsedSource;
4258 function createUnparsedSourceFile(inputFile: InputFiles, type: "js" | "dts", stripInternal?: boolean): UnparsedSource;
4259 function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
4260 function createInputFiles(javascriptText: string, declarationText: string): InputFiles;
4261 function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles;
4262 function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
4264 * Create an external source map source file reference
4266 function createSourceMapSource(fileName: string, text: string, skipTrivia?: (pos: number) => number): SourceMapSource;
4267 function setOriginalNode<T extends Node>(node: T, original: Node | undefined): T;
4269 declare namespace ts {
4271 * Clears any `EmitNode` entries from parse-tree nodes.
4272 * @param sourceFile A source file.
4274 function disposeEmitNodes(sourceFile: SourceFile | undefined): void;
4276 * Sets flags that control emit behavior of a node.
4278 function setEmitFlags<T extends Node>(node: T, emitFlags: EmitFlags): T;
4280 * Gets a custom text range to use when emitting source maps.
4282 function getSourceMapRange(node: Node): SourceMapRange;
4284 * Sets a custom text range to use when emitting source maps.
4286 function setSourceMapRange<T extends Node>(node: T, range: SourceMapRange | undefined): T;
4288 * Gets the TextRange to use for source maps for a token of a node.
4290 function getTokenSourceMapRange(node: Node, token: SyntaxKind): SourceMapRange | undefined;
4292 * Sets the TextRange to use for source maps for a token of a node.
4294 function setTokenSourceMapRange<T extends Node>(node: T, token: SyntaxKind, range: SourceMapRange | undefined): T;
4296 * Gets a custom text range to use when emitting comments.
4298 function getCommentRange(node: Node): TextRange;
4300 * Sets a custom text range to use when emitting comments.
4302 function setCommentRange<T extends Node>(node: T, range: TextRange): T;
4303 function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined;
4304 function setSyntheticLeadingComments<T extends Node>(node: T, comments: SynthesizedComment[] | undefined): T;
4305 function addSyntheticLeadingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
4306 function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined;
4307 function setSyntheticTrailingComments<T extends Node>(node: T, comments: SynthesizedComment[] | undefined): T;
4308 function addSyntheticTrailingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
4309 function moveSyntheticComments<T extends Node>(node: T, original: Node): T;
4311 * Gets the constant value to emit for an expression representing an enum.
4313 function getConstantValue(node: AccessExpression): string | number | undefined;
4315 * Sets the constant value to emit for an expression.
4317 function setConstantValue(node: AccessExpression, value: string | number): AccessExpression;
4319 * Adds an EmitHelper to a node.
4321 function addEmitHelper<T extends Node>(node: T, helper: EmitHelper): T;
4323 * Add EmitHelpers to a node.
4325 function addEmitHelpers<T extends Node>(node: T, helpers: EmitHelper[] | undefined): T;
4327 * Removes an EmitHelper from a node.
4329 function removeEmitHelper(node: Node, helper: EmitHelper): boolean;
4331 * Gets the EmitHelpers of a node.
4333 function getEmitHelpers(node: Node): EmitHelper[] | undefined;
4335 * Moves matching emit helpers from a source node to a target node.
4337 function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void;
4339 declare namespace ts {
4340 function isNumericLiteral(node: Node): node is NumericLiteral;
4341 function isBigIntLiteral(node: Node): node is BigIntLiteral;
4342 function isStringLiteral(node: Node): node is StringLiteral;
4343 function isJsxText(node: Node): node is JsxText;
4344 function isRegularExpressionLiteral(node: Node): node is RegularExpressionLiteral;
4345 function isNoSubstitutionTemplateLiteral(node: Node): node is NoSubstitutionTemplateLiteral;
4346 function isTemplateHead(node: Node): node is TemplateHead;
4347 function isTemplateMiddle(node: Node): node is TemplateMiddle;
4348 function isTemplateTail(node: Node): node is TemplateTail;
4349 function isIdentifier(node: Node): node is Identifier;
4350 function isQualifiedName(node: Node): node is QualifiedName;
4351 function isComputedPropertyName(node: Node): node is ComputedPropertyName;
4352 function isPrivateIdentifier(node: Node): node is PrivateIdentifier;
4353 function isTypeParameterDeclaration(node: Node): node is TypeParameterDeclaration;
4354 function isParameter(node: Node): node is ParameterDeclaration;
4355 function isDecorator(node: Node): node is Decorator;
4356 function isPropertySignature(node: Node): node is PropertySignature;
4357 function isPropertyDeclaration(node: Node): node is PropertyDeclaration;
4358 function isMethodSignature(node: Node): node is MethodSignature;
4359 function isMethodDeclaration(node: Node): node is MethodDeclaration;
4360 function isConstructorDeclaration(node: Node): node is ConstructorDeclaration;
4361 function isGetAccessorDeclaration(node: Node): node is GetAccessorDeclaration;
4362 function isSetAccessorDeclaration(node: Node): node is SetAccessorDeclaration;
4363 function isCallSignatureDeclaration(node: Node): node is CallSignatureDeclaration;
4364 function isConstructSignatureDeclaration(node: Node): node is ConstructSignatureDeclaration;
4365 function isIndexSignatureDeclaration(node: Node): node is IndexSignatureDeclaration;
4366 function isTypePredicateNode(node: Node): node is TypePredicateNode;
4367 function isTypeReferenceNode(node: Node): node is TypeReferenceNode;
4368 function isFunctionTypeNode(node: Node): node is FunctionTypeNode;
4369 function isConstructorTypeNode(node: Node): node is ConstructorTypeNode;
4370 function isTypeQueryNode(node: Node): node is TypeQueryNode;
4371 function isTypeLiteralNode(node: Node): node is TypeLiteralNode;
4372 function isArrayTypeNode(node: Node): node is ArrayTypeNode;
4373 function isTupleTypeNode(node: Node): node is TupleTypeNode;
4374 function isNamedTupleMember(node: Node): node is NamedTupleMember;
4375 function isOptionalTypeNode(node: Node): node is OptionalTypeNode;
4376 function isRestTypeNode(node: Node): node is RestTypeNode;
4377 function isUnionTypeNode(node: Node): node is UnionTypeNode;
4378 function isIntersectionTypeNode(node: Node): node is IntersectionTypeNode;
4379 function isConditionalTypeNode(node: Node): node is ConditionalTypeNode;
4380 function isInferTypeNode(node: Node): node is InferTypeNode;
4381 function isParenthesizedTypeNode(node: Node): node is ParenthesizedTypeNode;
4382 function isThisTypeNode(node: Node): node is ThisTypeNode;
4383 function isTypeOperatorNode(node: Node): node is TypeOperatorNode;
4384 function isIndexedAccessTypeNode(node: Node): node is IndexedAccessTypeNode;
4385 function isMappedTypeNode(node: Node): node is MappedTypeNode;
4386 function isLiteralTypeNode(node: Node): node is LiteralTypeNode;
4387 function isImportTypeNode(node: Node): node is ImportTypeNode;
4388 function isTemplateLiteralTypeSpan(node: Node): node is TemplateLiteralTypeSpan;
4389 function isTemplateLiteralTypeNode(node: Node): node is TemplateLiteralTypeNode;
4390 function isObjectBindingPattern(node: Node): node is ObjectBindingPattern;
4391 function isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
4392 function isBindingElement(node: Node): node is BindingElement;
4393 function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression;
4394 function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression;
4395 function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression;
4396 function isElementAccessExpression(node: Node): node is ElementAccessExpression;
4397 function isCallExpression(node: Node): node is CallExpression;
4398 function isNewExpression(node: Node): node is NewExpression;
4399 function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
4400 function isTypeAssertionExpression(node: Node): node is TypeAssertion;
4401 function isParenthesizedExpression(node: Node): node is ParenthesizedExpression;
4402 function isFunctionExpression(node: Node): node is FunctionExpression;
4403 function isArrowFunction(node: Node): node is ArrowFunction;
4404 function isDeleteExpression(node: Node): node is DeleteExpression;
4405 function isTypeOfExpression(node: Node): node is TypeOfExpression;
4406 function isVoidExpression(node: Node): node is VoidExpression;
4407 function isAwaitExpression(node: Node): node is AwaitExpression;
4408 function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression;
4409 function isPostfixUnaryExpression(node: Node): node is PostfixUnaryExpression;
4410 function isBinaryExpression(node: Node): node is BinaryExpression;
4411 function isConditionalExpression(node: Node): node is ConditionalExpression;
4412 function isTemplateExpression(node: Node): node is TemplateExpression;
4413 function isYieldExpression(node: Node): node is YieldExpression;
4414 function isSpreadElement(node: Node): node is SpreadElement;
4415 function isClassExpression(node: Node): node is ClassExpression;
4416 function isOmittedExpression(node: Node): node is OmittedExpression;
4417 function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments;
4418 function isAsExpression(node: Node): node is AsExpression;
4419 function isNonNullExpression(node: Node): node is NonNullExpression;
4420 function isMetaProperty(node: Node): node is MetaProperty;
4421 function isSyntheticExpression(node: Node): node is SyntheticExpression;
4422 function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression;
4423 function isCommaListExpression(node: Node): node is CommaListExpression;
4424 function isTemplateSpan(node: Node): node is TemplateSpan;
4425 function isSemicolonClassElement(node: Node): node is SemicolonClassElement;
4426 function isBlock(node: Node): node is Block;
4427 function isVariableStatement(node: Node): node is VariableStatement;
4428 function isEmptyStatement(node: Node): node is EmptyStatement;
4429 function isExpressionStatement(node: Node): node is ExpressionStatement;
4430 function isIfStatement(node: Node): node is IfStatement;
4431 function isDoStatement(node: Node): node is DoStatement;
4432 function isWhileStatement(node: Node): node is WhileStatement;
4433 function isForStatement(node: Node): node is ForStatement;
4434 function isForInStatement(node: Node): node is ForInStatement;
4435 function isForOfStatement(node: Node): node is ForOfStatement;
4436 function isContinueStatement(node: Node): node is ContinueStatement;
4437 function isBreakStatement(node: Node): node is BreakStatement;
4438 function isReturnStatement(node: Node): node is ReturnStatement;
4439 function isWithStatement(node: Node): node is WithStatement;
4440 function isSwitchStatement(node: Node): node is SwitchStatement;
4441 function isLabeledStatement(node: Node): node is LabeledStatement;
4442 function isThrowStatement(node: Node): node is ThrowStatement;
4443 function isTryStatement(node: Node): node is TryStatement;
4444 function isDebuggerStatement(node: Node): node is DebuggerStatement;
4445 function isVariableDeclaration(node: Node): node is VariableDeclaration;
4446 function isVariableDeclarationList(node: Node): node is VariableDeclarationList;
4447 function isFunctionDeclaration(node: Node): node is FunctionDeclaration;
4448 function isClassDeclaration(node: Node): node is ClassDeclaration;
4449 function isInterfaceDeclaration(node: Node): node is InterfaceDeclaration;
4450 function isTypeAliasDeclaration(node: Node): node is TypeAliasDeclaration;
4451 function isEnumDeclaration(node: Node): node is EnumDeclaration;
4452 function isModuleDeclaration(node: Node): node is ModuleDeclaration;
4453 function isModuleBlock(node: Node): node is ModuleBlock;
4454 function isCaseBlock(node: Node): node is CaseBlock;
4455 function isNamespaceExportDeclaration(node: Node): node is NamespaceExportDeclaration;
4456 function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
4457 function isImportDeclaration(node: Node): node is ImportDeclaration;
4458 function isImportClause(node: Node): node is ImportClause;
4459 function isNamespaceImport(node: Node): node is NamespaceImport;
4460 function isNamespaceExport(node: Node): node is NamespaceExport;
4461 function isNamedImports(node: Node): node is NamedImports;
4462 function isImportSpecifier(node: Node): node is ImportSpecifier;
4463 function isExportAssignment(node: Node): node is ExportAssignment;
4464 function isExportDeclaration(node: Node): node is ExportDeclaration;
4465 function isNamedExports(node: Node): node is NamedExports;
4466 function isExportSpecifier(node: Node): node is ExportSpecifier;
4467 function isMissingDeclaration(node: Node): node is MissingDeclaration;
4468 function isNotEmittedStatement(node: Node): node is NotEmittedStatement;
4469 function isExternalModuleReference(node: Node): node is ExternalModuleReference;
4470 function isJsxElement(node: Node): node is JsxElement;
4471 function isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement;
4472 function isJsxOpeningElement(node: Node): node is JsxOpeningElement;
4473 function isJsxClosingElement(node: Node): node is JsxClosingElement;
4474 function isJsxFragment(node: Node): node is JsxFragment;
4475 function isJsxOpeningFragment(node: Node): node is JsxOpeningFragment;
4476 function isJsxClosingFragment(node: Node): node is JsxClosingFragment;
4477 function isJsxAttribute(node: Node): node is JsxAttribute;
4478 function isJsxAttributes(node: Node): node is JsxAttributes;
4479 function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute;
4480 function isJsxExpression(node: Node): node is JsxExpression;
4481 function isCaseClause(node: Node): node is CaseClause;
4482 function isDefaultClause(node: Node): node is DefaultClause;
4483 function isHeritageClause(node: Node): node is HeritageClause;
4484 function isCatchClause(node: Node): node is CatchClause;
4485 function isPropertyAssignment(node: Node): node is PropertyAssignment;
4486 function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment;
4487 function isSpreadAssignment(node: Node): node is SpreadAssignment;
4488 function isEnumMember(node: Node): node is EnumMember;
4489 function isUnparsedPrepend(node: Node): node is UnparsedPrepend;
4490 function isSourceFile(node: Node): node is SourceFile;
4491 function isBundle(node: Node): node is Bundle;
4492 function isUnparsedSource(node: Node): node is UnparsedSource;
4493 function isJSDocTypeExpression(node: Node): node is JSDocTypeExpression;
4494 function isJSDocNameReference(node: Node): node is JSDocNameReference;
4495 function isJSDocAllType(node: Node): node is JSDocAllType;
4496 function isJSDocUnknownType(node: Node): node is JSDocUnknownType;
4497 function isJSDocNullableType(node: Node): node is JSDocNullableType;
4498 function isJSDocNonNullableType(node: Node): node is JSDocNonNullableType;
4499 function isJSDocOptionalType(node: Node): node is JSDocOptionalType;
4500 function isJSDocFunctionType(node: Node): node is JSDocFunctionType;
4501 function isJSDocVariadicType(node: Node): node is JSDocVariadicType;
4502 function isJSDocNamepathType(node: Node): node is JSDocNamepathType;
4503 function isJSDoc(node: Node): node is JSDoc;
4504 function isJSDocTypeLiteral(node: Node): node is JSDocTypeLiteral;
4505 function isJSDocSignature(node: Node): node is JSDocSignature;
4506 function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
4507 function isJSDocAuthorTag(node: Node): node is JSDocAuthorTag;
4508 function isJSDocClassTag(node: Node): node is JSDocClassTag;
4509 function isJSDocCallbackTag(node: Node): node is JSDocCallbackTag;
4510 function isJSDocPublicTag(node: Node): node is JSDocPublicTag;
4511 function isJSDocPrivateTag(node: Node): node is JSDocPrivateTag;
4512 function isJSDocProtectedTag(node: Node): node is JSDocProtectedTag;
4513 function isJSDocReadonlyTag(node: Node): node is JSDocReadonlyTag;
4514 function isJSDocDeprecatedTag(node: Node): node is JSDocDeprecatedTag;
4515 function isJSDocSeeTag(node: Node): node is JSDocSeeTag;
4516 function isJSDocEnumTag(node: Node): node is JSDocEnumTag;
4517 function isJSDocParameterTag(node: Node): node is JSDocParameterTag;
4518 function isJSDocReturnTag(node: Node): node is JSDocReturnTag;
4519 function isJSDocThisTag(node: Node): node is JSDocThisTag;
4520 function isJSDocTypeTag(node: Node): node is JSDocTypeTag;
4521 function isJSDocTemplateTag(node: Node): node is JSDocTemplateTag;
4522 function isJSDocTypedefTag(node: Node): node is JSDocTypedefTag;
4523 function isJSDocUnknownTag(node: Node): node is JSDocUnknownTag;
4524 function isJSDocPropertyTag(node: Node): node is JSDocPropertyTag;
4525 function isJSDocImplementsTag(node: Node): node is JSDocImplementsTag;
4527 declare namespace ts {
4528 function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T;
4530 declare namespace ts {
4532 * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
4533 * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
4534 * embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns
4535 * a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.
4537 * @param node a given node to visit its children
4538 * @param cbNode a callback to be invoked for all child nodes
4539 * @param cbNodes a callback to be invoked for embedded array
4541 * @remarks `forEachChild` must visit the children of a node in the order
4542 * that they appear in the source code. The language service depends on this property to locate nodes by position.
4544 export function forEachChild<T>(node: Node, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
4545 export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
4546 export function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName | undefined;
4548 * Parse json text into SyntaxTree and return node and parse errors if any
4552 export function parseJsonText(fileName: string, sourceText: string): JsonSourceFile;
4553 export function isExternalModule(file: SourceFile): boolean;
4554 export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
4557 declare namespace ts {
4558 export function parseCommandLine(commandLine: readonly string[], readFile?: (path: string) => string | undefined): ParsedCommandLine;
4559 export type DiagnosticReporter = (diagnostic: Diagnostic) => void;
4561 * Reports config file diagnostics
4563 export interface ConfigFileDiagnosticsReporter {
4565 * Reports unrecoverable error when parsing config file
4567 onUnRecoverableConfigFileDiagnostic: DiagnosticReporter;
4570 * Interface extending ParseConfigHost to support ParseConfigFile that reads config file and reports errors
4572 export interface ParseConfigFileHost extends ParseConfigHost, ConfigFileDiagnosticsReporter {
4573 getCurrentDirectory(): string;
4576 * Reads the config file, reports errors if any and exits if the config file cannot be found
4578 export function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined;
4580 * Read tsconfig.json file
4581 * @param fileName The path to the config file
4583 export function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): {
4588 * Parse the text of the tsconfig.json file
4589 * @param fileName The path to the config file
4590 * @param jsonText The text of the config file
4592 export function parseConfigFileTextToJson(fileName: string, jsonText: string): {
4597 * Read tsconfig.json file
4598 * @param fileName The path to the config file
4600 export function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): TsConfigSourceFile;
4602 * Convert the json syntax tree into the json value
4604 export function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any;
4606 * Parse the contents of a config file (tsconfig.json).
4607 * @param json The contents of the config file to parse
4608 * @param host Instance of ParseConfigHost used to enumerate files in folder.
4609 * @param basePath A root directory to resolve relative path entries in the config
4610 * file to. e.g. outDir
4612 export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
4614 * Parse the contents of a config file (tsconfig.json).
4615 * @param jsonNode The contents of the config file to parse
4616 * @param host Instance of ParseConfigHost used to enumerate files in folder.
4617 * @param basePath A root directory to resolve relative path entries in the config
4618 * file to. e.g. outDir
4620 export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
4621 export interface ParsedTsconfig {
4623 options?: CompilerOptions;
4624 watchOptions?: WatchOptions;
4625 typeAcquisition?: TypeAcquisition;
4627 * Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
4629 extendedConfigPath?: string;
4631 export interface ExtendedConfigCacheEntry {
4632 extendedResult: TsConfigSourceFile;
4633 extendedConfig: ParsedTsconfig | undefined;
4635 export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
4636 options: CompilerOptions;
4637 errors: Diagnostic[];
4639 export function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
4640 options: TypeAcquisition;
4641 errors: Diagnostic[];
4645 declare namespace ts {
4646 function getEffectiveTypeRoots(options: CompilerOptions, host: GetEffectiveTypeRootsHost): string[] | undefined;
4648 * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.
4649 * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
4650 * is assumed to be the same as root directory of the project.
4652 function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
4654 * Given a set of options, returns the set of type directive names
4655 * that should be included for this program automatically.
4656 * This list could either come from the config file,
4657 * or from enumerating the types root + initial secondary types lookup location.
4658 * More type directives might appear in the program later as a result of loading actual source files;
4659 * this list is only the set of defaults that are implicitly included.
4661 function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
4663 * Cached module resolutions per containing directory.
4664 * This assumes that any module id will have the same resolution for sibling files located in the same folder.
4666 interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
4667 getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<ResolvedModuleWithFailedLookupLocations>;
4670 * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
4671 * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
4673 interface NonRelativeModuleNameResolutionCache {
4674 getOrCreateCacheForModuleName(nonRelativeModuleName: string, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
4676 interface PerModuleNameCache {
4677 get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
4678 set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
4680 function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
4681 function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
4682 function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
4683 function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
4684 function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
4686 declare namespace ts {
4688 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
4690 * @param node The Node to visit.
4691 * @param visitor The callback used to visit the Node.
4692 * @param test A callback to execute to verify the Node is valid.
4693 * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
4695 function visitNode<T extends Node>(node: T, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T;
4697 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
4699 * @param node The Node to visit.
4700 * @param visitor The callback used to visit the Node.
4701 * @param test A callback to execute to verify the Node is valid.
4702 * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
4704 function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T | undefined;
4706 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
4708 * @param nodes The NodeArray to visit.
4709 * @param visitor The callback used to visit a Node.
4710 * @param test A node test to execute for each node.
4711 * @param start An optional value indicating the starting offset at which to start visiting.
4712 * @param count An optional value indicating the maximum number of nodes to visit.
4714 function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
4716 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
4718 * @param nodes The NodeArray to visit.
4719 * @param visitor The callback used to visit a Node.
4720 * @param test A node test to execute for each node.
4721 * @param start An optional value indicating the starting offset at which to start visiting.
4722 * @param count An optional value indicating the maximum number of nodes to visit.
4724 function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
4726 * Starts a new lexical environment and visits a statement list, ending the lexical environment
4727 * and merging hoisted declarations upon completion.
4729 function visitLexicalEnvironment(statements: NodeArray<Statement>, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean, nodesVisitor?: NodesVisitor): NodeArray<Statement>;
4731 * Starts a new lexical environment and visits a parameter list, suspending the lexical
4732 * environment upon completion.
4734 function visitParameterList(nodes: NodeArray<ParameterDeclaration>, visitor: Visitor, context: TransformationContext, nodesVisitor?: NodesVisitor): NodeArray<ParameterDeclaration>;
4735 function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: NodesVisitor): NodeArray<ParameterDeclaration> | undefined;
4737 * Resumes a suspended lexical environment and visits a function body, ending the lexical
4738 * environment and merging hoisted declarations upon completion.
4740 function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody;
4742 * Resumes a suspended lexical environment and visits a function body, ending the lexical
4743 * environment and merging hoisted declarations upon completion.
4745 function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined;
4747 * Resumes a suspended lexical environment and visits a concise body, ending the lexical
4748 * environment and merging hoisted declarations upon completion.
4750 function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody;
4752 * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
4754 * @param node The Node whose children will be visited.
4755 * @param visitor The callback used to visit each child.
4756 * @param context A lexical environment context for the visitor.
4758 function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext): T;
4760 * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
4762 * @param node The Node whose children will be visited.
4763 * @param visitor The callback used to visit each child.
4764 * @param context A lexical environment context for the visitor.
4766 function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
4768 declare namespace ts {
4769 function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions): string | undefined;
4770 function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[];
4771 function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer;
4773 declare namespace ts {
4774 export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined;
4775 export function resolveTripleslashReference(moduleName: string, containingFile: string): string;
4776 export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
4777 export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
4778 export interface FormatDiagnosticsHost {
4779 getCurrentDirectory(): string;
4780 getCanonicalFileName(fileName: string): string;
4781 getNewLine(): string;
4783 export function formatDiagnostics(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string;
4784 export function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string;
4785 export function formatDiagnosticsWithColorAndContext(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string;
4786 export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string;
4787 export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
4789 * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
4790 * that represent a compilation unit.
4792 * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and
4793 * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
4795 * @param createProgramOptions - The options for creating a program.
4796 * @returns A 'Program' object.
4798 export function createProgram(createProgramOptions: CreateProgramOptions): Program;
4800 * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
4801 * that represent a compilation unit.
4803 * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and
4804 * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
4806 * @param rootNames - A set of root files.
4807 * @param options - The compiler options which should be used.
4808 * @param host - The host interacts with the underlying file system.
4809 * @param oldProgram - Reuses an old program structure.
4810 * @param configFileParsingDiagnostics - error during config file parsing
4811 * @returns A 'Program' object.
4813 export function createProgram(rootNames: readonly string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: readonly Diagnostic[]): Program;
4814 /** @deprecated */ export interface ResolveProjectReferencePathHost {
4815 fileExists(fileName: string): boolean;
4818 * Returns the target config filename of a project reference.
4819 * Note: The file might not exist.
4821 export function resolveProjectReferencePath(ref: ProjectReference): ResolvedConfigFileName;
4822 /** @deprecated */ export function resolveProjectReferencePath(host: ResolveProjectReferencePathHost, ref: ProjectReference): ResolvedConfigFileName;
4825 declare namespace ts {
4826 interface EmitOutput {
4827 outputFiles: OutputFile[];
4828 emitSkipped: boolean;
4830 interface OutputFile {
4832 writeByteOrderMark: boolean;
4836 declare namespace ts {
4837 type AffectedFileResult<T> = {
4839 affected: SourceFile | Program;
4841 interface BuilderProgramHost {
4843 * return true if file names are treated with case sensitivity
4845 useCaseSensitiveFileNames(): boolean;
4847 * If provided this would be used this hash instead of actual file shape text for detecting changes
4849 createHash?: (data: string) => string;
4851 * When emit or emitNextAffectedFile are called without writeFile,
4852 * this callback if present would be used to write files
4854 writeFile?: WriteFileCallback;
4857 * Builder to manage the program state changes
4859 interface BuilderProgram {
4861 * Returns current program
4863 getProgram(): Program;
4865 * Get compiler options of the program
4867 getCompilerOptions(): CompilerOptions;
4869 * Get the source file in the program with file name
4871 getSourceFile(fileName: string): SourceFile | undefined;
4873 * Get a list of files in the program
4875 getSourceFiles(): readonly SourceFile[];
4877 * Get the diagnostics for compiler options
4879 getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[];
4881 * Get the diagnostics that dont belong to any file
4883 getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[];
4885 * Get the diagnostics from config file parsing
4887 getConfigFileParsingDiagnostics(): readonly Diagnostic[];
4889 * Get the syntax diagnostics, for all source files if source file is not supplied
4891 getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
4893 * Get the declaration diagnostics, for all source files if source file is not supplied
4895 getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[];
4897 * Get all the dependencies of the file
4899 getAllDependencies(sourceFile: SourceFile): readonly string[];
4901 * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program
4902 * The semantic diagnostics are cached and managed here
4903 * Note that it is assumed that when asked about semantic diagnostics through this API,
4904 * the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics
4905 * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided,
4906 * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics
4908 getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
4910 * Emits the JavaScript and declaration files.
4911 * When targetSource file is specified, emits the files corresponding to that source file,
4912 * otherwise for the whole program.
4913 * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified,
4914 * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified,
4915 * it will only emit all the affected files instead of whole program
4917 * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
4918 * in that order would be used to write the files
4920 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
4922 * Get the current directory of the program
4924 getCurrentDirectory(): string;
4927 * The builder that caches the semantic diagnostics for the program and handles the changed files and affected files
4929 interface SemanticDiagnosticsBuilderProgram extends BuilderProgram {
4931 * Gets the semantic diagnostics from the program for the next affected file and caches it
4932 * Returns undefined if the iteration is complete
4934 getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult<readonly Diagnostic[]>;
4937 * The builder that can handle the changes in program and iterate through changed file to emit the files
4938 * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files
4940 interface EmitAndSemanticDiagnosticsBuilderProgram extends SemanticDiagnosticsBuilderProgram {
4942 * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete
4943 * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
4944 * in that order would be used to write the files
4946 emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult<EmitResult>;
4949 * Create the builder to manage semantic diagnostics and cache them
4951 function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[]): SemanticDiagnosticsBuilderProgram;
4952 function createSemanticDiagnosticsBuilderProgram(rootNames: readonly string[] | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[], projectReferences?: readonly ProjectReference[]): SemanticDiagnosticsBuilderProgram;
4954 * Create the builder that can handle the changes in program and iterate through changed files
4955 * to emit the those files and manage semantic diagnostics cache as well
4957 function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[]): EmitAndSemanticDiagnosticsBuilderProgram;
4958 function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: readonly string[] | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[], projectReferences?: readonly ProjectReference[]): EmitAndSemanticDiagnosticsBuilderProgram;
4960 * Creates a builder thats just abstraction over program and can be used with watch
4962 function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[]): BuilderProgram;
4963 function createAbstractBuilder(rootNames: readonly string[] | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: readonly Diagnostic[], projectReferences?: readonly ProjectReference[]): BuilderProgram;
4965 declare namespace ts {
4966 interface ReadBuildProgramHost {
4967 useCaseSensitiveFileNames(): boolean;
4968 getCurrentDirectory(): string;
4969 readFile(fileName: string): string | undefined;
4971 function readBuilderProgram(compilerOptions: CompilerOptions, host: ReadBuildProgramHost): EmitAndSemanticDiagnosticsBuilderProgram | undefined;
4972 function createIncrementalCompilerHost(options: CompilerOptions, system?: System): CompilerHost;
4973 interface IncrementalProgramOptions<T extends BuilderProgram> {
4974 rootNames: readonly string[];
4975 options: CompilerOptions;
4976 configFileParsingDiagnostics?: readonly Diagnostic[];
4977 projectReferences?: readonly ProjectReference[];
4978 host?: CompilerHost;
4979 createProgram?: CreateProgram<T>;
4981 function createIncrementalProgram<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>({ rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram }: IncrementalProgramOptions<T>): T;
4982 type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions, errorCount?: number) => void;
4983 /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */
4984 type CreateProgram<T extends BuilderProgram> = (rootNames: readonly string[] | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: readonly Diagnostic[], projectReferences?: readonly ProjectReference[] | undefined) => T;
4985 /** Host that has watch functionality used in --watch mode */
4986 interface WatchHost {
4987 /** If provided, called with Diagnostic message that informs about change in watch status */
4988 onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions, errorCount?: number): void;
4989 /** Used to watch changes in source files, missing files needed to update the program or config file */
4990 watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: CompilerOptions): FileWatcher;
4991 /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */
4992 watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: CompilerOptions): FileWatcher;
4993 /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */
4994 setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
4995 /** If provided, will be used to reset existing delayed compilation */
4996 clearTimeout?(timeoutId: any): void;
4998 interface ProgramHost<T extends BuilderProgram> {
5000 * Used to create the program when need for program creation or recreation detected
5002 createProgram: CreateProgram<T>;
5003 useCaseSensitiveFileNames(): boolean;
5004 getNewLine(): string;
5005 getCurrentDirectory(): string;
5006 getDefaultLibFileName(options: CompilerOptions): string;
5007 getDefaultLibLocation?(): string;
5008 createHash?(data: string): string;
5010 * Use to check file presence for source files and
5011 * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well
5013 fileExists(path: string): boolean;
5015 * Use to read file text for source files and
5016 * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well
5018 readFile(path: string, encoding?: string): string | undefined;
5019 /** If provided, used for module resolution as well as to handle directory structure */
5020 directoryExists?(path: string): boolean;
5021 /** If provided, used in resolutions as well as handling directory structure */
5022 getDirectories?(path: string): string[];
5023 /** If provided, used to cache and handle directory structure modifications */
5024 readDirectory?(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
5025 /** Symbol links resolution */
5026 realpath?(path: string): string;
5027 /** If provided would be used to write log about compilation */
5028 trace?(s: string): void;
5029 /** If provided is used to get the environment variable */
5030 getEnvironmentVariable?(name: string): string | undefined;
5031 /** If provided, used to resolve the module names, otherwise typescript's default module resolution */
5032 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
5033 /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
5034 resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
5036 interface WatchCompilerHost<T extends BuilderProgram> extends ProgramHost<T>, WatchHost {
5037 /** Instead of using output d.ts file from project reference, use its source file */
5038 useSourceOfProjectReferenceRedirect?(): boolean;
5039 /** If provided, callback to invoke after every new program creation */
5040 afterProgramCreate?(program: T): void;
5043 * Host to create watch with root files and options
5045 interface WatchCompilerHostOfFilesAndCompilerOptions<T extends BuilderProgram> extends WatchCompilerHost<T> {
5046 /** root files to use to generate program */
5047 rootFiles: string[];
5048 /** Compiler options */
5049 options: CompilerOptions;
5050 watchOptions?: WatchOptions;
5051 /** Project References */
5052 projectReferences?: readonly ProjectReference[];
5055 * Host to create watch with config file
5057 interface WatchCompilerHostOfConfigFile<T extends BuilderProgram> extends WatchCompilerHost<T>, ConfigFileDiagnosticsReporter {
5058 /** Name of the config file to compile */
5059 configFileName: string;
5060 /** Options to extend */
5061 optionsToExtend?: CompilerOptions;
5062 watchOptionsToExtend?: WatchOptions;
5063 extraFileExtensions?: readonly FileExtensionInfo[];
5065 * Used to generate source file names from the config file and its include, exclude, files rules
5066 * and also to cache the directory stucture
5068 readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
5070 interface Watch<T> {
5071 /** Synchronize with host and get updated program */
5073 /** Closes the watch */
5077 * Creates the watch what generates program using the config file
5079 interface WatchOfConfigFile<T> extends Watch<T> {
5082 * Creates the watch that generates program using the root files and compiler options
5084 interface WatchOfFilesAndCompilerOptions<T> extends Watch<T> {
5085 /** Updates the root files in the program, only if this is not config file compilation */
5086 updateRootFileNames(fileNames: string[]): void;
5089 * Create the watch compiler host for either configFile or fileNames and its options
5091 function createWatchCompilerHost<T extends BuilderProgram>(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): WatchCompilerHostOfConfigFile<T>;
5092 function createWatchCompilerHost<T extends BuilderProgram>(rootFiles: string[], options: CompilerOptions, system: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter, projectReferences?: readonly ProjectReference[], watchOptions?: WatchOptions): WatchCompilerHostOfFilesAndCompilerOptions<T>;
5094 * Creates the watch from the host for root files and compiler options
5096 function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfFilesAndCompilerOptions<T>): WatchOfFilesAndCompilerOptions<T>;
5098 * Creates the watch from the host for config file
5100 function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfConfigFile<T>): WatchOfConfigFile<T>;
5102 declare namespace ts {
5103 interface BuildOptions {
5107 incremental?: boolean;
5108 assumeChangesOnlyAffectDirectDependencies?: boolean;
5109 traceResolution?: boolean;
5110 [option: string]: CompilerOptionsValue | undefined;
5112 type ReportEmitErrorSummary = (errorCount: number) => void;
5113 interface SolutionBuilderHostBase<T extends BuilderProgram> extends ProgramHost<T> {
5114 createDirectory?(path: string): void;
5116 * Should provide create directory and writeFile if done of invalidatedProjects is not invoked with
5119 writeFile?(path: string, data: string, writeByteOrderMark?: boolean): void;
5120 getModifiedTime(fileName: string): Date | undefined;
5121 setModifiedTime(fileName: string, date: Date): void;
5122 deleteFile(fileName: string): void;
5123 getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
5124 reportDiagnostic: DiagnosticReporter;
5125 reportSolutionBuilderStatus: DiagnosticReporter;
5126 afterProgramEmitAndDiagnostics?(program: T): void;
5128 interface SolutionBuilderHost<T extends BuilderProgram> extends SolutionBuilderHostBase<T> {
5129 reportErrorSummary?: ReportEmitErrorSummary;
5131 interface SolutionBuilderWithWatchHost<T extends BuilderProgram> extends SolutionBuilderHostBase<T>, WatchHost {
5133 interface SolutionBuilder<T extends BuilderProgram> {
5134 build(project?: string, cancellationToken?: CancellationToken): ExitStatus;
5135 clean(project?: string): ExitStatus;
5136 buildReferences(project: string, cancellationToken?: CancellationToken): ExitStatus;
5137 cleanReferences(project?: string): ExitStatus;
5138 getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject<T> | undefined;
5141 * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic
5143 function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter;
5144 function createSolutionBuilderHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system?: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary): SolutionBuilderHost<T>;
5145 function createSolutionBuilderWithWatchHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system?: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): SolutionBuilderWithWatchHost<T>;
5146 function createSolutionBuilder<T extends BuilderProgram>(host: SolutionBuilderHost<T>, rootNames: readonly string[], defaultOptions: BuildOptions): SolutionBuilder<T>;
5147 function createSolutionBuilderWithWatch<T extends BuilderProgram>(host: SolutionBuilderWithWatchHost<T>, rootNames: readonly string[], defaultOptions: BuildOptions, baseWatchOptions?: WatchOptions): SolutionBuilder<T>;
5148 enum InvalidatedProjectKind {
5151 UpdateOutputFileStamps = 2
5153 interface InvalidatedProjectBase {
5154 readonly kind: InvalidatedProjectKind;
5155 readonly project: ResolvedConfigFileName;
5157 * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly
5159 done(cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): ExitStatus;
5160 getCompilerOptions(): CompilerOptions;
5161 getCurrentDirectory(): string;
5163 interface UpdateOutputFileStampsProject extends InvalidatedProjectBase {
5164 readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps;
5165 updateOutputFileStatmps(): void;
5167 interface BuildInvalidedProject<T extends BuilderProgram> extends InvalidatedProjectBase {
5168 readonly kind: InvalidatedProjectKind.Build;
5169 getBuilderProgram(): T | undefined;
5170 getProgram(): Program | undefined;
5171 getSourceFile(fileName: string): SourceFile | undefined;
5172 getSourceFiles(): readonly SourceFile[];
5173 getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[];
5174 getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[];
5175 getConfigFileParsingDiagnostics(): readonly Diagnostic[];
5176 getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
5177 getAllDependencies(sourceFile: SourceFile): readonly string[];
5178 getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
5179 getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult<readonly Diagnostic[]>;
5180 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult | undefined;
5182 interface UpdateBundleProject<T extends BuilderProgram> extends InvalidatedProjectBase {
5183 readonly kind: InvalidatedProjectKind.UpdateBundle;
5184 emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject<T> | undefined;
5186 type InvalidatedProject<T extends BuilderProgram> = UpdateOutputFileStampsProject | BuildInvalidedProject<T> | UpdateBundleProject<T>;
5188 declare namespace ts.server {
5189 type ActionSet = "action::set";
5190 type ActionInvalidate = "action::invalidate";
5191 type ActionPackageInstalled = "action::packageInstalled";
5192 type EventTypesRegistry = "event::typesRegistry";
5193 type EventBeginInstallTypes = "event::beginInstallTypes";
5194 type EventEndInstallTypes = "event::endInstallTypes";
5195 type EventInitializationFailed = "event::initializationFailed";
5197 declare namespace ts.server {
5198 interface TypingInstallerResponse {
5199 readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
5201 interface TypingInstallerRequestWithProjectName {
5202 readonly projectName: string;
5204 interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
5205 readonly fileNames: string[];
5206 readonly projectRootPath: Path;
5207 readonly compilerOptions: CompilerOptions;
5208 readonly watchOptions?: WatchOptions;
5209 readonly typeAcquisition: TypeAcquisition;
5210 readonly unresolvedImports: SortedReadonlyArray<string>;
5211 readonly cachePath?: string;
5212 readonly kind: "discover";
5214 interface CloseProject extends TypingInstallerRequestWithProjectName {
5215 readonly kind: "closeProject";
5217 interface TypesRegistryRequest {
5218 readonly kind: "typesRegistry";
5220 interface InstallPackageRequest extends TypingInstallerRequestWithProjectName {
5221 readonly kind: "installPackage";
5222 readonly fileName: Path;
5223 readonly packageName: string;
5224 readonly projectRootPath: Path;
5226 interface PackageInstalledResponse extends ProjectResponse {
5227 readonly kind: ActionPackageInstalled;
5228 readonly success: boolean;
5229 readonly message: string;
5231 interface InitializationFailedResponse extends TypingInstallerResponse {
5232 readonly kind: EventInitializationFailed;
5233 readonly message: string;
5234 readonly stack?: string;
5236 interface ProjectResponse extends TypingInstallerResponse {
5237 readonly projectName: string;
5239 interface InvalidateCachedTypings extends ProjectResponse {
5240 readonly kind: ActionInvalidate;
5242 interface InstallTypes extends ProjectResponse {
5243 readonly kind: EventBeginInstallTypes | EventEndInstallTypes;
5244 readonly eventId: number;
5245 readonly typingsInstallerVersion: string;
5246 readonly packagesToInstall: readonly string[];
5248 interface BeginInstallTypes extends InstallTypes {
5249 readonly kind: EventBeginInstallTypes;
5251 interface EndInstallTypes extends InstallTypes {
5252 readonly kind: EventEndInstallTypes;
5253 readonly installSuccess: boolean;
5255 interface SetTypings extends ProjectResponse {
5256 readonly typeAcquisition: TypeAcquisition;
5257 readonly compilerOptions: CompilerOptions;
5258 readonly typings: string[];
5259 readonly unresolvedImports: SortedReadonlyArray<string>;
5260 readonly kind: ActionSet;
5263 declare namespace ts {
5265 getSourceFile(): SourceFile;
5266 getChildCount(sourceFile?: SourceFile): number;
5267 getChildAt(index: number, sourceFile?: SourceFile): Node;
5268 getChildren(sourceFile?: SourceFile): Node[];
5269 getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
5270 getFullStart(): number;
5272 getWidth(sourceFile?: SourceFileLike): number;
5273 getFullWidth(): number;
5274 getLeadingTriviaWidth(sourceFile?: SourceFile): number;
5275 getFullText(sourceFile?: SourceFile): string;
5276 getText(sourceFile?: SourceFile): string;
5277 getFirstToken(sourceFile?: SourceFile): Node | undefined;
5278 getLastToken(sourceFile?: SourceFile): Node | undefined;
5279 forEachChild<T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
5281 interface Identifier {
5282 readonly text: string;
5284 interface PrivateIdentifier {
5285 readonly text: string;
5288 readonly name: string;
5289 getFlags(): SymbolFlags;
5290 getEscapedName(): __String;
5292 getDeclarations(): Declaration[] | undefined;
5293 getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
5294 getJsDocTags(): JSDocTagInfo[];
5297 getFlags(): TypeFlags;
5298 getSymbol(): Symbol | undefined;
5299 getProperties(): Symbol[];
5300 getProperty(propertyName: string): Symbol | undefined;
5301 getApparentProperties(): Symbol[];
5302 getCallSignatures(): readonly Signature[];
5303 getConstructSignatures(): readonly Signature[];
5304 getStringIndexType(): Type | undefined;
5305 getNumberIndexType(): Type | undefined;
5306 getBaseTypes(): BaseType[] | undefined;
5307 getNonNullableType(): Type;
5308 getConstraint(): Type | undefined;
5309 getDefault(): Type | undefined;
5310 isUnion(): this is UnionType;
5311 isIntersection(): this is IntersectionType;
5312 isUnionOrIntersection(): this is UnionOrIntersectionType;
5313 isLiteral(): this is LiteralType;
5314 isStringLiteral(): this is StringLiteralType;
5315 isNumberLiteral(): this is NumberLiteralType;
5316 isTypeParameter(): this is TypeParameter;
5317 isClassOrInterface(): this is InterfaceType;
5318 isClass(): this is InterfaceType;
5320 interface TypeReference {
5321 typeArguments?: readonly Type[];
5323 interface Signature {
5324 getDeclaration(): SignatureDeclaration;
5325 getTypeParameters(): TypeParameter[] | undefined;
5326 getParameters(): Symbol[];
5327 getReturnType(): Type;
5328 getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
5329 getJsDocTags(): JSDocTagInfo[];
5331 interface SourceFile {
5332 getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
5333 getLineEndOfPosition(pos: number): number;
5334 getLineStarts(): readonly number[];
5335 getPositionOfLineAndCharacter(line: number, character: number): number;
5336 update(newText: string, textChangeRange: TextChangeRange): SourceFile;
5338 interface SourceFileLike {
5339 getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
5341 interface SourceMapSource {
5342 getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
5345 * Represents an immutable snapshot of a script at a specified time.Once acquired, the
5346 * snapshot is observably immutable. i.e. the same calls with the same parameters will return
5349 interface IScriptSnapshot {
5350 /** Gets a portion of the script snapshot specified by [start, end). */
5351 getText(start: number, end: number): string;
5352 /** Gets the length of this script snapshot. */
5353 getLength(): number;
5355 * Gets the TextChangeRange that describe how the text changed between this text and
5356 * an older version. This information is used by the incremental parser to determine
5357 * what sections of the script need to be re-parsed. 'undefined' can be returned if the
5358 * change range cannot be determined. However, in that case, incremental parsing will
5359 * not happen and the entire document will be re - parsed.
5361 getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
5362 /** Releases all resources held by this script snapshot */
5365 namespace ScriptSnapshot {
5366 function fromString(text: string): IScriptSnapshot;
5368 interface PreProcessedFileInfo {
5369 referencedFiles: FileReference[];
5370 typeReferenceDirectives: FileReference[];
5371 libReferenceDirectives: FileReference[];
5372 importedFiles: FileReference[];
5373 ambientExternalModules?: string[];
5376 interface HostCancellationToken {
5377 isCancellationRequested(): boolean;
5379 interface InstallPackageOptions {
5381 packageName: string;
5383 interface PerformanceEvent {
5384 kind: "UpdateGraph" | "CreatePackageJsonAutoImportProvider";
5387 enum LanguageServiceMode {
5389 PartialSemantic = 1,
5392 interface LanguageServiceHost extends GetEffectiveTypeRootsHost {
5393 getCompilationSettings(): CompilerOptions;
5394 getNewLine?(): string;
5395 getProjectVersion?(): string;
5396 getScriptFileNames(): string[];
5397 getScriptKind?(fileName: string): ScriptKind;
5398 getScriptVersion(fileName: string): string;
5399 getScriptSnapshot(fileName: string): IScriptSnapshot | undefined;
5400 getProjectReferences?(): readonly ProjectReference[] | undefined;
5401 getLocalizedDiagnosticMessages?(): any;
5402 getCancellationToken?(): HostCancellationToken;
5403 getCurrentDirectory(): string;
5404 getDefaultLibFileName(options: CompilerOptions): string;
5405 log?(s: string): void;
5406 trace?(s: string): void;
5407 error?(s: string): void;
5408 useCaseSensitiveFileNames?(): boolean;
5409 readDirectory?(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
5410 readFile?(path: string, encoding?: string): string | undefined;
5411 realpath?(path: string): string;
5412 fileExists?(path: string): boolean;
5413 getTypeRootsVersion?(): number;
5414 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
5415 getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
5416 resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
5417 getDirectories?(directoryName: string): string[];
5419 * Gets a set of custom transformers to use during emit.
5421 getCustomTransformers?(): CustomTransformers | undefined;
5422 isKnownTypesPackageName?(name: string): boolean;
5423 installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
5424 writeFile?(fileName: string, content: string): void;
5426 type WithMetadata<T> = T & {
5429 enum SemanticClassificationFormat {
5430 Original = "original",
5431 TwentyTwenty = "2020"
5433 interface LanguageService {
5434 /** This is used as a part of restarting the language service. */
5435 cleanupSemanticCache(): void;
5437 * Gets errors indicating invalid syntax in a file.
5439 * In English, "this cdeo have, erorrs" is syntactically invalid because it has typos,
5440 * grammatical errors, and misplaced punctuation. Likewise, examples of syntax
5441 * errors in TypeScript are missing parentheses in an `if` statement, mismatched
5442 * curly braces, and using a reserved keyword as a variable name.
5444 * These diagnostics are inexpensive to compute and don't require knowledge of
5445 * other files. Note that a non-empty result increases the likelihood of false positives
5446 * from `getSemanticDiagnostics`.
5448 * While these represent the majority of syntax-related diagnostics, there are some
5449 * that require the type system, which will be present in `getSemanticDiagnostics`.
5451 * @param fileName A path to the file you want syntactic diagnostics for
5453 getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[];
5455 * Gets warnings or errors indicating type system issues in a given file.
5456 * Requesting semantic diagnostics may start up the type system and
5457 * run deferred work, so the first call may take longer than subsequent calls.
5459 * Unlike the other get*Diagnostics functions, these diagnostics can potentially not
5460 * include a reference to a source file. Specifically, the first time this is called,
5461 * it will return global diagnostics with no associated location.
5463 * To contrast the differences between semantic and syntactic diagnostics, consider the
5464 * sentence: "The sun is green." is syntactically correct; those are real English words with
5465 * correct sentence structure. However, it is semantically invalid, because it is not true.
5467 * @param fileName A path to the file you want semantic diagnostics for
5469 getSemanticDiagnostics(fileName: string): Diagnostic[];
5471 * Gets suggestion diagnostics for a specific file. These diagnostics tend to
5472 * proactively suggest refactors, as opposed to diagnostics that indicate
5473 * potentially incorrect runtime behavior.
5475 * @param fileName A path to the file you want semantic diagnostics for
5477 getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[];
5479 * Gets global diagnostics related to the program configuration and compiler options.
5481 getCompilerOptionsDiagnostics(): Diagnostic[];
5482 /** @deprecated Use getEncodedSyntacticClassifications instead. */
5483 getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
5484 getSyntacticClassifications(fileName: string, span: TextSpan, format: SemanticClassificationFormat): ClassifiedSpan[] | ClassifiedSpan2020[];
5485 /** @deprecated Use getEncodedSemanticClassifications instead. */
5486 getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
5487 getSemanticClassifications(fileName: string, span: TextSpan, format: SemanticClassificationFormat): ClassifiedSpan[] | ClassifiedSpan2020[];
5488 /** Encoded as triples of [start, length, ClassificationType]. */
5489 getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
5491 * Gets semantic highlights information for a particular file. Has two formats, an older
5492 * version used by VS and a format used by VS Code.
5494 * @param fileName The path to the file
5495 * @param position A text span to return results within
5496 * @param format Which format to use, defaults to "original"
5497 * @returns a number array encoded as triples of [start, length, ClassificationType, ...].
5499 getEncodedSemanticClassifications(fileName: string, span: TextSpan, format?: SemanticClassificationFormat): Classifications;
5501 * Gets completion entries at a particular position in a file.
5503 * @param fileName The path to the file
5504 * @param position A zero-based index of the character where you want the entries
5505 * @param options An object describing how the request was triggered and what kinds
5506 * of code actions can be returned with the completions.
5508 getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): WithMetadata<CompletionInfo> | undefined;
5510 * Gets the extended details for a completion entry retrieved from `getCompletionsAtPosition`.
5512 * @param fileName The path to the file
5513 * @param position A zero based index of the character where you want the entries
5514 * @param entryName The name from an existing completion which came from `getCompletionsAtPosition`
5515 * @param formatOptions How should code samples in the completions be formatted, can be undefined for backwards compatibility
5516 * @param source Source code for the current file, can be undefined for backwards compatibility
5517 * @param preferences User settings, can be undefined for backwards compatibility
5519 getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined, preferences: UserPreferences | undefined): CompletionEntryDetails | undefined;
5520 getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol | undefined;
5522 * Gets semantic information about the identifier at a particular position in a
5523 * file. Quick info is what you typically see when you hover in an editor.
5525 * @param fileName The path to the file
5526 * @param position A zero-based index of the character where you want the quick info
5528 getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined;
5529 getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan | undefined;
5530 getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan | undefined;
5531 getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
5532 getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
5533 findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): readonly RenameLocation[] | undefined;
5534 getSmartSelectionRange(fileName: string, position: number): SelectionRange;
5535 getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
5536 getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
5537 getTypeDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
5538 getImplementationAtPosition(fileName: string, position: number): readonly ImplementationLocation[] | undefined;
5539 getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] | undefined;
5540 findReferences(fileName: string, position: number): ReferencedSymbol[] | undefined;
5541 getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[] | undefined;
5542 getFileReferences(fileName: string): ReferenceEntry[];
5544 getOccurrencesAtPosition(fileName: string, position: number): readonly ReferenceEntry[] | undefined;
5545 getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[];
5546 getNavigationBarItems(fileName: string): NavigationBarItem[];
5547 getNavigationTree(fileName: string): NavigationTree;
5548 prepareCallHierarchy(fileName: string, position: number): CallHierarchyItem | CallHierarchyItem[] | undefined;
5549 provideCallHierarchyIncomingCalls(fileName: string, position: number): CallHierarchyIncomingCall[];
5550 provideCallHierarchyOutgoingCalls(fileName: string, position: number): CallHierarchyOutgoingCall[];
5551 getOutliningSpans(fileName: string): OutliningSpan[];
5552 getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
5553 getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
5554 getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number;
5555 getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
5556 getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
5557 getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
5558 getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
5559 isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
5561 * This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
5562 * Editors should call this after `>` is typed.
5564 getJsxClosingTagAtPosition(fileName: string, position: number): JsxClosingTagInfo | undefined;
5565 getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan | undefined;
5566 toLineColumnOffset?(fileName: string, position: number): LineAndCharacter;
5567 getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: readonly number[], formatOptions: FormatCodeSettings, preferences: UserPreferences): readonly CodeFixAction[];
5568 getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions;
5569 applyCodeActionCommand(action: CodeActionCommand, formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult>;
5570 applyCodeActionCommand(action: CodeActionCommand[], formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult[]>;
5571 applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[], formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
5572 /** @deprecated `fileName` will be ignored */
5573 applyCodeActionCommand(fileName: string, action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
5574 /** @deprecated `fileName` will be ignored */
5575 applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
5576 /** @deprecated `fileName` will be ignored */
5577 applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
5578 getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): ApplicableRefactorInfo[];
5579 getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
5580 organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
5581 getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
5582 getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput;
5583 getProgram(): Program | undefined;
5584 toggleLineComment(fileName: string, textRange: TextRange): TextChange[];
5585 toggleMultilineComment(fileName: string, textRange: TextRange): TextChange[];
5586 commentSelection(fileName: string, textRange: TextRange): TextChange[];
5587 uncommentSelection(fileName: string, textRange: TextRange): TextChange[];
5590 interface JsxClosingTagInfo {
5591 readonly newText: string;
5593 interface CombinedCodeFixScope {
5597 type OrganizeImportsScope = CombinedCodeFixScope;
5598 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";
5599 interface GetCompletionsAtPositionOptions extends UserPreferences {
5601 * If the editor is asking for completions because a certain character was typed
5602 * (as opposed to when the user explicitly requested them) this should be set.
5604 triggerCharacter?: CompletionsTriggerCharacter;
5605 /** @deprecated Use includeCompletionsForModuleExports */
5606 includeExternalModuleExports?: boolean;
5607 /** @deprecated Use includeCompletionsWithInsertText */
5608 includeInsertTextCompletions?: boolean;
5610 type SignatureHelpTriggerCharacter = "," | "(" | "<";
5611 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
5612 interface SignatureHelpItemsOptions {
5613 triggerReason?: SignatureHelpTriggerReason;
5615 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
5617 * Signals that the user manually requested signature help.
5618 * The language service will unconditionally attempt to provide a result.
5620 interface SignatureHelpInvokedReason {
5622 triggerCharacter?: undefined;
5625 * Signals that the signature help request came from a user typing a character.
5626 * Depending on the character and the syntactic context, the request may or may not be served a result.
5628 interface SignatureHelpCharacterTypedReason {
5629 kind: "characterTyped";
5631 * Character that was responsible for triggering signature help.
5633 triggerCharacter: SignatureHelpTriggerCharacter;
5636 * Signals that this signature help request came from typing a character or moving the cursor.
5637 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
5638 * The language service will unconditionally attempt to provide a result.
5639 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
5641 interface SignatureHelpRetriggeredReason {
5644 * Character that was responsible for triggering signature help.
5646 triggerCharacter?: SignatureHelpRetriggerCharacter;
5648 interface ApplyCodeActionCommandResult {
5649 successMessage: string;
5651 interface Classifications {
5653 endOfLineState: EndOfLineState;
5655 interface ClassifiedSpan {
5657 classificationType: ClassificationTypeNames;
5659 interface ClassifiedSpan2020 {
5661 classificationType: number;
5664 * Navigation bar interface designed for visual studio's dual-column layout.
5665 * This does not form a proper tree.
5666 * The navbar is returned as a list of top-level items, each of which has a list of child items.
5667 * Child items always have an empty array for their `childItems`.
5669 interface NavigationBarItem {
5671 kind: ScriptElementKind;
5672 kindModifiers: string;
5674 childItems: NavigationBarItem[];
5680 * Node in a tree of nested declarations in a file.
5681 * The top node is always a script or module node.
5683 interface NavigationTree {
5684 /** Name of the declaration, or a short description, e.g. "<class>". */
5686 kind: ScriptElementKind;
5687 /** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
5688 kindModifiers: string;
5690 * Spans of the nodes that generated this declaration.
5691 * There will be more than one if this is the result of merging.
5694 nameSpan: TextSpan | undefined;
5695 /** Present if non-empty */
5696 childItems?: NavigationTree[];
5698 interface CallHierarchyItem {
5700 kind: ScriptElementKind;
5701 kindModifiers?: string;
5704 selectionSpan: TextSpan;
5705 containerName?: string;
5707 interface CallHierarchyIncomingCall {
5708 from: CallHierarchyItem;
5709 fromSpans: TextSpan[];
5711 interface CallHierarchyOutgoingCall {
5712 to: CallHierarchyItem;
5713 fromSpans: TextSpan[];
5715 interface TodoCommentDescriptor {
5719 interface TodoComment {
5720 descriptor: TodoCommentDescriptor;
5724 interface TextChange {
5728 interface FileTextChanges {
5730 textChanges: readonly TextChange[];
5731 isNewFile?: boolean;
5733 interface CodeAction {
5734 /** Description of the code action to display in the UI of the editor */
5735 description: string;
5736 /** Text changes to apply to each file as part of the code action */
5737 changes: FileTextChanges[];
5739 * If the user accepts the code fix, the editor should send the action back in a `applyAction` request.
5740 * This allows the language service to have side effects (e.g. installing dependencies) upon a code fix.
5742 commands?: CodeActionCommand[];
5744 interface CodeFixAction extends CodeAction {
5745 /** Short name to identify the fix, for use by telemetry. */
5748 * If present, one may call 'getCombinedCodeFix' with this fixId.
5749 * This may be omitted to indicate that the code fix can't be applied in a group.
5752 fixAllDescription?: string;
5754 interface CombinedCodeActions {
5755 changes: readonly FileTextChanges[];
5756 commands?: readonly CodeActionCommand[];
5758 type CodeActionCommand = InstallPackageAction;
5759 interface InstallPackageAction {
5762 * A set of one or more available refactoring actions, grouped under a parent refactoring.
5764 interface ApplicableRefactorInfo {
5766 * The programmatic name of the refactoring
5770 * A description of this refactoring category to show to the user.
5771 * If the refactoring gets inlined (see below), this text will not be visible.
5773 description: string;
5775 * Inlineable refactorings can have their actions hoisted out to the top level
5776 * of a context menu. Non-inlineanable refactorings should always be shown inside
5777 * their parent grouping.
5779 * If not specified, this value is assumed to be 'true'
5781 inlineable?: boolean;
5782 actions: RefactorActionInfo[];
5785 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
5786 * offer several actions, each corresponding to a surround class or closure to extract into.
5788 interface RefactorActionInfo {
5790 * The programmatic name of the refactoring action
5794 * A description of this refactoring action to show to the user.
5795 * If the parent refactoring is inlined away, this will be the only text shown,
5796 * so this description should make sense by itself if the parent is inlineable=true
5798 description: string;
5800 * A message to show to the user if the refactoring cannot be applied in
5801 * the current context.
5803 notApplicableReason?: string;
5805 * The hierarchical dotted name of the refactor action.
5810 * A set of edits to make in response to a refactor action, plus an optional
5811 * location where renaming should be invoked from
5813 interface RefactorEditInfo {
5814 edits: FileTextChanges[];
5815 renameFilename?: string;
5816 renameLocation?: number;
5817 commands?: CodeActionCommand[];
5819 type RefactorTriggerReason = "implicit" | "invoked";
5820 interface TextInsertion {
5822 /** The position in newText the caret should point to after the insertion. */
5823 caretOffset: number;
5825 interface DocumentSpan {
5829 * If the span represents a location that was remapped (e.g. via a .d.ts.map file),
5830 * then the original filename and span will be specified here
5832 originalTextSpan?: TextSpan;
5833 originalFileName?: string;
5835 * If DocumentSpan.textSpan is the span for name of the declaration,
5836 * then this is the span for relevant declaration
5838 contextSpan?: TextSpan;
5839 originalContextSpan?: TextSpan;
5841 interface RenameLocation extends DocumentSpan {
5842 readonly prefixText?: string;
5843 readonly suffixText?: string;
5845 interface ReferenceEntry extends DocumentSpan {
5846 isWriteAccess: boolean;
5847 isDefinition: boolean;
5850 interface ImplementationLocation extends DocumentSpan {
5851 kind: ScriptElementKind;
5852 displayParts: SymbolDisplayPart[];
5854 enum HighlightSpanKind {
5856 definition = "definition",
5857 reference = "reference",
5858 writtenReference = "writtenReference"
5860 interface HighlightSpan {
5864 contextSpan?: TextSpan;
5865 kind: HighlightSpanKind;
5867 interface NavigateToItem {
5869 kind: ScriptElementKind;
5870 kindModifiers: string;
5871 matchKind: "exact" | "prefix" | "substring" | "camelCase";
5872 isCaseSensitive: boolean;
5875 containerName: string;
5876 containerKind: ScriptElementKind;
5883 enum SemicolonPreference {
5888 interface EditorOptions {
5889 BaseIndentSize?: number;
5892 NewLineCharacter: string;
5893 ConvertTabsToSpaces: boolean;
5894 IndentStyle: IndentStyle;
5896 interface EditorSettings {
5897 baseIndentSize?: number;
5898 indentSize?: number;
5900 newLineCharacter?: string;
5901 convertTabsToSpaces?: boolean;
5902 indentStyle?: IndentStyle;
5903 trimTrailingWhitespace?: boolean;
5905 interface FormatCodeOptions extends EditorOptions {
5906 InsertSpaceAfterCommaDelimiter: boolean;
5907 InsertSpaceAfterSemicolonInForStatements: boolean;
5908 InsertSpaceBeforeAndAfterBinaryOperators: boolean;
5909 InsertSpaceAfterConstructor?: boolean;
5910 InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
5911 InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
5912 InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
5913 InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
5914 InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
5915 InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
5916 InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
5917 InsertSpaceAfterTypeAssertion?: boolean;
5918 InsertSpaceBeforeFunctionParenthesis?: boolean;
5919 PlaceOpenBraceOnNewLineForFunctions: boolean;
5920 PlaceOpenBraceOnNewLineForControlBlocks: boolean;
5921 insertSpaceBeforeTypeAnnotation?: boolean;
5923 interface FormatCodeSettings extends EditorSettings {
5924 readonly insertSpaceAfterCommaDelimiter?: boolean;
5925 readonly insertSpaceAfterSemicolonInForStatements?: boolean;
5926 readonly insertSpaceBeforeAndAfterBinaryOperators?: boolean;
5927 readonly insertSpaceAfterConstructor?: boolean;
5928 readonly insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
5929 readonly insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
5930 readonly insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
5931 readonly insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
5932 readonly insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
5933 readonly insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean;
5934 readonly insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
5935 readonly insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
5936 readonly insertSpaceAfterTypeAssertion?: boolean;
5937 readonly insertSpaceBeforeFunctionParenthesis?: boolean;
5938 readonly placeOpenBraceOnNewLineForFunctions?: boolean;
5939 readonly placeOpenBraceOnNewLineForControlBlocks?: boolean;
5940 readonly insertSpaceBeforeTypeAnnotation?: boolean;
5941 readonly indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
5942 readonly semicolons?: SemicolonPreference;
5944 function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings;
5945 interface DefinitionInfo extends DocumentSpan {
5946 kind: ScriptElementKind;
5948 containerKind: ScriptElementKind;
5949 containerName: string;
5951 interface DefinitionInfoAndBoundSpan {
5952 definitions?: readonly DefinitionInfo[];
5955 interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
5956 displayParts: SymbolDisplayPart[];
5958 interface ReferencedSymbol {
5959 definition: ReferencedSymbolDefinitionInfo;
5960 references: ReferenceEntry[];
5962 enum SymbolDisplayPartKind {
5981 typeParameterName = 18,
5982 enumMemberName = 19,
5984 regularExpressionLiteral = 21
5986 interface SymbolDisplayPart {
5990 interface JSDocTagInfo {
5994 interface QuickInfo {
5995 kind: ScriptElementKind;
5996 kindModifiers: string;
5998 displayParts?: SymbolDisplayPart[];
5999 documentation?: SymbolDisplayPart[];
6000 tags?: JSDocTagInfo[];
6002 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
6003 interface RenameInfoSuccess {
6006 * File or directory to rename.
6007 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
6009 fileToRename?: string;
6010 displayName: string;
6011 fullDisplayName: string;
6012 kind: ScriptElementKind;
6013 kindModifiers: string;
6014 triggerSpan: TextSpan;
6016 interface RenameInfoFailure {
6018 localizedErrorMessage: string;
6020 interface RenameInfoOptions {
6021 readonly allowRenameOfImportPath?: boolean;
6023 interface DocCommentTemplateOptions {
6024 readonly generateReturnInDocTemplate?: boolean;
6026 interface SignatureHelpParameter {
6028 documentation: SymbolDisplayPart[];
6029 displayParts: SymbolDisplayPart[];
6030 isOptional: boolean;
6033 interface SelectionRange {
6035 parent?: SelectionRange;
6038 * Represents a single signature to show in signature help.
6039 * The id is used for subsequent calls into the language service to ask questions about the
6040 * signature help item in the context of any documents that have been updated. i.e. after
6041 * an edit has happened, while signature help is still active, the host can ask important
6042 * questions like 'what parameter is the user currently contained within?'.
6044 interface SignatureHelpItem {
6045 isVariadic: boolean;
6046 prefixDisplayParts: SymbolDisplayPart[];
6047 suffixDisplayParts: SymbolDisplayPart[];
6048 separatorDisplayParts: SymbolDisplayPart[];
6049 parameters: SignatureHelpParameter[];
6050 documentation: SymbolDisplayPart[];
6051 tags: JSDocTagInfo[];
6054 * Represents a set of signature help items, and the preferred item that should be selected.
6056 interface SignatureHelpItems {
6057 items: SignatureHelpItem[];
6058 applicableSpan: TextSpan;
6059 selectedItemIndex: number;
6060 argumentIndex: number;
6061 argumentCount: number;
6063 interface CompletionInfo {
6064 /** Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */
6065 isGlobalCompletion: boolean;
6066 isMemberCompletion: boolean;
6068 * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use
6069 * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span
6070 * must be used to commit that completion entry.
6072 optionalReplacementSpan?: TextSpan;
6074 * true when the current location also allows for a new identifier
6076 isNewIdentifierLocation: boolean;
6077 entries: CompletionEntry[];
6079 interface CompletionEntry {
6081 kind: ScriptElementKind;
6082 kindModifiers?: string;
6084 insertText?: string;
6086 * An optional span that indicates the text to be replaced by this completion item.
6087 * If present, this span should be used instead of the default one.
6088 * It will be set if the required span differs from the one generated by the default replacement behavior.
6090 replacementSpan?: TextSpan;
6093 isRecommended?: true;
6094 isFromUncheckedFile?: true;
6095 isPackageJsonImport?: true;
6097 interface CompletionEntryDetails {
6099 kind: ScriptElementKind;
6100 kindModifiers: string;
6101 displayParts: SymbolDisplayPart[];
6102 documentation?: SymbolDisplayPart[];
6103 tags?: JSDocTagInfo[];
6104 codeActions?: CodeAction[];
6105 source?: SymbolDisplayPart[];
6107 interface OutliningSpan {
6108 /** The span of the document to actually collapse. */
6110 /** The span of the document to display when the user hovers over the collapsed span. */
6112 /** The text to display in the editor for the collapsed region. */
6115 * Whether or not this region should be automatically collapsed when
6116 * the 'Collapse to Definitions' command is invoked.
6118 autoCollapse: boolean;
6120 * Classification of the contents of the span
6122 kind: OutliningSpanKind;
6124 enum OutliningSpanKind {
6125 /** Single or multi-line comments */
6126 Comment = "comment",
6127 /** Sections marked by '// #region' and '// #endregion' comments */
6129 /** Declarations and expressions */
6131 /** Contiguous blocks of import declarations */
6134 enum OutputFileType {
6139 enum EndOfLineState {
6141 InMultiLineCommentTrivia = 1,
6142 InSingleQuoteStringLiteral = 2,
6143 InDoubleQuoteStringLiteral = 3,
6144 InTemplateHeadOrNoSubstitutionTemplate = 4,
6145 InTemplateMiddleOrTail = 5,
6146 InTemplateSubstitutionPosition = 6
6160 interface ClassificationResult {
6161 finalLexState: EndOfLineState;
6162 entries: ClassificationInfo[];
6164 interface ClassificationInfo {
6166 classification: TokenClass;
6168 interface Classifier {
6170 * Gives lexical classifications of tokens on a line without any syntactic context.
6171 * For instance, a token consisting of the text 'string' can be either an identifier
6172 * named 'string' or the keyword 'string', however, because this classifier is not aware,
6173 * it relies on certain heuristics to give acceptable results. For classifications where
6174 * speed trumps accuracy, this function is preferable; however, for true accuracy, the
6175 * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
6176 * lexical, syntactic, and semantic classifiers may issue the best user experience.
6178 * @param text The text of a line to classify.
6179 * @param lexState The state of the lexical classifier at the end of the previous line.
6180 * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
6181 * If there is no syntactic classifier (syntacticClassifierAbsent=true),
6182 * certain heuristics may be used in its place; however, if there is a
6183 * syntactic classifier (syntacticClassifierAbsent=false), certain
6184 * classifications which may be incorrectly categorized will be given
6185 * back as Identifiers in order to allow the syntactic classifier to
6186 * subsume the classification.
6187 * @deprecated Use getLexicalClassifications instead.
6189 getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
6190 getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
6192 enum ScriptElementKind {
6194 warning = "warning",
6195 /** predefined type (void) or keyword (class) */
6196 keyword = "keyword",
6197 /** top level script node */
6198 scriptElement = "script",
6199 /** module foo {} */
6200 moduleElement = "module",
6202 classElement = "class",
6203 /** var x = class X {} */
6204 localClassElement = "local class",
6205 /** interface Y {} */
6206 interfaceElement = "interface",
6208 typeElement = "type",
6210 enumElement = "enum",
6211 enumMemberElement = "enum member",
6213 * Inside module and script only
6216 variableElement = "var",
6217 /** Inside function */
6218 localVariableElement = "local var",
6220 * Inside module and script only
6223 functionElement = "function",
6224 /** Inside function */
6225 localFunctionElement = "local function",
6226 /** class X { [public|private]* foo() {} } */
6227 memberFunctionElement = "method",
6228 /** class X { [public|private]* [get|set] foo:number; } */
6229 memberGetAccessorElement = "getter",
6230 memberSetAccessorElement = "setter",
6232 * class X { [public|private]* foo:number; }
6233 * interface Y { foo:number; }
6235 memberVariableElement = "property",
6236 /** class X { constructor() { } } */
6237 constructorImplementationElement = "constructor",
6238 /** interface Y { ():number; } */
6239 callSignatureElement = "call",
6240 /** interface Y { []:number; } */
6241 indexSignatureElement = "index",
6242 /** interface Y { new():Y; } */
6243 constructSignatureElement = "construct",
6244 /** function foo(*Y*: string) */
6245 parameterElement = "parameter",
6246 typeParameterElement = "type parameter",
6247 primitiveType = "primitive type",
6250 constElement = "const",
6252 directory = "directory",
6253 externalModuleName = "external module name",
6255 * <JsxTagName attribute1 attribute2={0} />
6257 jsxAttribute = "JSX attribute",
6258 /** String literal */
6261 enum ScriptElementKindModifier {
6263 publicMemberModifier = "public",
6264 privateMemberModifier = "private",
6265 protectedMemberModifier = "protected",
6266 exportedModifier = "export",
6267 ambientModifier = "declare",
6268 staticModifier = "static",
6269 abstractModifier = "abstract",
6270 optionalModifier = "optional",
6271 deprecatedModifier = "deprecated",
6272 dtsModifier = ".d.ts",
6274 tsxModifier = ".tsx",
6276 jsxModifier = ".jsx",
6277 jsonModifier = ".json"
6279 enum ClassificationTypeNames {
6280 comment = "comment",
6281 identifier = "identifier",
6282 keyword = "keyword",
6283 numericLiteral = "number",
6284 bigintLiteral = "bigint",
6285 operator = "operator",
6286 stringLiteral = "string",
6287 whiteSpace = "whitespace",
6289 punctuation = "punctuation",
6290 className = "class name",
6291 enumName = "enum name",
6292 interfaceName = "interface name",
6293 moduleName = "module name",
6294 typeParameterName = "type parameter name",
6295 typeAliasName = "type alias name",
6296 parameterName = "parameter name",
6297 docCommentTagName = "doc comment tag name",
6298 jsxOpenTagName = "jsx open tag name",
6299 jsxCloseTagName = "jsx close tag name",
6300 jsxSelfClosingTagName = "jsx self closing tag name",
6301 jsxAttribute = "jsx attribute",
6302 jsxText = "jsx text",
6303 jsxAttributeStringLiteralValue = "jsx attribute string literal value"
6305 enum ClassificationType {
6312 regularExpressionLiteral = 7,
6320 typeParameterName = 15,
6323 docCommentTagName = 18,
6324 jsxOpenTagName = 19,
6325 jsxCloseTagName = 20,
6326 jsxSelfClosingTagName = 21,
6329 jsxAttributeStringLiteralValue = 24,
6333 declare namespace ts {
6334 /** The classifier is used for syntactic highlighting in editors via the TSServer */
6335 function createClassifier(): Classifier;
6337 declare namespace ts {
6338 interface DocumentHighlights {
6340 highlightSpans: HighlightSpan[];
6343 declare namespace ts {
6345 * The document registry represents a store of SourceFile objects that can be shared between
6346 * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)
6347 * of files in the context.
6348 * SourceFile objects account for most of the memory usage by the language service. Sharing
6349 * the same DocumentRegistry instance between different instances of LanguageService allow
6350 * for more efficient memory utilization since all projects will share at least the library
6353 * A more advanced use of the document registry is to serialize sourceFile objects to disk
6354 * and re-hydrate them when needed.
6356 * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
6357 * to all subsequent createLanguageService calls.
6359 interface DocumentRegistry {
6361 * Request a stored SourceFile with a given fileName and compilationSettings.
6362 * The first call to acquire will call createLanguageServiceSourceFile to generate
6363 * the SourceFile if was not found in the registry.
6365 * @param fileName The name of the file requested
6366 * @param compilationSettings Some compilation settings like target affects the
6367 * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
6368 * multiple copies of the same file for different compilation settings.
6369 * @param scriptSnapshot Text of the file. Only used if the file was not found
6370 * in the registry and a new one was created.
6371 * @param version Current version of the file. Only used if the file was not found
6372 * in the registry and a new one was created.
6374 acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6375 acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6377 * Request an updated version of an already existing SourceFile with a given fileName
6378 * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
6379 * to get an updated SourceFile.
6381 * @param fileName The name of the file requested
6382 * @param compilationSettings Some compilation settings like target affects the
6383 * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
6384 * multiple copies of the same file for different compilation settings.
6385 * @param scriptSnapshot Text of the file.
6386 * @param version Current version of the file.
6388 updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6389 updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6390 getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey;
6392 * Informs the DocumentRegistry that a file is not needed any longer.
6394 * Note: It is not allowed to call release on a SourceFile that was not acquired from
6395 * this registry originally.
6397 * @param fileName The name of the file to be released
6398 * @param compilationSettings The compilation settings used to acquire the file
6400 releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
6401 releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void;
6402 reportStats(): string;
6404 type DocumentRegistryBucketKey = string & {
6407 function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
6409 declare namespace ts {
6410 function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
6412 declare namespace ts {
6413 interface TranspileOptions {
6414 compilerOptions?: CompilerOptions;
6416 reportDiagnostics?: boolean;
6417 moduleName?: string;
6418 renamedDependencies?: MapLike<string>;
6419 transformers?: CustomTransformers;
6421 interface TranspileOutput {
6423 diagnostics?: Diagnostic[];
6424 sourceMapText?: string;
6426 function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
6427 function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
6429 declare namespace ts {
6430 /** The version of the language service API */
6431 const servicesVersion = "0.8";
6432 function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
6433 function displayPartsToString(displayParts: SymbolDisplayPart[] | undefined): string;
6434 function getDefaultCompilerOptions(): CompilerOptions;
6435 function getSupportedCodeFixes(): string[];
6436 function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
6437 function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange | undefined, aggressiveChecks?: boolean): SourceFile;
6438 function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnlyOrLanguageServiceMode?: boolean | LanguageServiceMode): LanguageService;
6440 * Get the path of the default library files (lib.d.ts) as distributed with the typescript
6442 * The functionality is not supported if the ts module is consumed outside of a node module.
6444 function getDefaultLibFilePath(options: CompilerOptions): string;
6446 declare namespace ts {
6448 * Transform one or more nodes using the supplied transformers.
6449 * @param source A single `Node` or an array of `Node` objects.
6450 * @param transformers An array of `TransformerFactory` callbacks used to process the transformation.
6451 * @param compilerOptions Optional compiler options.
6453 function transform<T extends Node>(source: T | T[], transformers: TransformerFactory<T>[], compilerOptions?: CompilerOptions): TransformationResult<T>;
6455 declare namespace ts.server {
6456 interface CompressedData {
6458 compressionKind: string;
6461 type RequireResult = {
6471 interface ServerHost extends System {
6472 watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
6473 watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
6474 setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
6475 clearTimeout(timeoutId: any): void;
6476 setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
6477 clearImmediate(timeoutId: any): void;
6479 trace?(s: string): void;
6480 require?(initialPath: string, moduleName: string): RequireResult;
6483 declare namespace ts.server {
6490 const emptyArray: SortedReadonlyArray<never>;
6493 hasLevel(level: LogLevel): boolean;
6494 loggingEnabled(): boolean;
6495 perftrc(s: string): void;
6496 info(s: string): void;
6499 msg(s: string, type?: Msg): void;
6500 getLogFileName(): string | undefined;
6508 /** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */
6511 function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
6513 function ThrowNoProject(): never;
6514 function ThrowProjectLanguageServiceDisabled(): never;
6515 function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never;
6517 type NormalizedPath = string & {
6518 __normalizedPathTag: any;
6520 function toNormalizedPath(fileName: string): NormalizedPath;
6521 function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path;
6522 function asNormalizedPath(fileName: string): NormalizedPath;
6523 interface NormalizedPathMap<T> {
6524 get(path: NormalizedPath): T | undefined;
6525 set(path: NormalizedPath, value: T): void;
6526 contains(path: NormalizedPath): boolean;
6527 remove(path: NormalizedPath): void;
6529 function createNormalizedPathMap<T>(): NormalizedPathMap<T>;
6530 function isInferredProjectName(name: string): boolean;
6531 function makeInferredProjectName(counter: number): string;
6532 function createSortedArray<T>(): SortedArray<T>;
6535 * Declaration module describing the TypeScript Server protocol
6537 declare namespace ts.server.protocol {
6539 JsxClosingTag = "jsxClosingTag",
6541 BraceCompletion = "braceCompletion",
6542 GetSpanOfEnclosingComment = "getSpanOfEnclosingComment",
6545 /** @deprecated Prefer CompletionInfo -- see comment on CompletionsResponse */
6546 Completions = "completions",
6547 CompletionInfo = "completionInfo",
6548 CompletionDetails = "completionEntryDetails",
6549 CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
6550 CompileOnSaveEmitFile = "compileOnSaveEmitFile",
6551 Configure = "configure",
6552 Definition = "definition",
6553 DefinitionAndBoundSpan = "definitionAndBoundSpan",
6554 Implementation = "implementation",
6556 FileReferences = "fileReferences",
6558 Formatonkey = "formatonkey",
6560 GeterrForProject = "geterrForProject",
6561 SemanticDiagnosticsSync = "semanticDiagnosticsSync",
6562 SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
6563 SuggestionDiagnosticsSync = "suggestionDiagnosticsSync",
6566 NavTree = "navtree",
6567 NavTreeFull = "navtree-full",
6569 Occurrences = "occurrences",
6570 DocumentHighlights = "documentHighlights",
6572 Quickinfo = "quickinfo",
6573 References = "references",
6577 SignatureHelp = "signatureHelp",
6579 TypeDefinition = "typeDefinition",
6580 ProjectInfo = "projectInfo",
6581 ReloadProjects = "reloadProjects",
6582 Unknown = "unknown",
6583 OpenExternalProject = "openExternalProject",
6584 OpenExternalProjects = "openExternalProjects",
6585 CloseExternalProject = "closeExternalProject",
6586 UpdateOpen = "updateOpen",
6587 GetOutliningSpans = "getOutliningSpans",
6588 TodoComments = "todoComments",
6589 Indentation = "indentation",
6590 DocCommentTemplate = "docCommentTemplate",
6591 CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
6592 GetCodeFixes = "getCodeFixes",
6593 GetCombinedCodeFix = "getCombinedCodeFix",
6594 ApplyCodeActionCommand = "applyCodeActionCommand",
6595 GetSupportedCodeFixes = "getSupportedCodeFixes",
6596 GetApplicableRefactors = "getApplicableRefactors",
6597 GetEditsForRefactor = "getEditsForRefactor",
6598 OrganizeImports = "organizeImports",
6599 GetEditsForFileRename = "getEditsForFileRename",
6600 ConfigurePlugin = "configurePlugin",
6601 SelectionRange = "selectionRange",
6602 ToggleLineComment = "toggleLineComment",
6603 ToggleMultilineComment = "toggleMultilineComment",
6604 CommentSelection = "commentSelection",
6605 UncommentSelection = "uncommentSelection",
6606 PrepareCallHierarchy = "prepareCallHierarchy",
6607 ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
6608 ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls"
6611 * A TypeScript Server message
6615 * Sequence number of the message
6619 * One of "request", "response", or "event"
6621 type: "request" | "response" | "event";
6624 * Client-initiated request message
6626 interface Request extends Message {
6629 * The command to execute
6633 * Object containing arguments for the command
6638 * Request to reload the project structure for all the opened files
6640 interface ReloadProjectsRequest extends Message {
6641 command: CommandTypes.ReloadProjects;
6644 * Server-initiated event message
6646 interface Event extends Message {
6653 * Event-specific information
6658 * Response by server to client request message.
6660 interface Response extends Message {
6663 * Sequence number of the request message.
6665 request_seq: number;
6667 * Outcome of the request.
6671 * The command requested.
6675 * If success === false, this should always be provided.
6676 * Otherwise, may (or may not) contain a success message.
6680 * Contains message body if success === true.
6684 * Contains extra information that plugin can include to be passed on
6688 * Exposes information about the performance of this request-response pair.
6690 performanceData?: PerformanceData;
6692 interface PerformanceData {
6694 * Time spent updating the program graph, in milliseconds.
6696 updateGraphDurationMs?: number;
6698 * The time spent creating or updating the auto-import program, in milliseconds.
6700 createAutoImportProviderProgramDurationMs?: number;
6703 * Arguments for FileRequest messages.
6705 interface FileRequestArgs {
6707 * The file for the request (absolute pathname required).
6710 projectFileName?: string;
6712 interface StatusRequest extends Request {
6713 command: CommandTypes.Status;
6715 interface StatusResponseBody {
6717 * The TypeScript version (`ts.version`).
6722 * Response to StatusRequest
6724 interface StatusResponse extends Response {
6725 body: StatusResponseBody;
6728 * Requests a JS Doc comment template for a given position
6730 interface DocCommentTemplateRequest extends FileLocationRequest {
6731 command: CommandTypes.DocCommentTemplate;
6734 * Response to DocCommentTemplateRequest
6736 interface DocCommandTemplateResponse extends Response {
6737 body?: TextInsertion;
6740 * A request to get TODO comments from the file
6742 interface TodoCommentRequest extends FileRequest {
6743 command: CommandTypes.TodoComments;
6744 arguments: TodoCommentRequestArgs;
6747 * Arguments for TodoCommentRequest request.
6749 interface TodoCommentRequestArgs extends FileRequestArgs {
6751 * Array of target TodoCommentDescriptors that describes TODO comments to be found
6753 descriptors: TodoCommentDescriptor[];
6756 * Response for TodoCommentRequest request.
6758 interface TodoCommentsResponse extends Response {
6759 body?: TodoComment[];
6762 * A request to determine if the caret is inside a comment.
6764 interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
6765 command: CommandTypes.GetSpanOfEnclosingComment;
6766 arguments: SpanOfEnclosingCommentRequestArgs;
6768 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
6770 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
6772 onlyMultiLine: boolean;
6775 * Request to obtain outlining spans in file.
6777 interface OutliningSpansRequest extends FileRequest {
6778 command: CommandTypes.GetOutliningSpans;
6780 interface OutliningSpan {
6781 /** The span of the document to actually collapse. */
6783 /** The span of the document to display when the user hovers over the collapsed span. */
6785 /** The text to display in the editor for the collapsed region. */
6788 * Whether or not this region should be automatically collapsed when
6789 * the 'Collapse to Definitions' command is invoked.
6791 autoCollapse: boolean;
6793 * Classification of the contents of the span
6795 kind: OutliningSpanKind;
6798 * Response to OutliningSpansRequest request.
6800 interface OutliningSpansResponse extends Response {
6801 body?: OutliningSpan[];
6804 * A request to get indentation for a location in file
6806 interface IndentationRequest extends FileLocationRequest {
6807 command: CommandTypes.Indentation;
6808 arguments: IndentationRequestArgs;
6811 * Response for IndentationRequest request.
6813 interface IndentationResponse extends Response {
6814 body?: IndentationResult;
6817 * Indentation result representing where indentation should be placed
6819 interface IndentationResult {
6821 * The base position in the document that the indent should be relative to
6825 * The number of columns the indent should be at relative to the position's column.
6827 indentation: number;
6830 * Arguments for IndentationRequest request.
6832 interface IndentationRequestArgs extends FileLocationRequestArgs {
6834 * An optional set of settings to be used when computing indentation.
6835 * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings.
6837 options?: EditorSettings;
6840 * Arguments for ProjectInfoRequest request.
6842 interface ProjectInfoRequestArgs extends FileRequestArgs {
6844 * Indicate if the file name list of the project is needed
6846 needFileNameList: boolean;
6849 * A request to get the project information of the current file.
6851 interface ProjectInfoRequest extends Request {
6852 command: CommandTypes.ProjectInfo;
6853 arguments: ProjectInfoRequestArgs;
6856 * A request to retrieve compiler options diagnostics for a project
6858 interface CompilerOptionsDiagnosticsRequest extends Request {
6859 arguments: CompilerOptionsDiagnosticsRequestArgs;
6862 * Arguments for CompilerOptionsDiagnosticsRequest request.
6864 interface CompilerOptionsDiagnosticsRequestArgs {
6866 * Name of the project to retrieve compiler options diagnostics.
6868 projectFileName: string;
6871 * Response message body for "projectInfo" request
6873 interface ProjectInfo {
6875 * For configured project, this is the normalized path of the 'tsconfig.json' file
6876 * For inferred project, this is undefined
6878 configFileName: string;
6880 * The list of normalized file name in the project, including 'lib.d.ts'
6882 fileNames?: string[];
6884 * Indicates if the project has a active language service instance
6886 languageServiceDisabled?: boolean;
6889 * Represents diagnostic info that includes location of diagnostic in two forms
6890 * - start position and length of the error span
6891 * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span.
6893 interface DiagnosticWithLinePosition {
6897 startLocation: Location;
6898 endLocation: Location;
6901 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
6902 reportsUnnecessary?: {};
6903 reportsDeprecated?: {};
6904 relatedInformation?: DiagnosticRelatedInformation[];
6907 * Response message for "projectInfo" request
6909 interface ProjectInfoResponse extends Response {
6913 * Request whose sole parameter is a file name.
6915 interface FileRequest extends Request {
6916 arguments: FileRequestArgs;
6919 * Instances of this interface specify a location in a source file:
6920 * (file, line, character offset), where line and character offset are 1-based.
6922 interface FileLocationRequestArgs extends FileRequestArgs {
6924 * The line number for the request (1-based).
6928 * The character offset (on the line) for the request (1-based).
6932 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
6934 * Request refactorings at a given position or selection area.
6936 interface GetApplicableRefactorsRequest extends Request {
6937 command: CommandTypes.GetApplicableRefactors;
6938 arguments: GetApplicableRefactorsRequestArgs;
6940 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & {
6941 triggerReason?: RefactorTriggerReason;
6944 type RefactorTriggerReason = "implicit" | "invoked";
6946 * Response is a list of available refactorings.
6947 * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
6949 interface GetApplicableRefactorsResponse extends Response {
6950 body?: ApplicableRefactorInfo[];
6953 * A set of one or more available refactoring actions, grouped under a parent refactoring.
6955 interface ApplicableRefactorInfo {
6957 * The programmatic name of the refactoring
6961 * A description of this refactoring category to show to the user.
6962 * If the refactoring gets inlined (see below), this text will not be visible.
6964 description: string;
6966 * Inlineable refactorings can have their actions hoisted out to the top level
6967 * of a context menu. Non-inlineanable refactorings should always be shown inside
6968 * their parent grouping.
6970 * If not specified, this value is assumed to be 'true'
6972 inlineable?: boolean;
6973 actions: RefactorActionInfo[];
6976 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
6977 * offer several actions, each corresponding to a surround class or closure to extract into.
6979 interface RefactorActionInfo {
6981 * The programmatic name of the refactoring action
6985 * A description of this refactoring action to show to the user.
6986 * If the parent refactoring is inlined away, this will be the only text shown,
6987 * so this description should make sense by itself if the parent is inlineable=true
6989 description: string;
6991 * A message to show to the user if the refactoring cannot be applied in
6992 * the current context.
6994 notApplicableReason?: string;
6996 * The hierarchical dotted name of the refactor action.
7000 interface GetEditsForRefactorRequest extends Request {
7001 command: CommandTypes.GetEditsForRefactor;
7002 arguments: GetEditsForRefactorRequestArgs;
7005 * Request the edits that a particular refactoring action produces.
7006 * Callers must specify the name of the refactor and the name of the action.
7008 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
7012 interface GetEditsForRefactorResponse extends Response {
7013 body?: RefactorEditInfo;
7015 interface RefactorEditInfo {
7016 edits: FileCodeEdits[];
7018 * An optional location where the editor should start a rename operation once
7019 * the refactoring edits have been applied
7021 renameLocation?: Location;
7022 renameFilename?: string;
7025 * Organize imports by:
7026 * 1) Removing unused imports
7027 * 2) Coalescing imports from the same module
7028 * 3) Sorting imports
7030 interface OrganizeImportsRequest extends Request {
7031 command: CommandTypes.OrganizeImports;
7032 arguments: OrganizeImportsRequestArgs;
7034 type OrganizeImportsScope = GetCombinedCodeFixScope;
7035 interface OrganizeImportsRequestArgs {
7036 scope: OrganizeImportsScope;
7038 interface OrganizeImportsResponse extends Response {
7039 body: readonly FileCodeEdits[];
7041 interface GetEditsForFileRenameRequest extends Request {
7042 command: CommandTypes.GetEditsForFileRename;
7043 arguments: GetEditsForFileRenameRequestArgs;
7045 /** Note: Paths may also be directories. */
7046 interface GetEditsForFileRenameRequestArgs {
7047 readonly oldFilePath: string;
7048 readonly newFilePath: string;
7050 interface GetEditsForFileRenameResponse extends Response {
7051 body: readonly FileCodeEdits[];
7054 * Request for the available codefixes at a specific position.
7056 interface CodeFixRequest extends Request {
7057 command: CommandTypes.GetCodeFixes;
7058 arguments: CodeFixRequestArgs;
7060 interface GetCombinedCodeFixRequest extends Request {
7061 command: CommandTypes.GetCombinedCodeFix;
7062 arguments: GetCombinedCodeFixRequestArgs;
7064 interface GetCombinedCodeFixResponse extends Response {
7065 body: CombinedCodeActions;
7067 interface ApplyCodeActionCommandRequest extends Request {
7068 command: CommandTypes.ApplyCodeActionCommand;
7069 arguments: ApplyCodeActionCommandRequestArgs;
7071 interface ApplyCodeActionCommandResponse extends Response {
7073 interface FileRangeRequestArgs extends FileRequestArgs {
7075 * The line number for the request (1-based).
7079 * The character offset (on the line) for the request (1-based).
7081 startOffset: number;
7083 * The line number for the request (1-based).
7087 * The character offset (on the line) for the request (1-based).
7092 * Instances of this interface specify errorcodes on a specific location in a sourcefile.
7094 interface CodeFixRequestArgs extends FileRangeRequestArgs {
7096 * Errorcodes we want to get the fixes for.
7098 errorCodes: readonly number[];
7100 interface GetCombinedCodeFixRequestArgs {
7101 scope: GetCombinedCodeFixScope;
7104 interface GetCombinedCodeFixScope {
7106 args: FileRequestArgs;
7108 interface ApplyCodeActionCommandRequestArgs {
7109 /** May also be an array of commands. */
7113 * Response for GetCodeFixes request.
7115 interface GetCodeFixesResponse extends Response {
7116 body?: CodeAction[];
7119 * A request whose arguments specify a file location (file, line, col).
7121 interface FileLocationRequest extends FileRequest {
7122 arguments: FileLocationRequestArgs;
7125 * A request to get codes of supported code fixes.
7127 interface GetSupportedCodeFixesRequest extends Request {
7128 command: CommandTypes.GetSupportedCodeFixes;
7131 * A response for GetSupportedCodeFixesRequest request.
7133 interface GetSupportedCodeFixesResponse extends Response {
7135 * List of error codes supported by the server.
7140 * A request to get encoded semantic classifications for a span in the file
7142 interface EncodedSemanticClassificationsRequest extends FileRequest {
7143 arguments: EncodedSemanticClassificationsRequestArgs;
7146 * Arguments for EncodedSemanticClassificationsRequest request.
7148 interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
7150 * Start position of the span.
7154 * Length of the span.
7158 * Optional parameter for the semantic highlighting response, if absent it
7159 * defaults to "original".
7161 format?: "original" | "2020";
7163 /** The response for a EncodedSemanticClassificationsRequest */
7164 interface EncodedSemanticClassificationsResponse extends Response {
7165 body?: EncodedSemanticClassificationsResponseBody;
7168 * Implementation response message. Gives series of text spans depending on the format ar.
7170 interface EncodedSemanticClassificationsResponseBody {
7171 endOfLineState: EndOfLineState;
7175 * Arguments in document highlight request; include: filesToSearch, file,
7178 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
7180 * List of files to search for document highlights.
7182 filesToSearch: string[];
7185 * Go to definition request; value of command field is
7186 * "definition". Return response giving the file locations that
7187 * define the symbol found in file at location line, col.
7189 interface DefinitionRequest extends FileLocationRequest {
7190 command: CommandTypes.Definition;
7192 interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
7193 readonly command: CommandTypes.DefinitionAndBoundSpan;
7195 interface DefinitionAndBoundSpanResponse extends Response {
7196 readonly body: DefinitionInfoAndBoundSpan;
7199 * Go to type request; value of command field is
7200 * "typeDefinition". Return response giving the file locations that
7201 * define the type for the symbol found in file at location line, col.
7203 interface TypeDefinitionRequest extends FileLocationRequest {
7204 command: CommandTypes.TypeDefinition;
7207 * Go to implementation request; value of command field is
7208 * "implementation". Return response giving the file locations that
7209 * implement the symbol found in file at location line, col.
7211 interface ImplementationRequest extends FileLocationRequest {
7212 command: CommandTypes.Implementation;
7215 * Location in source code expressed as (one-based) line and (one-based) column offset.
7217 interface Location {
7222 * Object found in response messages defining a span of text in source code.
7224 interface TextSpan {
7226 * First character of the definition.
7230 * One character past last character of the definition.
7235 * Object found in response messages defining a span of text in a specific source file.
7237 interface FileSpan extends TextSpan {
7239 * File containing text span.
7243 interface TextSpanWithContext extends TextSpan {
7244 contextStart?: Location;
7245 contextEnd?: Location;
7247 interface FileSpanWithContext extends FileSpan, TextSpanWithContext {
7249 interface DefinitionInfoAndBoundSpan {
7250 definitions: readonly FileSpanWithContext[];
7254 * Definition response message. Gives text range for definition.
7256 interface DefinitionResponse extends Response {
7257 body?: FileSpanWithContext[];
7259 interface DefinitionInfoAndBoundSpanResponse extends Response {
7260 body?: DefinitionInfoAndBoundSpan;
7262 /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
7263 type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
7265 * Definition response message. Gives text range for definition.
7267 interface TypeDefinitionResponse extends Response {
7268 body?: FileSpanWithContext[];
7271 * Implementation response message. Gives text range for implementations.
7273 interface ImplementationResponse extends Response {
7274 body?: FileSpanWithContext[];
7277 * Request to get brace completion for a location in the file.
7279 interface BraceCompletionRequest extends FileLocationRequest {
7280 command: CommandTypes.BraceCompletion;
7281 arguments: BraceCompletionRequestArgs;
7284 * Argument for BraceCompletionRequest request.
7286 interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
7288 * Kind of opening brace
7290 openingBrace: string;
7292 interface JsxClosingTagRequest extends FileLocationRequest {
7293 readonly command: CommandTypes.JsxClosingTag;
7294 readonly arguments: JsxClosingTagRequestArgs;
7296 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {
7298 interface JsxClosingTagResponse extends Response {
7299 readonly body: TextInsertion;
7303 * Get occurrences request; value of command field is
7304 * "occurrences". Return response giving spans that are relevant
7305 * in the file at a given line and column.
7307 interface OccurrencesRequest extends FileLocationRequest {
7308 command: CommandTypes.Occurrences;
7311 interface OccurrencesResponseItem extends FileSpanWithContext {
7313 * True if the occurrence is a write location, false otherwise.
7315 isWriteAccess: boolean;
7317 * True if the occurrence is in a string, undefined otherwise;
7322 interface OccurrencesResponse extends Response {
7323 body?: OccurrencesResponseItem[];
7326 * Get document highlights request; value of command field is
7327 * "documentHighlights". Return response giving spans that are relevant
7328 * in the file at a given line and column.
7330 interface DocumentHighlightsRequest extends FileLocationRequest {
7331 command: CommandTypes.DocumentHighlights;
7332 arguments: DocumentHighlightsRequestArgs;
7335 * Span augmented with extra information that denotes the kind of the highlighting to be used for span.
7337 interface HighlightSpan extends TextSpanWithContext {
7338 kind: HighlightSpanKind;
7341 * Represents a set of highligh spans for a give name
7343 interface DocumentHighlightsItem {
7345 * File containing highlight spans.
7349 * Spans to highlight in file.
7351 highlightSpans: HighlightSpan[];
7354 * Response for a DocumentHighlightsRequest request.
7356 interface DocumentHighlightsResponse extends Response {
7357 body?: DocumentHighlightsItem[];
7360 * Find references request; value of command field is
7361 * "references". Return response giving the file locations that
7362 * reference the symbol found in file at location line, col.
7364 interface ReferencesRequest extends FileLocationRequest {
7365 command: CommandTypes.References;
7367 interface ReferencesResponseItem extends FileSpanWithContext {
7368 /** Text of line containing the reference. Including this
7369 * with the response avoids latency of editor loading files
7370 * to show text of reference line (the server already has
7371 * loaded the referencing files).
7375 * True if reference is a write location, false otherwise.
7377 isWriteAccess: boolean;
7379 * True if reference is a definition, false otherwise.
7381 isDefinition: boolean;
7384 * The body of a "references" response message.
7386 interface ReferencesResponseBody {
7388 * The file locations referencing the symbol.
7390 refs: readonly ReferencesResponseItem[];
7392 * The name of the symbol.
7396 * The start character offset of the symbol (on the line provided by the references request).
7398 symbolStartOffset: number;
7400 * The full display name of the symbol.
7402 symbolDisplayString: string;
7405 * Response to "references" request.
7407 interface ReferencesResponse extends Response {
7408 body?: ReferencesResponseBody;
7410 interface FileReferencesRequest extends FileRequest {
7411 command: CommandTypes.FileReferences;
7413 interface FileReferencesResponseBody {
7415 * The file locations referencing the symbol.
7417 refs: readonly ReferencesResponseItem[];
7419 * The name of the symbol.
7423 interface FileReferencesResponse extends Response {
7424 body?: FileReferencesResponseBody;
7427 * Argument for RenameRequest request.
7429 interface RenameRequestArgs extends FileLocationRequestArgs {
7431 * Should text at specified location be found/changed in comments?
7433 findInComments?: boolean;
7435 * Should text at specified location be found/changed in strings?
7437 findInStrings?: boolean;
7440 * Rename request; value of command field is "rename". Return
7441 * response giving the file locations that reference the symbol
7442 * found in file at location line, col. Also return full display
7443 * name of the symbol so that client can print it unambiguously.
7445 interface RenameRequest extends FileLocationRequest {
7446 command: CommandTypes.Rename;
7447 arguments: RenameRequestArgs;
7450 * Information about the item to be renamed.
7452 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
7453 interface RenameInfoSuccess {
7455 * True if item can be renamed.
7459 * File or directory to rename.
7460 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
7462 fileToRename?: string;
7464 * Display name of the item to be renamed.
7466 displayName: string;
7468 * Full display name of item to be renamed.
7470 fullDisplayName: string;
7472 * The items's kind (such as 'className' or 'parameterName' or plain 'text').
7474 kind: ScriptElementKind;
7476 * Optional modifiers for the kind (such as 'public').
7478 kindModifiers: string;
7479 /** Span of text to rename. */
7480 triggerSpan: TextSpan;
7482 interface RenameInfoFailure {
7485 * Error message if item can not be renamed.
7487 localizedErrorMessage: string;
7490 * A group of text spans, all in 'file'.
7492 interface SpanGroup {
7493 /** The file to which the spans apply */
7495 /** The text spans in this group */
7496 locs: RenameTextSpan[];
7498 interface RenameTextSpan extends TextSpanWithContext {
7499 readonly prefixText?: string;
7500 readonly suffixText?: string;
7502 interface RenameResponseBody {
7504 * Information about the item to be renamed.
7508 * An array of span groups (one per file) that refer to the item to be renamed.
7510 locs: readonly SpanGroup[];
7513 * Rename response message.
7515 interface RenameResponse extends Response {
7516 body?: RenameResponseBody;
7519 * Represents a file in external project.
7520 * External project is project whose set of files, compilation options and open\close state
7521 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio).
7522 * External project will exist even if all files in it are closed and should be closed explicitly.
7523 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will
7524 * create configured project for every config file but will maintain a link that these projects were created
7525 * as a result of opening external project so they should be removed once external project is closed.
7527 interface ExternalFile {
7533 * Script kind of the file
7535 scriptKind?: ScriptKindName | ts.ScriptKind;
7537 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
7539 hasMixedContent?: boolean;
7541 * Content of the file
7546 * Represent an external project
7548 interface ExternalProject {
7552 projectFileName: string;
7554 * List of root files in project
7556 rootFiles: ExternalFile[];
7558 * Compiler options for the project
7560 options: ExternalProjectCompilerOptions;
7562 * @deprecated typingOptions. Use typeAcquisition instead
7564 typingOptions?: TypeAcquisition;
7566 * Explicitly specified type acquisition for the project
7568 typeAcquisition?: TypeAcquisition;
7570 interface CompileOnSaveMixin {
7572 * If compile on save is enabled for the project
7574 compileOnSave?: boolean;
7577 * For external projects, some of the project settings are sent together with
7578 * compiler settings.
7580 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions;
7581 interface FileWithProjectReferenceRedirectInfo {
7587 * True if the file is primarily included in a referenced project
7589 isSourceOfProjectReferenceRedirect: boolean;
7592 * Represents a set of changes that happen in project
7594 interface ProjectChanges {
7596 * List of added files
7598 added: string[] | FileWithProjectReferenceRedirectInfo[];
7600 * List of removed files
7602 removed: string[] | FileWithProjectReferenceRedirectInfo[];
7604 * List of updated files
7606 updated: string[] | FileWithProjectReferenceRedirectInfo[];
7608 * List of files that have had their project reference redirect status updated
7609 * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true
7611 updatedRedirects?: FileWithProjectReferenceRedirectInfo[];
7614 * Information found in a configure request.
7616 interface ConfigureRequestArguments {
7618 * Information about the host, for example 'Emacs 24.4' or
7619 * 'Sublime Text version 3075'
7623 * If present, tab settings apply only to this file.
7627 * The format options to use during formatting and other code editing features.
7629 formatOptions?: FormatCodeSettings;
7630 preferences?: UserPreferences;
7632 * The host's additional supported .js file extensions
7634 extraFileExtensions?: FileExtensionInfo[];
7635 watchOptions?: WatchOptions;
7637 enum WatchFileKind {
7638 FixedPollingInterval = "FixedPollingInterval",
7639 PriorityPollingInterval = "PriorityPollingInterval",
7640 DynamicPriorityPolling = "DynamicPriorityPolling",
7641 UseFsEvents = "UseFsEvents",
7642 UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory"
7644 enum WatchDirectoryKind {
7645 UseFsEvents = "UseFsEvents",
7646 FixedPollingInterval = "FixedPollingInterval",
7647 DynamicPriorityPolling = "DynamicPriorityPolling"
7649 enum PollingWatchKind {
7650 FixedInterval = "FixedInterval",
7651 PriorityInterval = "PriorityInterval",
7652 DynamicPriority = "DynamicPriority"
7654 interface WatchOptions {
7655 watchFile?: WatchFileKind | ts.WatchFileKind;
7656 watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind;
7657 fallbackPolling?: PollingWatchKind | ts.PollingWatchKind;
7658 synchronousWatchDirectory?: boolean;
7659 excludeDirectories?: string[];
7660 excludeFiles?: string[];
7661 [option: string]: CompilerOptionsValue | undefined;
7664 * Configure request; value of command field is "configure". Specifies
7665 * host information, such as host type, tab size, and indent size.
7667 interface ConfigureRequest extends Request {
7668 command: CommandTypes.Configure;
7669 arguments: ConfigureRequestArguments;
7672 * Response to "configure" request. This is just an acknowledgement, so
7673 * no body field is required.
7675 interface ConfigureResponse extends Response {
7677 interface ConfigurePluginRequestArguments {
7681 interface ConfigurePluginRequest extends Request {
7682 command: CommandTypes.ConfigurePlugin;
7683 arguments: ConfigurePluginRequestArguments;
7685 interface ConfigurePluginResponse extends Response {
7687 interface SelectionRangeRequest extends FileRequest {
7688 command: CommandTypes.SelectionRange;
7689 arguments: SelectionRangeRequestArgs;
7691 interface SelectionRangeRequestArgs extends FileRequestArgs {
7692 locations: Location[];
7694 interface SelectionRangeResponse extends Response {
7695 body?: SelectionRange[];
7697 interface SelectionRange {
7699 parent?: SelectionRange;
7701 interface ToggleLineCommentRequest extends FileRequest {
7702 command: CommandTypes.ToggleLineComment;
7703 arguments: FileRangeRequestArgs;
7705 interface ToggleMultilineCommentRequest extends FileRequest {
7706 command: CommandTypes.ToggleMultilineComment;
7707 arguments: FileRangeRequestArgs;
7709 interface CommentSelectionRequest extends FileRequest {
7710 command: CommandTypes.CommentSelection;
7711 arguments: FileRangeRequestArgs;
7713 interface UncommentSelectionRequest extends FileRequest {
7714 command: CommandTypes.UncommentSelection;
7715 arguments: FileRangeRequestArgs;
7718 * Information found in an "open" request.
7720 interface OpenRequestArgs extends FileRequestArgs {
7722 * Used when a version of the file content is known to be more up to date than the one on disk.
7723 * Then the known content will be used upon opening instead of the disk copy
7725 fileContent?: string;
7727 * Used to specify the script kind of the file explicitly. It could be one of the following:
7728 * "TS", "JS", "TSX", "JSX"
7730 scriptKindName?: ScriptKindName;
7732 * Used to limit the searching for project config file. If given the searching will stop at this
7733 * root path; otherwise it will go all the way up to the dist root path.
7735 projectRootPath?: string;
7737 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
7739 * Open request; value of command field is "open". Notify the
7740 * server that the client has file open. The server will not
7741 * monitor the filesystem for changes in this file and will assume
7742 * that the client is updating the server (using the change and/or
7743 * reload messages) when the file changes. Server does not currently
7744 * send a response to an open request.
7746 interface OpenRequest extends Request {
7747 command: CommandTypes.Open;
7748 arguments: OpenRequestArgs;
7751 * Request to open or update external project
7753 interface OpenExternalProjectRequest extends Request {
7754 command: CommandTypes.OpenExternalProject;
7755 arguments: OpenExternalProjectArgs;
7758 * Arguments to OpenExternalProjectRequest request
7760 type OpenExternalProjectArgs = ExternalProject;
7762 * Request to open multiple external projects
7764 interface OpenExternalProjectsRequest extends Request {
7765 command: CommandTypes.OpenExternalProjects;
7766 arguments: OpenExternalProjectsArgs;
7769 * Arguments to OpenExternalProjectsRequest
7771 interface OpenExternalProjectsArgs {
7773 * List of external projects to open or update
7775 projects: ExternalProject[];
7778 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so
7779 * no body field is required.
7781 interface OpenExternalProjectResponse extends Response {
7784 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so
7785 * no body field is required.
7787 interface OpenExternalProjectsResponse extends Response {
7790 * Request to close external project.
7792 interface CloseExternalProjectRequest extends Request {
7793 command: CommandTypes.CloseExternalProject;
7794 arguments: CloseExternalProjectRequestArgs;
7797 * Arguments to CloseExternalProjectRequest request
7799 interface CloseExternalProjectRequestArgs {
7801 * Name of the project to close
7803 projectFileName: string;
7806 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so
7807 * no body field is required.
7809 interface CloseExternalProjectResponse extends Response {
7812 * Request to synchronize list of open files with the client
7814 interface UpdateOpenRequest extends Request {
7815 command: CommandTypes.UpdateOpen;
7816 arguments: UpdateOpenRequestArgs;
7819 * Arguments to UpdateOpenRequest
7821 interface UpdateOpenRequestArgs {
7823 * List of newly open files
7825 openFiles?: OpenRequestArgs[];
7827 * List of open files files that were changes
7829 changedFiles?: FileCodeEdits[];
7831 * List of files that were closed
7833 closedFiles?: string[];
7836 * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects.
7838 type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition;
7840 * Request to set compiler options for inferred projects.
7841 * External projects are opened / closed explicitly.
7842 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders.
7843 * This configuration file will be used to obtain a list of files and configuration settings for the project.
7844 * Inferred projects are created when user opens a loose file that is not the part of external project
7845 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false,
7846 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true.
7848 interface SetCompilerOptionsForInferredProjectsRequest extends Request {
7849 command: CommandTypes.CompilerOptionsForInferredProjects;
7850 arguments: SetCompilerOptionsForInferredProjectsArgs;
7853 * Argument for SetCompilerOptionsForInferredProjectsRequest request.
7855 interface SetCompilerOptionsForInferredProjectsArgs {
7857 * Compiler options to be used with inferred projects.
7859 options: InferredProjectCompilerOptions;
7861 * Specifies the project root path used to scope compiler options.
7862 * It is an error to provide this property if the server has not been started with
7863 * `useInferredProjectPerProjectRoot` enabled.
7865 projectRootPath?: string;
7868 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so
7869 * no body field is required.
7871 interface SetCompilerOptionsForInferredProjectsResponse extends Response {
7874 * Exit request; value of command field is "exit". Ask the server process
7877 interface ExitRequest extends Request {
7878 command: CommandTypes.Exit;
7881 * Close request; value of command field is "close". Notify the
7882 * server that the client has closed a previously open file. If
7883 * file is still referenced by open files, the server will resume
7884 * monitoring the filesystem for changes to file. Server does not
7885 * currently send a response to a close request.
7887 interface CloseRequest extends FileRequest {
7888 command: CommandTypes.Close;
7891 * Request to obtain the list of files that should be regenerated if target file is recompiled.
7892 * NOTE: this us query-only operation and does not generate any output on disk.
7894 interface CompileOnSaveAffectedFileListRequest extends FileRequest {
7895 command: CommandTypes.CompileOnSaveAffectedFileList;
7898 * Contains a list of files that should be regenerated in a project
7900 interface CompileOnSaveAffectedFileListSingleProject {
7904 projectFileName: string;
7906 * List of files names that should be recompiled
7908 fileNames: string[];
7910 * true if project uses outFile or out compiler option
7912 projectUsesOutFile: boolean;
7915 * Response for CompileOnSaveAffectedFileListRequest request;
7917 interface CompileOnSaveAffectedFileListResponse extends Response {
7918 body: CompileOnSaveAffectedFileListSingleProject[];
7921 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk.
7923 interface CompileOnSaveEmitFileRequest extends FileRequest {
7924 command: CommandTypes.CompileOnSaveEmitFile;
7925 arguments: CompileOnSaveEmitFileRequestArgs;
7928 * Arguments for CompileOnSaveEmitFileRequest
7930 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
7932 * if true - then file should be recompiled even if it does not have any changes.
7935 includeLinePosition?: boolean;
7936 /** if true - return response as object with emitSkipped and diagnostics */
7937 richResponse?: boolean;
7939 interface CompileOnSaveEmitFileResponse extends Response {
7940 body: boolean | EmitResult;
7942 interface EmitResult {
7943 emitSkipped: boolean;
7944 diagnostics: Diagnostic[] | DiagnosticWithLinePosition[];
7947 * Quickinfo request; value of command field is
7948 * "quickinfo". Return response giving a quick type and
7949 * documentation string for the symbol found in file at location
7952 interface QuickInfoRequest extends FileLocationRequest {
7953 command: CommandTypes.Quickinfo;
7956 * Body of QuickInfoResponse.
7958 interface QuickInfoResponseBody {
7960 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
7962 kind: ScriptElementKind;
7964 * Optional modifiers for the kind (such as 'public').
7966 kindModifiers: string;
7968 * Starting file location of symbol.
7972 * One past last character of symbol.
7976 * Type and kind of symbol.
7978 displayString: string;
7980 * Documentation associated with symbol.
7982 documentation: string;
7984 * JSDoc tags associated with symbol.
7986 tags: JSDocTagInfo[];
7989 * Quickinfo response message.
7991 interface QuickInfoResponse extends Response {
7992 body?: QuickInfoResponseBody;
7995 * Arguments for format messages.
7997 interface FormatRequestArgs extends FileLocationRequestArgs {
7999 * Last line of range for which to format text in file.
8003 * Character offset on last line of range for which to format text in file.
8007 * Format options to be used.
8009 options?: FormatCodeSettings;
8012 * Format request; value of command field is "format". Return
8013 * response giving zero or more edit instructions. The edit
8014 * instructions will be sorted in file order. Applying the edit
8015 * instructions in reverse to file will result in correctly
8018 interface FormatRequest extends FileLocationRequest {
8019 command: CommandTypes.Format;
8020 arguments: FormatRequestArgs;
8023 * Object found in response messages defining an editing
8024 * instruction for a span of text in source code. The effect of
8025 * this instruction is to replace the text starting at start and
8026 * ending one character before end with newText. For an insertion,
8027 * the text span is empty. For a deletion, newText is empty.
8029 interface CodeEdit {
8031 * First character of the text span to edit.
8035 * One character past last character of the text span to edit.
8039 * Replace the span defined above with this string (may be
8040 * the empty string).
8044 interface FileCodeEdits {
8046 textChanges: CodeEdit[];
8048 interface CodeFixResponse extends Response {
8049 /** The code actions that are available */
8050 body?: CodeFixAction[];
8052 interface CodeAction {
8053 /** Description of the code action to display in the UI of the editor */
8054 description: string;
8055 /** Text changes to apply to each file as part of the code action */
8056 changes: FileCodeEdits[];
8057 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
8060 interface CombinedCodeActions {
8061 changes: readonly FileCodeEdits[];
8062 commands?: readonly {}[];
8064 interface CodeFixAction extends CodeAction {
8065 /** Short name to identify the fix, for use by telemetry. */
8068 * If present, one may call 'getCombinedCodeFix' with this fixId.
8069 * This may be omitted to indicate that the code fix can't be applied in a group.
8072 /** Should be present if and only if 'fixId' is. */
8073 fixAllDescription?: string;
8076 * Format and format on key response message.
8078 interface FormatResponse extends Response {
8082 * Arguments for format on key messages.
8084 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
8086 * Key pressed (';', '\n', or '}').
8089 options?: FormatCodeSettings;
8092 * Format on key request; value of command field is
8093 * "formatonkey". Given file location and key typed (as string),
8094 * return response giving zero or more edit instructions. The
8095 * edit instructions will be sorted in file order. Applying the
8096 * edit instructions in reverse to file will result in correctly
8099 interface FormatOnKeyRequest extends FileLocationRequest {
8100 command: CommandTypes.Formatonkey;
8101 arguments: FormatOnKeyRequestArgs;
8103 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";
8105 * Arguments for completions messages.
8107 interface CompletionsRequestArgs extends FileLocationRequestArgs {
8109 * Optional prefix to apply to possible completions.
8113 * Character that was responsible for triggering completion.
8114 * Should be `undefined` if a user manually requested completion.
8116 triggerCharacter?: CompletionsTriggerCharacter;
8118 * @deprecated Use UserPreferences.includeCompletionsForModuleExports
8120 includeExternalModuleExports?: boolean;
8122 * @deprecated Use UserPreferences.includeCompletionsWithInsertText
8124 includeInsertTextCompletions?: boolean;
8127 * Completions request; value of command field is "completions".
8128 * Given a file location (file, line, col) and a prefix (which may
8129 * be the empty string), return the possible completions that
8130 * begin with prefix.
8132 interface CompletionsRequest extends FileLocationRequest {
8133 command: CommandTypes.Completions | CommandTypes.CompletionInfo;
8134 arguments: CompletionsRequestArgs;
8137 * Arguments for completion details request.
8139 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
8141 * Names of one or more entries for which to obtain details.
8143 entryNames: (string | CompletionEntryIdentifier)[];
8145 interface CompletionEntryIdentifier {
8150 * Completion entry details request; value of command field is
8151 * "completionEntryDetails". Given a file location (file, line,
8152 * col) and an array of completion entry names return more
8153 * detailed information for each completion entry.
8155 interface CompletionDetailsRequest extends FileLocationRequest {
8156 command: CommandTypes.CompletionDetails;
8157 arguments: CompletionDetailsRequestArgs;
8160 * Part of a symbol description.
8162 interface SymbolDisplayPart {
8164 * Text of an item describing the symbol.
8168 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
8173 * An item found in a completion response.
8175 interface CompletionEntry {
8177 * The symbol's name.
8181 * The symbol's kind (such as 'className' or 'parameterName').
8183 kind: ScriptElementKind;
8185 * Optional modifiers for the kind (such as 'public').
8187 kindModifiers?: string;
8189 * A string that is used for comparing completion items so that they can be ordered. This
8190 * is often the same as the name but may be different in certain circumstances.
8194 * Text to insert instead of `name`.
8195 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`,
8196 * coupled with `replacementSpan` to replace a dotted access with a bracket access.
8198 insertText?: string;
8200 * An optional span that indicates the text to be replaced by this completion item.
8201 * If present, this span should be used instead of the default one.
8202 * It will be set if the required span differs from the one generated by the default replacement behavior.
8204 replacementSpan?: TextSpan;
8206 * Indicates whether commiting this completion entry will require additional code actions to be
8207 * made to avoid errors. The CompletionEntryDetails will have these actions.
8211 * Identifier (not necessarily human-readable) identifying where this completion came from.
8215 * If true, this completion should be highlighted as recommended. There will only be one of these.
8216 * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class.
8217 * Then either that enum/class or a namespace containing it will be the recommended symbol.
8219 isRecommended?: true;
8221 * If true, this completion was generated from traversing the name table of an unchecked JS file,
8222 * and therefore may not be accurate.
8224 isFromUncheckedFile?: true;
8226 * If true, this completion was for an auto-import of a module not yet in the program, but listed
8227 * in the project package.json.
8229 isPackageJsonImport?: true;
8232 * Additional completion entry details, available on demand
8234 interface CompletionEntryDetails {
8236 * The symbol's name.
8240 * The symbol's kind (such as 'className' or 'parameterName').
8242 kind: ScriptElementKind;
8244 * Optional modifiers for the kind (such as 'public').
8246 kindModifiers: string;
8248 * Display parts of the symbol (similar to quick info).
8250 displayParts: SymbolDisplayPart[];
8252 * Documentation strings for the symbol.
8254 documentation?: SymbolDisplayPart[];
8256 * JSDoc tags for the symbol.
8258 tags?: JSDocTagInfo[];
8260 * The associated code actions for this entry
8262 codeActions?: CodeAction[];
8264 * Human-readable description of the `source` from the CompletionEntry.
8266 source?: SymbolDisplayPart[];
8268 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
8269 interface CompletionsResponse extends Response {
8270 body?: CompletionEntry[];
8272 interface CompletionInfoResponse extends Response {
8273 body?: CompletionInfo;
8275 interface CompletionInfo {
8276 readonly isGlobalCompletion: boolean;
8277 readonly isMemberCompletion: boolean;
8278 readonly isNewIdentifierLocation: boolean;
8280 * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use
8281 * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span
8282 * must be used to commit that completion entry.
8284 readonly optionalReplacementSpan?: TextSpan;
8285 readonly entries: readonly CompletionEntry[];
8287 interface CompletionDetailsResponse extends Response {
8288 body?: CompletionEntryDetails[];
8291 * Signature help information for a single parameter
8293 interface SignatureHelpParameter {
8295 * The parameter's name
8299 * Documentation of the parameter.
8301 documentation: SymbolDisplayPart[];
8303 * Display parts of the parameter.
8305 displayParts: SymbolDisplayPart[];
8307 * Whether the parameter is optional or not.
8309 isOptional: boolean;
8312 * Represents a single signature to show in signature help.
8314 interface SignatureHelpItem {
8316 * Whether the signature accepts a variable number of arguments.
8318 isVariadic: boolean;
8320 * The prefix display parts.
8322 prefixDisplayParts: SymbolDisplayPart[];
8324 * The suffix display parts.
8326 suffixDisplayParts: SymbolDisplayPart[];
8328 * The separator display parts.
8330 separatorDisplayParts: SymbolDisplayPart[];
8332 * The signature helps items for the parameters.
8334 parameters: SignatureHelpParameter[];
8336 * The signature's documentation
8338 documentation: SymbolDisplayPart[];
8340 * The signature's JSDoc tags
8342 tags: JSDocTagInfo[];
8345 * Signature help items found in the response of a signature help request.
8347 interface SignatureHelpItems {
8349 * The signature help items.
8351 items: SignatureHelpItem[];
8353 * The span for which signature help should appear on a signature
8355 applicableSpan: TextSpan;
8357 * The item selected in the set of available help items.
8359 selectedItemIndex: number;
8361 * The argument selected in the set of parameters.
8363 argumentIndex: number;
8365 * The argument count
8367 argumentCount: number;
8369 type SignatureHelpTriggerCharacter = "," | "(" | "<";
8370 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
8372 * Arguments of a signature help request.
8374 interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
8376 * Reason why signature help was invoked.
8377 * See each individual possible
8379 triggerReason?: SignatureHelpTriggerReason;
8381 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
8383 * Signals that the user manually requested signature help.
8384 * The language service will unconditionally attempt to provide a result.
8386 interface SignatureHelpInvokedReason {
8388 triggerCharacter?: undefined;
8391 * Signals that the signature help request came from a user typing a character.
8392 * Depending on the character and the syntactic context, the request may or may not be served a result.
8394 interface SignatureHelpCharacterTypedReason {
8395 kind: "characterTyped";
8397 * Character that was responsible for triggering signature help.
8399 triggerCharacter: SignatureHelpTriggerCharacter;
8402 * Signals that this signature help request came from typing a character or moving the cursor.
8403 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
8404 * The language service will unconditionally attempt to provide a result.
8405 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
8407 interface SignatureHelpRetriggeredReason {
8410 * Character that was responsible for triggering signature help.
8412 triggerCharacter?: SignatureHelpRetriggerCharacter;
8415 * Signature help request; value of command field is "signatureHelp".
8416 * Given a file location (file, line, col), return the signature
8419 interface SignatureHelpRequest extends FileLocationRequest {
8420 command: CommandTypes.SignatureHelp;
8421 arguments: SignatureHelpRequestArgs;
8424 * Response object for a SignatureHelpRequest.
8426 interface SignatureHelpResponse extends Response {
8427 body?: SignatureHelpItems;
8430 * Synchronous request for semantic diagnostics of one file.
8432 interface SemanticDiagnosticsSyncRequest extends FileRequest {
8433 command: CommandTypes.SemanticDiagnosticsSync;
8434 arguments: SemanticDiagnosticsSyncRequestArgs;
8436 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
8437 includeLinePosition?: boolean;
8440 * Response object for synchronous sematic diagnostics request.
8442 interface SemanticDiagnosticsSyncResponse extends Response {
8443 body?: Diagnostic[] | DiagnosticWithLinePosition[];
8445 interface SuggestionDiagnosticsSyncRequest extends FileRequest {
8446 command: CommandTypes.SuggestionDiagnosticsSync;
8447 arguments: SuggestionDiagnosticsSyncRequestArgs;
8449 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
8450 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
8452 * Synchronous request for syntactic diagnostics of one file.
8454 interface SyntacticDiagnosticsSyncRequest extends FileRequest {
8455 command: CommandTypes.SyntacticDiagnosticsSync;
8456 arguments: SyntacticDiagnosticsSyncRequestArgs;
8458 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
8459 includeLinePosition?: boolean;
8462 * Response object for synchronous syntactic diagnostics request.
8464 interface SyntacticDiagnosticsSyncResponse extends Response {
8465 body?: Diagnostic[] | DiagnosticWithLinePosition[];
8468 * Arguments for GeterrForProject request.
8470 interface GeterrForProjectRequestArgs {
8472 * the file requesting project error list
8476 * Delay in milliseconds to wait before starting to compute
8477 * errors for the files in the file list
8482 * GeterrForProjectRequest request; value of command field is
8483 * "geterrForProject". It works similarly with 'Geterr', only
8484 * it request for every file in this project.
8486 interface GeterrForProjectRequest extends Request {
8487 command: CommandTypes.GeterrForProject;
8488 arguments: GeterrForProjectRequestArgs;
8491 * Arguments for geterr messages.
8493 interface GeterrRequestArgs {
8495 * List of file names for which to compute compiler errors.
8496 * The files will be checked in list order.
8500 * Delay in milliseconds to wait before starting to compute
8501 * errors for the files in the file list
8506 * Geterr request; value of command field is "geterr". Wait for
8507 * delay milliseconds and then, if during the wait no change or
8508 * reload messages have arrived for the first file in the files
8509 * list, get the syntactic errors for the file, field requests,
8510 * and then get the semantic errors for the file. Repeat with a
8511 * smaller delay for each subsequent file on the files list. Best
8512 * practice for an editor is to send a file list containing each
8513 * file that is currently visible, in most-recently-used order.
8515 interface GeterrRequest extends Request {
8516 command: CommandTypes.Geterr;
8517 arguments: GeterrRequestArgs;
8519 type RequestCompletedEventName = "requestCompleted";
8521 * Event that is sent when server have finished processing request with specified id.
8523 interface RequestCompletedEvent extends Event {
8524 event: RequestCompletedEventName;
8525 body: RequestCompletedEventBody;
8527 interface RequestCompletedEventBody {
8528 request_seq: number;
8531 * Item of diagnostic information found in a DiagnosticEvent message.
8533 interface Diagnostic {
8535 * Starting file location at which text applies.
8539 * The last file location at which the text applies.
8543 * Text of diagnostic message.
8547 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
8550 reportsUnnecessary?: {};
8551 reportsDeprecated?: {};
8553 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
8555 relatedInformation?: DiagnosticRelatedInformation[];
8557 * The error code of the diagnostic message.
8561 * The name of the plugin reporting the message.
8565 interface DiagnosticWithFileName extends Diagnostic {
8567 * Name of the file the diagnostic is in
8572 * Represents additional spans returned with a diagnostic which are relevant to it
8574 interface DiagnosticRelatedInformation {
8576 * The category of the related information message, e.g. "error", "warning", or "suggestion".
8580 * The code used ot identify the related information
8584 * Text of related or additional information.
8588 * Associated location
8592 interface DiagnosticEventBody {
8594 * The file for which diagnostic information is reported.
8598 * An array of diagnostic information items.
8600 diagnostics: Diagnostic[];
8602 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
8604 * Event message for DiagnosticEventKind event types.
8605 * These events provide syntactic and semantic errors for a file.
8607 interface DiagnosticEvent extends Event {
8608 body?: DiagnosticEventBody;
8609 event: DiagnosticEventKind;
8611 interface ConfigFileDiagnosticEventBody {
8613 * The file which trigged the searching and error-checking of the config file
8615 triggerFile: string;
8617 * The name of the found config file.
8621 * An arry of diagnostic information items for the found config file.
8623 diagnostics: DiagnosticWithFileName[];
8626 * Event message for "configFileDiag" event type.
8627 * This event provides errors for a found config file.
8629 interface ConfigFileDiagnosticEvent extends Event {
8630 body?: ConfigFileDiagnosticEventBody;
8631 event: "configFileDiag";
8633 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
8634 interface ProjectLanguageServiceStateEvent extends Event {
8635 event: ProjectLanguageServiceStateEventName;
8636 body?: ProjectLanguageServiceStateEventBody;
8638 interface ProjectLanguageServiceStateEventBody {
8640 * Project name that has changes in the state of language service.
8641 * For configured projects this will be the config file path.
8642 * For external projects this will be the name of the projects specified when project was open.
8643 * For inferred projects this event is not raised.
8645 projectName: string;
8647 * True if language service state switched from disabled to enabled
8648 * and false otherwise.
8650 languageServiceEnabled: boolean;
8652 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground";
8653 interface ProjectsUpdatedInBackgroundEvent extends Event {
8654 event: ProjectsUpdatedInBackgroundEventName;
8655 body: ProjectsUpdatedInBackgroundEventBody;
8657 interface ProjectsUpdatedInBackgroundEventBody {
8659 * Current set of open files
8661 openFiles: string[];
8663 type ProjectLoadingStartEventName = "projectLoadingStart";
8664 interface ProjectLoadingStartEvent extends Event {
8665 event: ProjectLoadingStartEventName;
8666 body: ProjectLoadingStartEventBody;
8668 interface ProjectLoadingStartEventBody {
8669 /** name of the project */
8670 projectName: string;
8671 /** reason for loading */
8674 type ProjectLoadingFinishEventName = "projectLoadingFinish";
8675 interface ProjectLoadingFinishEvent extends Event {
8676 event: ProjectLoadingFinishEventName;
8677 body: ProjectLoadingFinishEventBody;
8679 interface ProjectLoadingFinishEventBody {
8680 /** name of the project */
8681 projectName: string;
8683 type SurveyReadyEventName = "surveyReady";
8684 interface SurveyReadyEvent extends Event {
8685 event: SurveyReadyEventName;
8686 body: SurveyReadyEventBody;
8688 interface SurveyReadyEventBody {
8689 /** Name of the survey. This is an internal machine- and programmer-friendly name */
8692 type LargeFileReferencedEventName = "largeFileReferenced";
8693 interface LargeFileReferencedEvent extends Event {
8694 event: LargeFileReferencedEventName;
8695 body: LargeFileReferencedEventBody;
8697 interface LargeFileReferencedEventBody {
8699 * name of the large file being loaded
8707 * max file size allowed on the server
8709 maxFileSize: number;
8712 * Arguments for reload request.
8714 interface ReloadRequestArgs extends FileRequestArgs {
8716 * Name of temporary file from which to reload file
8717 * contents. May be same as file.
8722 * Reload request message; value of command field is "reload".
8723 * Reload contents of file with name given by the 'file' argument
8724 * from temporary file with name given by the 'tmpfile' argument.
8725 * The two names can be identical.
8727 interface ReloadRequest extends FileRequest {
8728 command: CommandTypes.Reload;
8729 arguments: ReloadRequestArgs;
8732 * Response to "reload" request. This is just an acknowledgement, so
8733 * no body field is required.
8735 interface ReloadResponse extends Response {
8738 * Arguments for saveto request.
8740 interface SavetoRequestArgs extends FileRequestArgs {
8742 * Name of temporary file into which to save server's view of
8748 * Saveto request message; value of command field is "saveto".
8749 * For debugging purposes, save to a temporaryfile (named by
8750 * argument 'tmpfile') the contents of file named by argument
8751 * 'file'. The server does not currently send a response to a
8754 interface SavetoRequest extends FileRequest {
8755 command: CommandTypes.Saveto;
8756 arguments: SavetoRequestArgs;
8759 * Arguments for navto request message.
8761 interface NavtoRequestArgs {
8763 * Search term to navigate to from current location; term can
8764 * be '.*' or an identifier prefix.
8766 searchValue: string;
8768 * Optional limit on the number of items to return.
8770 maxResultCount?: number;
8772 * The file for the request (absolute pathname required).
8776 * Optional flag to indicate we want results for just the current file
8777 * or the entire project.
8779 currentFileOnly?: boolean;
8780 projectFileName?: string;
8783 * Navto request message; value of command field is "navto".
8784 * Return list of objects giving file locations and symbols that
8785 * match the search term given in argument 'searchTerm'. The
8786 * context for the search is given by the named file.
8788 interface NavtoRequest extends Request {
8789 command: CommandTypes.Navto;
8790 arguments: NavtoRequestArgs;
8793 * An item found in a navto response.
8795 interface NavtoItem extends FileSpan {
8797 * The symbol's name.
8801 * The symbol's kind (such as 'className' or 'parameterName').
8803 kind: ScriptElementKind;
8805 * exact, substring, or prefix.
8809 * If this was a case sensitive or insensitive match.
8811 isCaseSensitive: boolean;
8813 * Optional modifiers for the kind (such as 'public').
8815 kindModifiers?: string;
8817 * Name of symbol's container symbol (if any); for example,
8818 * the class name if symbol is a class member.
8820 containerName?: string;
8822 * Kind of symbol's container symbol (if any).
8824 containerKind?: ScriptElementKind;
8827 * Navto response message. Body is an array of navto items. Each
8828 * item gives a symbol that matched the search term.
8830 interface NavtoResponse extends Response {
8834 * Arguments for change request message.
8836 interface ChangeRequestArgs extends FormatRequestArgs {
8838 * Optional string to insert at location (file, line, offset).
8840 insertString?: string;
8843 * Change request message; value of command field is "change".
8844 * Update the server's view of the file named by argument 'file'.
8845 * Server does not currently send a response to a change request.
8847 interface ChangeRequest extends FileLocationRequest {
8848 command: CommandTypes.Change;
8849 arguments: ChangeRequestArgs;
8852 * Response to "brace" request.
8854 interface BraceResponse extends Response {
8858 * Brace matching request; value of command field is "brace".
8859 * Return response giving the file locations of matching braces
8860 * found in file at location line, offset.
8862 interface BraceRequest extends FileLocationRequest {
8863 command: CommandTypes.Brace;
8866 * NavBar items request; value of command field is "navbar".
8867 * Return response giving the list of navigation bar entries
8868 * extracted from the requested file.
8870 interface NavBarRequest extends FileRequest {
8871 command: CommandTypes.NavBar;
8874 * NavTree request; value of command field is "navtree".
8875 * Return response giving the navigation tree of the requested file.
8877 interface NavTreeRequest extends FileRequest {
8878 command: CommandTypes.NavTree;
8880 interface NavigationBarItem {
8882 * The item's display text.
8886 * The symbol's kind (such as 'className' or 'parameterName').
8888 kind: ScriptElementKind;
8890 * Optional modifiers for the kind (such as 'public').
8892 kindModifiers?: string;
8894 * The definition locations of the item.
8898 * Optional children.
8900 childItems?: NavigationBarItem[];
8902 * Number of levels deep this item should appear.
8906 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
8907 interface NavigationTree {
8909 kind: ScriptElementKind;
8910 kindModifiers: string;
8912 nameSpan: TextSpan | undefined;
8913 childItems?: NavigationTree[];
8915 type TelemetryEventName = "telemetry";
8916 interface TelemetryEvent extends Event {
8917 event: TelemetryEventName;
8918 body: TelemetryEventBody;
8920 interface TelemetryEventBody {
8921 telemetryEventName: string;
8924 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed";
8925 interface TypesInstallerInitializationFailedEvent extends Event {
8926 event: TypesInstallerInitializationFailedEventName;
8927 body: TypesInstallerInitializationFailedEventBody;
8929 interface TypesInstallerInitializationFailedEventBody {
8932 type TypingsInstalledTelemetryEventName = "typingsInstalled";
8933 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
8934 telemetryEventName: TypingsInstalledTelemetryEventName;
8935 payload: TypingsInstalledTelemetryEventPayload;
8937 interface TypingsInstalledTelemetryEventPayload {
8939 * Comma separated list of installed typing packages
8941 installedPackages: string;
8943 * true if install request succeeded, otherwise - false
8945 installSuccess: boolean;
8947 * version of typings installer
8949 typingsInstallerVersion: string;
8951 type BeginInstallTypesEventName = "beginInstallTypes";
8952 type EndInstallTypesEventName = "endInstallTypes";
8953 interface BeginInstallTypesEvent extends Event {
8954 event: BeginInstallTypesEventName;
8955 body: BeginInstallTypesEventBody;
8957 interface EndInstallTypesEvent extends Event {
8958 event: EndInstallTypesEventName;
8959 body: EndInstallTypesEventBody;
8961 interface InstallTypesEventBody {
8963 * correlation id to match begin and end events
8967 * list of packages to install
8969 packages: readonly string[];
8971 interface BeginInstallTypesEventBody extends InstallTypesEventBody {
8973 interface EndInstallTypesEventBody extends InstallTypesEventBody {
8975 * true if installation succeeded, otherwise false
8979 interface NavBarResponse extends Response {
8980 body?: NavigationBarItem[];
8982 interface NavTreeResponse extends Response {
8983 body?: NavigationTree;
8985 interface CallHierarchyItem {
8987 kind: ScriptElementKind;
8988 kindModifiers?: string;
8991 selectionSpan: TextSpan;
8992 containerName?: string;
8994 interface CallHierarchyIncomingCall {
8995 from: CallHierarchyItem;
8996 fromSpans: TextSpan[];
8998 interface CallHierarchyOutgoingCall {
8999 to: CallHierarchyItem;
9000 fromSpans: TextSpan[];
9002 interface PrepareCallHierarchyRequest extends FileLocationRequest {
9003 command: CommandTypes.PrepareCallHierarchy;
9005 interface PrepareCallHierarchyResponse extends Response {
9006 readonly body: CallHierarchyItem | CallHierarchyItem[];
9008 interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest {
9009 command: CommandTypes.ProvideCallHierarchyIncomingCalls;
9011 interface ProvideCallHierarchyIncomingCallsResponse extends Response {
9012 readonly body: CallHierarchyIncomingCall[];
9014 interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest {
9015 command: CommandTypes.ProvideCallHierarchyOutgoingCalls;
9017 interface ProvideCallHierarchyOutgoingCallsResponse extends Response {
9018 readonly body: CallHierarchyOutgoingCall[];
9025 enum SemicolonPreference {
9030 interface EditorSettings {
9031 baseIndentSize?: number;
9032 indentSize?: number;
9034 newLineCharacter?: string;
9035 convertTabsToSpaces?: boolean;
9036 indentStyle?: IndentStyle | ts.IndentStyle;
9037 trimTrailingWhitespace?: boolean;
9039 interface FormatCodeSettings extends EditorSettings {
9040 insertSpaceAfterCommaDelimiter?: boolean;
9041 insertSpaceAfterSemicolonInForStatements?: boolean;
9042 insertSpaceBeforeAndAfterBinaryOperators?: boolean;
9043 insertSpaceAfterConstructor?: boolean;
9044 insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
9045 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
9046 insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean;
9047 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
9048 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
9049 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
9050 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
9051 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
9052 insertSpaceAfterTypeAssertion?: boolean;
9053 insertSpaceBeforeFunctionParenthesis?: boolean;
9054 placeOpenBraceOnNewLineForFunctions?: boolean;
9055 placeOpenBraceOnNewLineForControlBlocks?: boolean;
9056 insertSpaceBeforeTypeAnnotation?: boolean;
9057 semicolons?: SemicolonPreference;
9059 interface UserPreferences {
9060 readonly disableSuggestions?: boolean;
9061 readonly quotePreference?: "auto" | "double" | "single";
9063 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
9064 * This affects lone identifier completions but not completions on the right hand side of `obj.`.
9066 readonly includeCompletionsForModuleExports?: boolean;
9068 * If enabled, the completion list will include completions with invalid identifier names.
9069 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
9071 readonly includeCompletionsWithInsertText?: boolean;
9073 * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
9074 * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
9075 * values, with insertion text to replace preceding `.` tokens with `?.`.
9077 readonly includeAutomaticOptionalChainCompletions?: boolean;
9078 readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
9079 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
9080 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
9081 readonly allowTextChangesInNewFiles?: boolean;
9082 readonly lazyConfiguredProjectsFromExternalProject?: boolean;
9083 readonly providePrefixAndSuffixTextForRename?: boolean;
9084 readonly provideRefactorNotApplicableReason?: boolean;
9085 readonly allowRenameOfImportPath?: boolean;
9086 readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
9087 readonly generateReturnInDocTemplate?: boolean;
9089 interface CompilerOptions {
9091 allowSyntheticDefaultImports?: boolean;
9092 allowUnreachableCode?: boolean;
9093 allowUnusedLabels?: boolean;
9094 alwaysStrict?: boolean;
9098 declaration?: boolean;
9099 declarationDir?: string;
9100 disableSizeLimit?: boolean;
9101 downlevelIteration?: boolean;
9103 emitDecoratorMetadata?: boolean;
9104 experimentalDecorators?: boolean;
9105 forceConsistentCasingInFileNames?: boolean;
9106 importHelpers?: boolean;
9107 inlineSourceMap?: boolean;
9108 inlineSources?: boolean;
9109 isolatedModules?: boolean;
9110 jsx?: JsxEmit | ts.JsxEmit;
9114 maxNodeModuleJsDepth?: number;
9115 module?: ModuleKind | ts.ModuleKind;
9116 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
9117 newLine?: NewLineKind | ts.NewLineKind;
9119 noEmitHelpers?: boolean;
9120 noEmitOnError?: boolean;
9121 noErrorTruncation?: boolean;
9122 noFallthroughCasesInSwitch?: boolean;
9123 noImplicitAny?: boolean;
9124 noImplicitReturns?: boolean;
9125 noImplicitThis?: boolean;
9126 noUnusedLocals?: boolean;
9127 noUnusedParameters?: boolean;
9128 noImplicitUseStrict?: boolean;
9130 noResolve?: boolean;
9134 paths?: MapLike<string[]>;
9135 plugins?: PluginImport[];
9136 preserveConstEnums?: boolean;
9137 preserveSymlinks?: boolean;
9139 reactNamespace?: string;
9140 removeComments?: boolean;
9141 references?: ProjectReference[];
9143 rootDirs?: string[];
9144 skipLibCheck?: boolean;
9145 skipDefaultLibCheck?: boolean;
9146 sourceMap?: boolean;
9147 sourceRoot?: string;
9149 strictNullChecks?: boolean;
9150 suppressExcessPropertyErrors?: boolean;
9151 suppressImplicitAnyIndexErrors?: boolean;
9152 useDefineForClassFields?: boolean;
9153 target?: ScriptTarget | ts.ScriptTarget;
9154 traceResolution?: boolean;
9155 resolveJsonModule?: boolean;
9157 /** Paths used to used to compute primary types search locations */
9158 typeRoots?: string[];
9159 [option: string]: CompilerOptionsValue | undefined;
9163 Preserve = "Preserve",
9164 ReactNative = "ReactNative",
9169 CommonJS = "CommonJS",
9177 enum ModuleResolutionKind {
9178 Classic = "Classic",
9197 enum ClassificationType {
9204 regularExpressionLiteral = 7,
9212 typeParameterName = 15,
9215 docCommentTagName = 18,
9216 jsxOpenTagName = 19,
9217 jsxCloseTagName = 20,
9218 jsxSelfClosingTagName = 21,
9221 jsxAttributeStringLiteralValue = 24,
9225 declare namespace ts.server {
9226 interface ScriptInfoVersion {
9230 function isDynamicFileName(fileName: NormalizedPath): boolean;
9232 private readonly host;
9233 readonly fileName: NormalizedPath;
9234 readonly scriptKind: ScriptKind;
9235 readonly hasMixedContent: boolean;
9236 readonly path: Path;
9238 * All projects that include this file
9240 readonly containingProjects: Project[];
9241 private formatSettings;
9242 private preferences;
9243 private textStorage;
9244 constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: ScriptInfoVersion);
9245 isScriptOpen(): boolean;
9246 open(newText: string): void;
9247 close(fileExists?: boolean): void;
9248 getSnapshot(): IScriptSnapshot;
9249 private ensureRealPath;
9250 getFormatCodeSettings(): FormatCodeSettings | undefined;
9251 getPreferences(): protocol.UserPreferences | undefined;
9252 attachToProject(project: Project): boolean;
9253 isAttached(project: Project): boolean;
9254 detachFromProject(project: Project): void;
9255 detachAllProjects(): void;
9256 getDefaultProject(): Project;
9257 registerFileUpdate(): void;
9258 setOptions(formatSettings: FormatCodeSettings, preferences: protocol.UserPreferences | undefined): void;
9259 getLatestVersion(): string;
9260 saveTo(fileName: string): void;
9261 reloadFromFile(tempFileName?: NormalizedPath): boolean;
9262 editContent(start: number, end: number, newText: string): void;
9263 markContainingProjectsAsDirty(): void;
9264 isOrphan(): boolean;
9266 * @param line 1 based index
9268 lineToTextSpan(line: number): TextSpan;
9270 * @param line 1 based index
9271 * @param offset 1 based index
9273 lineOffsetToPosition(line: number, offset: number): number;
9274 positionToLineOffset(position: number): protocol.Location;
9275 isJavaScript(): boolean;
9278 declare namespace ts.server {
9279 interface InstallPackageOptionsWithProject extends InstallPackageOptions {
9280 projectName: string;
9281 projectRootPath: Path;
9283 interface ITypingsInstaller {
9284 isKnownTypesPackageName(name: string): boolean;
9285 installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
9286 enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string> | undefined): void;
9287 attach(projectService: ProjectService): void;
9288 onProjectClosed(p: Project): void;
9289 readonly globalTypingsCacheLocation: string | undefined;
9291 const nullTypingsInstaller: ITypingsInstaller;
9293 declare namespace ts.server {
9298 AutoImportProvider = 3
9300 function allRootFilesAreJsOrDts(project: Project): boolean;
9301 function allFilesAreJsOrDts(project: Project): boolean;
9302 interface PluginCreateInfo {
9304 languageService: LanguageService;
9305 languageServiceHost: LanguageServiceHost;
9306 serverHost: ServerHost;
9309 interface PluginModule {
9310 create(createInfo: PluginCreateInfo): LanguageService;
9311 getExternalFiles?(proj: Project): string[];
9312 onConfigurationChanged?(config: any): void;
9314 interface PluginModuleWithName {
9316 module: PluginModule;
9318 type PluginModuleFactory = (mod: {
9319 typescript: typeof ts;
9321 abstract class Project implements LanguageServiceHost, ModuleResolutionHost {
9322 readonly projectName: string;
9323 readonly projectKind: ProjectKind;
9324 readonly projectService: ProjectService;
9325 private documentRegistry;
9326 private compilerOptions;
9327 compileOnSaveEnabled: boolean;
9328 protected watchOptions: WatchOptions | undefined;
9330 private rootFilesMap;
9332 private externalFiles;
9333 private missingFilesMap;
9334 private generatedFilesMap;
9336 protected languageService: LanguageService;
9337 languageServiceEnabled: boolean;
9338 readonly trace?: (s: string) => void;
9339 readonly realpath?: (path: string) => string;
9340 private builderState;
9342 * Set of files names that were updated since the last call to getChangesSinceVersion.
9344 private updatedFileNames;
9346 * Set of files that was returned from the last call to getChangesSinceVersion.
9348 private lastReportedFileNames;
9350 * Last version that was reported.
9352 private lastReportedVersion;
9354 * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
9355 * This property is changed in 'updateGraph' based on the set of files in program
9357 private projectProgramVersion;
9359 * Current version of the project state. It is changed when:
9360 * - new root file was added/removed
9361 * - edit happen in some file that is currently included in the project.
9362 * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
9364 private projectStateVersion;
9365 protected projectErrors: Diagnostic[] | undefined;
9366 protected isInitialLoadPending: () => boolean;
9367 private readonly cancellationToken;
9368 isNonTsProject(): boolean;
9369 isJsOnlyProject(): boolean;
9370 static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined;
9371 isKnownTypesPackageName(name: string): boolean;
9372 installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
9373 private get typingsCache();
9374 getCompilationSettings(): CompilerOptions;
9375 getCompilerOptions(): CompilerOptions;
9376 getNewLine(): string;
9377 getProjectVersion(): string;
9378 getProjectReferences(): readonly ProjectReference[] | undefined;
9379 getScriptFileNames(): string[];
9380 private getOrCreateScriptInfoAndAttachToProject;
9381 getScriptKind(fileName: string): ScriptKind;
9382 getScriptVersion(filename: string): string;
9383 getScriptSnapshot(filename: string): IScriptSnapshot | undefined;
9384 getCancellationToken(): HostCancellationToken;
9385 getCurrentDirectory(): string;
9386 getDefaultLibFileName(): string;
9387 useCaseSensitiveFileNames(): boolean;
9388 readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
9389 readFile(fileName: string): string | undefined;
9390 writeFile(fileName: string, content: string): void;
9391 fileExists(file: string): boolean;
9392 resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModuleFull | undefined)[];
9393 getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
9394 resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
9395 directoryExists(path: string): boolean;
9396 getDirectories(path: string): string[];
9397 log(s: string): void;
9398 error(s: string): void;
9399 private setInternalCompilerOptionsForEmittingJsFiles;
9401 * Get the errors that dont have any file name associated
9403 getGlobalProjectErrors(): readonly Diagnostic[];
9405 * Get all the project errors
9407 getAllProjectErrors(): readonly Diagnostic[];
9408 setProjectErrors(projectErrors: Diagnostic[] | undefined): void;
9409 getLanguageService(ensureSynchronized?: boolean): LanguageService;
9410 getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[];
9412 * Returns true if emit was conducted
9414 emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): EmitResult;
9415 enableLanguageService(): void;
9416 disableLanguageService(lastFileExceededProgramSize?: string): void;
9417 getProjectName(): string;
9418 protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition;
9419 getExternalFiles(): SortedReadonlyArray<string>;
9420 getSourceFile(path: Path): SourceFile | undefined;
9422 private detachScriptInfoIfNotRoot;
9423 isClosed(): boolean;
9424 hasRoots(): boolean;
9425 getRootFiles(): NormalizedPath[];
9426 getRootScriptInfos(): ScriptInfo[];
9427 getScriptInfos(): ScriptInfo[];
9428 getExcludedFiles(): readonly NormalizedPath[];
9429 getFileNames(excludeFilesFromExternalLibraries?: boolean, excludeConfigFiles?: boolean): NormalizedPath[];
9430 hasConfigFile(configFilePath: NormalizedPath): boolean;
9431 containsScriptInfo(info: ScriptInfo): boolean;
9432 containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean;
9433 isRoot(info: ScriptInfo): boolean;
9434 addRoot(info: ScriptInfo, fileName?: NormalizedPath): void;
9435 addMissingFileRoot(fileName: NormalizedPath): void;
9436 removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void;
9437 registerFileUpdate(fileName: string): void;
9438 markAsDirty(): void;
9440 * Updates set of files that contribute to this project
9441 * @returns: true if set of files in the project stays the same and false - otherwise.
9443 updateGraph(): boolean;
9444 protected removeExistingTypings(include: string[]): string[];
9445 private updateGraphWorker;
9446 private detachScriptInfoFromProject;
9447 private addMissingFileWatcher;
9448 private isWatchedMissingFile;
9449 private createGeneratedFileWatcher;
9450 private isValidGeneratedFileWatcher;
9451 private clearGeneratedFileWatch;
9452 getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
9453 getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined;
9454 filesToString(writeProjectFileNames: boolean): string;
9455 setCompilerOptions(compilerOptions: CompilerOptions): void;
9456 setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void;
9457 getTypeAcquisition(): TypeAcquisition;
9458 protected removeRoot(info: ScriptInfo): void;
9459 protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<any> | undefined): void;
9460 protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<any> | undefined): void;
9461 private enableProxy;
9462 /** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
9463 refreshDiagnostics(): void;
9466 * If a file is opened and no tsconfig (or jsconfig) is found,
9467 * the file and its imports/references are put into an InferredProject.
9469 class InferredProject extends Project {
9470 private static readonly newName;
9471 private _isJsInferredProject;
9472 toggleJsInferredProject(isJsInferredProject: boolean): void;
9473 setCompilerOptions(options?: CompilerOptions): void;
9474 /** this is canonical project root path */
9475 readonly projectRootPath: string | undefined;
9476 addRoot(info: ScriptInfo): void;
9477 removeRoot(info: ScriptInfo): void;
9478 isProjectWithSingleRoot(): boolean;
9480 getTypeAcquisition(): TypeAcquisition;
9482 class AutoImportProviderProject extends Project {
9483 private hostProject;
9484 private static readonly newName;
9485 private rootFileNames;
9486 isOrphan(): boolean;
9487 updateGraph(): boolean;
9488 hasRoots(): boolean;
9489 markAsDirty(): void;
9490 getScriptFileNames(): string[];
9491 getLanguageService(): never;
9492 markAutoImportProviderAsDirty(): never;
9493 getModuleResolutionHostForAutoImportProvider(): never;
9494 getProjectReferences(): readonly ProjectReference[] | undefined;
9495 useSourceOfProjectReferenceRedirect(): boolean;
9496 getTypeAcquisition(): TypeAcquisition;
9499 * If a file is opened, the server will look for a tsconfig (or jsconfig)
9500 * and if successful create a ConfiguredProject for it.
9501 * Otherwise it will create an InferredProject.
9503 class ConfiguredProject extends Project {
9504 private directoriesWatchedForWildcards;
9505 readonly canonicalConfigFilePath: NormalizedPath;
9506 /** Ref count to the project when opened from external project */
9507 private externalProjectRefCount;
9508 private projectReferences;
9510 * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
9511 * @returns: true if set of files in the project stays the same and false - otherwise.
9513 updateGraph(): boolean;
9514 getConfigFilePath(): NormalizedPath;
9515 getProjectReferences(): readonly ProjectReference[] | undefined;
9516 updateReferences(refs: readonly ProjectReference[] | undefined): void;
9518 * Get the errors that dont have any file name associated
9520 getGlobalProjectErrors(): readonly Diagnostic[];
9522 * Get all the project errors
9524 getAllProjectErrors(): readonly Diagnostic[];
9525 setProjectErrors(projectErrors: Diagnostic[]): void;
9527 getEffectiveTypeRoots(): string[];
9530 * Project whose configuration is handled externally, such as in a '.csproj'.
9531 * These are created only if a host explicitly calls `openExternalProject`.
9533 class ExternalProject extends Project {
9534 externalProjectName: string;
9535 compileOnSaveEnabled: boolean;
9536 excludedFiles: readonly NormalizedPath[];
9537 updateGraph(): boolean;
9538 getExcludedFiles(): readonly NormalizedPath[];
9541 declare namespace ts.server {
9542 export const maxProgramSizeForNonTsFiles: number;
9543 export const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
9544 export const ProjectLoadingStartEvent = "projectLoadingStart";
9545 export const ProjectLoadingFinishEvent = "projectLoadingFinish";
9546 export const LargeFileReferencedEvent = "largeFileReferenced";
9547 export const ConfigFileDiagEvent = "configFileDiag";
9548 export const ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
9549 export const ProjectInfoTelemetryEvent = "projectInfo";
9550 export const OpenFileInfoTelemetryEvent = "openFileInfo";
9551 export interface ProjectsUpdatedInBackgroundEvent {
9552 eventName: typeof ProjectsUpdatedInBackgroundEvent;
9554 openFiles: string[];
9557 export interface ProjectLoadingStartEvent {
9558 eventName: typeof ProjectLoadingStartEvent;
9564 export interface ProjectLoadingFinishEvent {
9565 eventName: typeof ProjectLoadingFinishEvent;
9570 export interface LargeFileReferencedEvent {
9571 eventName: typeof LargeFileReferencedEvent;
9575 maxFileSize: number;
9578 export interface ConfigFileDiagEvent {
9579 eventName: typeof ConfigFileDiagEvent;
9581 triggerFile: string;
9582 configFileName: string;
9583 diagnostics: readonly Diagnostic[];
9586 export interface ProjectLanguageServiceStateEvent {
9587 eventName: typeof ProjectLanguageServiceStateEvent;
9590 languageServiceEnabled: boolean;
9593 /** This will be converted to the payload of a protocol.TelemetryEvent in session.defaultEventHandler. */
9594 export interface ProjectInfoTelemetryEvent {
9595 readonly eventName: typeof ProjectInfoTelemetryEvent;
9596 readonly data: ProjectInfoTelemetryEventData;
9598 export interface ProjectInfoTelemetryEventData {
9599 /** Cryptographically secure hash of project file location. */
9600 readonly projectId: string;
9601 /** Count of file extensions seen in the project. */
9602 readonly fileStats: FileStats;
9604 * Any compiler options that might contain paths will be taken out.
9605 * Enum compiler options will be converted to strings.
9607 readonly compilerOptions: CompilerOptions;
9608 readonly extends: boolean | undefined;
9609 readonly files: boolean | undefined;
9610 readonly include: boolean | undefined;
9611 readonly exclude: boolean | undefined;
9612 readonly compileOnSave: boolean;
9613 readonly typeAcquisition: ProjectInfoTypeAcquisitionData;
9614 readonly configFileName: "tsconfig.json" | "jsconfig.json" | "other";
9615 readonly projectType: "external" | "configured";
9616 readonly languageServiceEnabled: boolean;
9617 /** TypeScript version used by the server. */
9618 readonly version: string;
9621 * Info that we may send about a file that was just opened.
9622 * Info about a file will only be sent once per session, even if the file changes in ways that might affect the info.
9623 * Currently this is only sent for '.js' files.
9625 export interface OpenFileInfoTelemetryEvent {
9626 readonly eventName: typeof OpenFileInfoTelemetryEvent;
9627 readonly data: OpenFileInfoTelemetryEventData;
9629 export interface OpenFileInfoTelemetryEventData {
9630 readonly info: OpenFileInfo;
9632 export interface ProjectInfoTypeAcquisitionData {
9633 readonly enable: boolean | undefined;
9634 readonly include: boolean;
9635 readonly exclude: boolean;
9637 export interface FileStats {
9638 readonly js: number;
9639 readonly jsSize?: number;
9640 readonly jsx: number;
9641 readonly jsxSize?: number;
9642 readonly ts: number;
9643 readonly tsSize?: number;
9644 readonly tsx: number;
9645 readonly tsxSize?: number;
9646 readonly dts: number;
9647 readonly dtsSize?: number;
9648 readonly deferred: number;
9649 readonly deferredSize?: number;
9651 export interface OpenFileInfo {
9652 readonly checkJs: boolean;
9654 export type ProjectServiceEvent = LargeFileReferencedEvent | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent;
9655 export type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void;
9656 export interface SafeList {
9659 exclude?: (string | number)[][];
9663 export interface TypesMapFile {
9666 [libName: string]: string;
9669 export function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings;
9670 export function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin;
9671 export function convertWatchOptions(protocolOptions: protocol.ExternalProjectCompilerOptions, currentDirectory?: string): WatchOptionsAndErrors | undefined;
9672 export function convertTypeAcquisition(protocolOptions: protocol.InferredProjectCompilerOptions): TypeAcquisition | undefined;
9673 export function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind;
9674 export function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind.Unknown | ScriptKind.JS | ScriptKind.JSX | ScriptKind.TS | ScriptKind.TSX;
9675 export interface HostConfiguration {
9676 formatCodeOptions: FormatCodeSettings;
9677 preferences: protocol.UserPreferences;
9679 extraFileExtensions?: FileExtensionInfo[];
9680 watchOptions?: WatchOptions;
9682 export interface OpenConfiguredProjectResult {
9683 configFileName?: NormalizedPath;
9684 configFileErrors?: readonly Diagnostic[];
9686 export interface ProjectServiceOptions {
9689 cancellationToken: HostCancellationToken;
9690 useSingleInferredProject: boolean;
9691 useInferredProjectPerProjectRoot: boolean;
9692 typingsInstaller: ITypingsInstaller;
9693 eventHandler?: ProjectServiceEventHandler;
9694 suppressDiagnosticEvents?: boolean;
9695 throttleWaitMilliseconds?: number;
9696 globalPlugins?: readonly string[];
9697 pluginProbeLocations?: readonly string[];
9698 allowLocalPluginLoads?: boolean;
9699 typesMapLocation?: string;
9700 /** @deprecated use serverMode instead */
9701 syntaxOnly?: boolean;
9702 serverMode?: LanguageServiceMode;
9704 export interface WatchOptionsAndErrors {
9705 watchOptions: WatchOptions;
9706 errors: Diagnostic[] | undefined;
9708 export class ProjectService {
9709 private readonly scriptInfoInNodeModulesWatchers;
9711 * Contains all the deleted script info's version information so that
9712 * it does not reset when creating script info again
9713 * (and could have potentially collided with version where contents mismatch)
9715 private readonly filenameToScriptInfoVersion;
9716 private readonly allJsFilesForOpenFileTelemetry;
9718 * maps external project file name to list of config files that were the part of this project
9720 private readonly externalProjectToConfiguredProjectMap;
9722 * external projects (configuration and list of root files is not controlled by tsserver)
9724 readonly externalProjects: ExternalProject[];
9726 * projects built from openFileRoots
9728 readonly inferredProjects: InferredProject[];
9730 * projects specified by a tsconfig.json file
9732 readonly configuredProjects: Map<ConfiguredProject>;
9734 * Open files: with value being project root path, and key being Path of the file that is open
9736 readonly openFiles: Map<NormalizedPath | undefined>;
9738 * Map of open files that are opened without complete path but have projectRoot as current directory
9740 private readonly openFilesWithNonRootedDiskPath;
9741 private compilerOptionsForInferredProjects;
9742 private compilerOptionsForInferredProjectsPerProjectRoot;
9743 private watchOptionsForInferredProjects;
9744 private watchOptionsForInferredProjectsPerProjectRoot;
9745 private typeAcquisitionForInferredProjects;
9746 private typeAcquisitionForInferredProjectsPerProjectRoot;
9748 * Project size for configured or external projects
9750 private readonly projectToSizeMap;
9752 * This is a map of config file paths existence that doesnt need query to disk
9753 * - The entry can be present because there is inferred project that needs to watch addition of config file to directory
9754 * In this case the exists could be true/false based on config file is present or not
9755 * - Or it is present if we have configured project open with config file at that location
9756 * In this case the exists property is always true
9758 private readonly configFileExistenceInfoCache;
9759 private readonly hostConfiguration;
9761 private readonly legacySafelist;
9762 private pendingProjectUpdates;
9763 readonly currentDirectory: NormalizedPath;
9764 readonly toCanonicalFileName: (f: string) => string;
9765 readonly host: ServerHost;
9766 readonly logger: Logger;
9767 readonly cancellationToken: HostCancellationToken;
9768 readonly useSingleInferredProject: boolean;
9769 readonly useInferredProjectPerProjectRoot: boolean;
9770 readonly typingsInstaller: ITypingsInstaller;
9771 private readonly globalCacheLocationDirectoryPath;
9772 readonly throttleWaitMilliseconds?: number;
9773 private readonly eventHandler?;
9774 private readonly suppressDiagnosticEvents?;
9775 readonly globalPlugins: readonly string[];
9776 readonly pluginProbeLocations: readonly string[];
9777 readonly allowLocalPluginLoads: boolean;
9778 private currentPluginConfigOverrides;
9779 readonly typesMapLocation: string | undefined;
9780 /** @deprecated use serverMode instead */
9781 readonly syntaxOnly: boolean;
9782 readonly serverMode: LanguageServiceMode;
9783 /** Tracks projects that we have already sent telemetry for. */
9784 private readonly seenProjects;
9785 private performanceEventHandler?;
9786 constructor(opts: ProjectServiceOptions);
9787 toPath(fileName: string): Path;
9788 private loadTypesMap;
9789 updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse): void;
9790 private delayUpdateProjectGraph;
9791 private delayUpdateProjectGraphs;
9792 setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void;
9793 findProject(projectName: string): Project | undefined;
9794 getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined;
9795 private doEnsureDefaultProjectForFile;
9796 getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined;
9798 * Ensures the project structures are upto date
9800 * - we go through all the projects and update them if they are dirty
9801 * - if updates reflect some change in structure or there was pending request to ensure projects for open files
9802 * ensure that each open script info has project
9804 private ensureProjectStructuresUptoDate;
9805 getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings;
9806 getPreferences(file: NormalizedPath): protocol.UserPreferences;
9807 getHostFormatCodeOptions(): FormatCodeSettings;
9808 getHostPreferences(): protocol.UserPreferences;
9809 private onSourceFileChanged;
9810 private handleSourceMapProjects;
9811 private delayUpdateSourceInfoProjects;
9812 private delayUpdateProjectsOfScriptInfoPath;
9813 private handleDeletedFile;
9815 * This is the callback function for the config file add/remove/change at any location
9816 * that matters to open script info but doesnt have configured project open
9817 * for the config file
9819 private onConfigFileChangeForOpenScriptInfo;
9820 private removeProject;
9821 private assignOrphanScriptInfosToInferredProject;
9823 * Remove this file from the set of open, non-configured files.
9824 * @param info The file that has been closed or newly configured
9826 private closeOpenFile;
9827 private deleteScriptInfo;
9828 private configFileExists;
9829 private setConfigFileExistenceByNewConfiguredProject;
9831 * Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project
9833 private configFileExistenceImpactsRootOfInferredProject;
9834 private setConfigFileExistenceInfoByClosedConfiguredProject;
9835 private logConfigFileWatchUpdate;
9837 * Create the watcher for the configFileExistenceInfo
9839 private createConfigFileWatcherOfConfigFileExistence;
9841 * Close the config file watcher in the cached ConfigFileExistenceInfo
9842 * if there arent any open files that are root of inferred project
9844 private closeConfigFileWatcherOfConfigFileExistenceInfo;
9846 * This is called on file close, so that we stop watching the config file for this script info
9848 private stopWatchingConfigFilesForClosedScriptInfo;
9850 * This function tries to search for a tsconfig.json for the given file.
9851 * This is different from the method the compiler uses because
9852 * the compiler can assume it will always start searching in the
9853 * current directory (the directory in which tsc was invoked).
9854 * The server must start searching from the directory containing
9855 * the newly opened file.
9857 private forEachConfigFileLocation;
9859 * This function tries to search for a tsconfig.json for the given file.
9860 * This is different from the method the compiler uses because
9861 * the compiler can assume it will always start searching in the
9862 * current directory (the directory in which tsc was invoked).
9863 * The server must start searching from the directory containing
9864 * the newly opened file.
9865 * If script info is passed in, it is asserted to be open script info
9866 * otherwise just file name
9868 private getConfigFileNameForFile;
9869 private printProjects;
9870 private getConfiguredProjectByCanonicalConfigFilePath;
9871 private findExternalProjectByProjectName;
9872 /** Get a filename if the language service exceeds the maximum allowed program size; otherwise returns undefined. */
9873 private getFilenameForExceededTotalSizeLimitForNonTsFiles;
9874 private createExternalProject;
9875 private addFilesToNonInferredProject;
9876 private updateNonInferredProjectFiles;
9877 private updateRootAndOptionsOfNonInferredProject;
9878 private sendConfigFileDiagEvent;
9879 private getOrCreateInferredProjectForProjectRootPathIfEnabled;
9880 private getOrCreateSingleInferredProjectIfEnabled;
9881 private getOrCreateSingleInferredWithoutProjectRoot;
9882 private createInferredProject;
9883 getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined;
9884 private watchClosedScriptInfo;
9885 private watchClosedScriptInfoInNodeModules;
9886 private getModifiedTime;
9887 private refreshScriptInfo;
9888 private refreshScriptInfosInDirectory;
9889 private stopWatchingScriptInfo;
9890 private getOrCreateScriptInfoNotOpenedByClientForNormalizedPath;
9891 private getOrCreateScriptInfoOpenedByClientForNormalizedPath;
9892 getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: {
9893 fileExists(path: string): boolean;
9894 }): ScriptInfo | undefined;
9895 private getOrCreateScriptInfoWorker;
9897 * This gets the script info for the normalized path. If the path is not rooted disk path then the open script info with project root context is preferred
9899 getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
9900 getScriptInfoForPath(fileName: Path): ScriptInfo | undefined;
9901 private addSourceInfoToSourceMap;
9902 private addMissingSourceMapFile;
9903 setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
9906 * This function rebuilds the project for every file opened by the client
9907 * This does not reload contents of open files from disk. But we could do that if needed
9909 reloadProjects(): void;
9910 private delayReloadConfiguredProjectForFiles;
9912 * This function goes through all the openFiles and tries to file the config file for them.
9913 * If the config file is found and it refers to existing project, it reloads it either immediately
9914 * or schedules it for reload depending on delayReload option
9915 * If the there is no existing project it just opens the configured project for the config file
9916 * reloadForInfo provides a way to filter out files to reload configured project for
9918 private reloadConfiguredProjectForFiles;
9920 * Remove the root of inferred project if script info is part of another project
9922 private removeRootOfInferredProjectIfNowPartOfOtherProject;
9924 * This function is to update the project structure for every inferred project.
9925 * It is called on the premise that all the configured projects are
9927 * This will go through open files and assign them to inferred project if open file is not part of any other project
9928 * After that all the inferred project graphs are updated
9930 private ensureProjectForOpenFiles;
9932 * Open file whose contents is managed by the client
9933 * @param filename is absolute pathname
9934 * @param fileContent is a known version of the file content that is more up to date than the one on disk
9936 openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult;
9937 private findExternalProjectContainingOpenScriptInfo;
9938 private getOrCreateOpenScriptInfo;
9939 private assignProjectToOpenedScriptInfo;
9940 private createAncestorProjects;
9941 private ensureProjectChildren;
9942 private cleanupAfterOpeningFile;
9943 openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
9944 private removeOrphanConfiguredProjects;
9945 private removeOrphanScriptInfos;
9946 private telemetryOnOpenFile;
9948 * Close file whose contents is managed by the client
9949 * @param filename is absolute pathname
9951 closeClientFile(uncheckedFileName: string): void;
9952 private collectChanges;
9953 private closeConfiguredProjectReferencedFromExternalProject;
9954 closeExternalProject(uncheckedFileName: string): void;
9955 openExternalProjects(projects: protocol.ExternalProject[]): void;
9956 /** Makes a filename safe to insert in a RegExp */
9957 private static readonly filenameEscapeRegexp;
9958 private static escapeFilenameForRegex;
9959 resetSafeList(): void;
9960 applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
9961 openExternalProject(proj: protocol.ExternalProject): void;
9962 hasDeferredExtension(): boolean;
9963 configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
9967 declare namespace ts.server {
9968 interface ServerCancellationToken extends HostCancellationToken {
9969 setRequest(requestId: number): void;
9970 resetRequest(requestId: number): void;
9972 const nullCancellationToken: ServerCancellationToken;
9973 interface PendingErrorCheck {
9974 fileName: NormalizedPath;
9977 type CommandNames = protocol.CommandTypes;
9978 const CommandNames: any;
9979 function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string;
9980 type Event = <T extends object>(body: T, eventName: string) => void;
9981 interface EventSender {
9984 interface SessionOptions {
9986 cancellationToken: ServerCancellationToken;
9987 useSingleInferredProject: boolean;
9988 useInferredProjectPerProjectRoot: boolean;
9989 typingsInstaller: ITypingsInstaller;
9990 byteLength: (buf: string, encoding?: string) => number;
9991 hrtime: (start?: number[]) => number[];
9994 * If falsy, all events are suppressed.
9996 canUseEvents: boolean;
9997 eventHandler?: ProjectServiceEventHandler;
9998 /** Has no effect if eventHandler is also specified. */
9999 suppressDiagnosticEvents?: boolean;
10000 /** @deprecated use serverMode instead */
10001 syntaxOnly?: boolean;
10002 serverMode?: LanguageServiceMode;
10003 throttleWaitMilliseconds?: number;
10004 noGetErrOnBackgroundUpdate?: boolean;
10005 globalPlugins?: readonly string[];
10006 pluginProbeLocations?: readonly string[];
10007 allowLocalPluginLoads?: boolean;
10008 typesMapLocation?: string;
10010 class Session<TMessage = string> implements EventSender {
10011 private readonly gcTimer;
10012 protected projectService: ProjectService;
10014 private performanceData;
10015 private currentRequestId;
10016 private errorCheck;
10017 protected host: ServerHost;
10018 private readonly cancellationToken;
10019 protected readonly typingsInstaller: ITypingsInstaller;
10020 protected byteLength: (buf: string, encoding?: string) => number;
10022 protected logger: Logger;
10023 protected canUseEvents: boolean;
10024 private suppressDiagnosticEvents?;
10025 private eventHandler;
10026 private readonly noGetErrOnBackgroundUpdate?;
10027 constructor(opts: SessionOptions);
10028 private sendRequestCompletedEvent;
10029 private addPerformanceData;
10030 private performanceEventHandler;
10031 private defaultEventHandler;
10032 private projectsUpdatedInBackgroundEvent;
10033 logError(err: Error, cmd: string): void;
10034 private logErrorWorker;
10035 send(msg: protocol.Message): void;
10036 event<T extends object>(body: T, eventName: string): void;
10038 output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void;
10040 private semanticCheck;
10041 private syntacticCheck;
10042 private suggestionCheck;
10043 private sendDiagnosticsEvent;
10044 /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
10045 private updateErrorCheck;
10046 private cleanProjects;
10048 private getEncodedSyntacticClassifications;
10049 private getEncodedSemanticClassifications;
10050 private getProject;
10051 private getConfigFileAndProject;
10052 private getConfigFileDiagnostics;
10053 private convertToDiagnosticsWithLinePositionFromDiagnosticFile;
10054 private getCompilerOptionsDiagnostics;
10055 private convertToDiagnosticsWithLinePosition;
10056 private getDiagnosticsWorker;
10057 private getDefinition;
10058 private mapDefinitionInfoLocations;
10059 private getDefinitionAndBoundSpan;
10060 private getEmitOutput;
10061 private mapDefinitionInfo;
10062 private static mapToOriginalLocation;
10063 private toFileSpan;
10064 private toFileSpanWithContext;
10065 private getTypeDefinition;
10066 private mapImplementationLocations;
10067 private getImplementation;
10068 private getOccurrences;
10069 private getSyntacticDiagnosticsSync;
10070 private getSemanticDiagnosticsSync;
10071 private getSuggestionDiagnosticsSync;
10072 private getJsxClosingTag;
10073 private getDocumentHighlights;
10074 private setCompilerOptionsForInferredProjects;
10075 private getProjectInfo;
10076 private getProjectInfoWorker;
10077 private getRenameInfo;
10078 private getProjects;
10079 private getDefaultProject;
10080 private getRenameLocations;
10081 private mapRenameInfo;
10082 private toSpanGroups;
10083 private getReferences;
10084 private getFileReferences;
10086 * @param fileName is the name of the file to be opened
10087 * @param fileContent is a version of the file content that is known to be more up to date than the one on disk
10089 private openClientFile;
10090 private getPosition;
10091 private getPositionInFile;
10092 private getFileAndProject;
10093 private getFileAndLanguageServiceForSyntacticOperation;
10094 private getFileAndProjectWorker;
10095 private getOutliningSpans;
10096 private getTodoComments;
10097 private getDocCommentTemplate;
10098 private getSpanOfEnclosingComment;
10099 private getIndentation;
10100 private getBreakpointStatement;
10101 private getNameOrDottedNameSpan;
10102 private isValidBraceCompletion;
10103 private getQuickInfoWorker;
10104 private getFormattingEditsForRange;
10105 private getFormattingEditsForRangeFull;
10106 private getFormattingEditsForDocumentFull;
10107 private getFormattingEditsAfterKeystrokeFull;
10108 private getFormattingEditsAfterKeystroke;
10109 private getCompletions;
10110 private getCompletionEntryDetails;
10111 private getCompileOnSaveAffectedFileList;
10113 private getSignatureHelpItems;
10114 private toPendingErrorCheck;
10115 private getDiagnostics;
10119 private closeClientFile;
10120 private mapLocationNavigationBarItems;
10121 private getNavigationBarItems;
10122 private toLocationNavigationTree;
10123 private getNavigationTree;
10124 private getNavigateToItems;
10125 private getFullNavigateToItems;
10126 private getSupportedCodeFixes;
10127 private isLocation;
10128 private extractPositionOrRange;
10130 private getApplicableRefactors;
10131 private getEditsForRefactor;
10132 private organizeImports;
10133 private getEditsForFileRename;
10134 private getCodeFixes;
10135 private getCombinedCodeFix;
10136 private applyCodeActionCommand;
10137 private getStartAndEndPosition;
10138 private mapCodeAction;
10139 private mapCodeFixAction;
10140 private mapTextChangesToCodeEdits;
10141 private mapTextChangeToCodeEdit;
10142 private convertTextChangeToCodeEdit;
10143 private getBraceMatching;
10144 private getDiagnosticsForProject;
10145 private configurePlugin;
10146 private getSmartSelectionRange;
10147 private toggleLineComment;
10148 private toggleMultilineComment;
10149 private commentSelection;
10150 private uncommentSelection;
10151 private mapSelectionRange;
10152 private getScriptInfoFromProjectService;
10153 private toProtocolCallHierarchyItem;
10154 private toProtocolCallHierarchyIncomingCall;
10155 private toProtocolCallHierarchyOutgoingCall;
10156 private prepareCallHierarchy;
10157 private provideCallHierarchyIncomingCalls;
10158 private provideCallHierarchyOutgoingCalls;
10159 getCanonicalFileName(fileName: string): string;
10161 private notRequired;
10162 private requiredResponse;
10164 addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse): void;
10165 private setCurrentRequest;
10166 private resetCurrentRequest;
10167 executeWithRequestId<T>(requestId: number, f: () => T): T;
10168 executeCommand(request: protocol.Request): HandlerResponse;
10169 onMessage(message: TMessage): void;
10170 protected parseMessage(message: TMessage): protocol.Request;
10171 protected toStringMessage(message: TMessage): string;
10172 private getFormatOptions;
10173 private getPreferences;
10174 private getHostFormatOptions;
10175 private getHostPreferences;
10177 interface HandlerResponse {
10179 responseRequired?: boolean;
10182 declare namespace ts {
10183 /** @deprecated Use `factory.createNodeArray` or the factory supplied by your transformation context instead. */
10184 const createNodeArray: <T extends Node>(elements?: readonly T[] | undefined, hasTrailingComma?: boolean | undefined) => NodeArray<T>;
10185 /** @deprecated Use `factory.createNumericLiteral` or the factory supplied by your transformation context instead. */
10186 const createNumericLiteral: (value: string | number, numericLiteralFlags?: TokenFlags | undefined) => NumericLiteral;
10187 /** @deprecated Use `factory.createBigIntLiteral` or the factory supplied by your transformation context instead. */
10188 const createBigIntLiteral: (value: string | PseudoBigInt) => BigIntLiteral;
10189 /** @deprecated Use `factory.createStringLiteral` or the factory supplied by your transformation context instead. */
10190 const createStringLiteral: {
10191 (text: string, isSingleQuote?: boolean | undefined): StringLiteral;
10192 (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral;
10194 /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */
10195 const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral;
10196 /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */
10197 const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral;
10198 /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */
10199 const createLoopVariable: () => Identifier;
10200 /** @deprecated Use `factory.createUniqueName` or the factory supplied by your transformation context instead. */
10201 const createUniqueName: (text: string, flags?: GeneratedIdentifierFlags | undefined) => Identifier;
10202 /** @deprecated Use `factory.createPrivateIdentifier` or the factory supplied by your transformation context instead. */
10203 const createPrivateIdentifier: (text: string) => PrivateIdentifier;
10204 /** @deprecated Use `factory.createSuper` or the factory supplied by your transformation context instead. */
10205 const createSuper: () => SuperExpression;
10206 /** @deprecated Use `factory.createThis` or the factory supplied by your transformation context instead. */
10207 const createThis: () => ThisExpression;
10208 /** @deprecated Use `factory.createNull` or the factory supplied by your transformation context instead. */
10209 const createNull: () => NullLiteral;
10210 /** @deprecated Use `factory.createTrue` or the factory supplied by your transformation context instead. */
10211 const createTrue: () => TrueLiteral;
10212 /** @deprecated Use `factory.createFalse` or the factory supplied by your transformation context instead. */
10213 const createFalse: () => FalseLiteral;
10214 /** @deprecated Use `factory.createModifier` or the factory supplied by your transformation context instead. */
10215 const createModifier: <T extends ModifierSyntaxKind>(kind: T) => ModifierToken<T>;
10216 /** @deprecated Use `factory.createModifiersFromModifierFlags` or the factory supplied by your transformation context instead. */
10217 const createModifiersFromModifierFlags: (flags: ModifierFlags) => Modifier[];
10218 /** @deprecated Use `factory.createQualifiedName` or the factory supplied by your transformation context instead. */
10219 const createQualifiedName: (left: EntityName, right: string | Identifier) => QualifiedName;
10220 /** @deprecated Use `factory.updateQualifiedName` or the factory supplied by your transformation context instead. */
10221 const updateQualifiedName: (node: QualifiedName, left: EntityName, right: Identifier) => QualifiedName;
10222 /** @deprecated Use `factory.createComputedPropertyName` or the factory supplied by your transformation context instead. */
10223 const createComputedPropertyName: (expression: Expression) => ComputedPropertyName;
10224 /** @deprecated Use `factory.updateComputedPropertyName` or the factory supplied by your transformation context instead. */
10225 const updateComputedPropertyName: (node: ComputedPropertyName, expression: Expression) => ComputedPropertyName;
10226 /** @deprecated Use `factory.createTypeParameterDeclaration` or the factory supplied by your transformation context instead. */
10227 const createTypeParameterDeclaration: (name: string | Identifier, constraint?: TypeNode | undefined, defaultType?: TypeNode | undefined) => TypeParameterDeclaration;
10228 /** @deprecated Use `factory.updateTypeParameterDeclaration` or the factory supplied by your transformation context instead. */
10229 const updateTypeParameterDeclaration: (node: TypeParameterDeclaration, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined) => TypeParameterDeclaration;
10230 /** @deprecated Use `factory.createParameterDeclaration` or the factory supplied by your transformation context instead. */
10231 const createParameter: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken | undefined, type?: TypeNode | undefined, initializer?: Expression | undefined) => ParameterDeclaration;
10232 /** @deprecated Use `factory.updateParameterDeclaration` or the factory supplied by your transformation context instead. */
10233 const updateParameter: (node: ParameterDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined) => ParameterDeclaration;
10234 /** @deprecated Use `factory.createDecorator` or the factory supplied by your transformation context instead. */
10235 const createDecorator: (expression: Expression) => Decorator;
10236 /** @deprecated Use `factory.updateDecorator` or the factory supplied by your transformation context instead. */
10237 const updateDecorator: (node: Decorator, expression: Expression) => Decorator;
10238 /** @deprecated Use `factory.createPropertyDeclaration` or the factory supplied by your transformation context instead. */
10239 const createProperty: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined) => PropertyDeclaration;
10240 /** @deprecated Use `factory.updatePropertyDeclaration` or the factory supplied by your transformation context instead. */
10241 const updateProperty: (node: PropertyDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined) => PropertyDeclaration;
10242 /** @deprecated Use `factory.createMethodDeclaration` or the factory supplied by your transformation context instead. */
10243 const createMethod: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) => MethodDeclaration;
10244 /** @deprecated Use `factory.updateMethodDeclaration` or the factory supplied by your transformation context instead. */
10245 const updateMethod: (node: MethodDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) => MethodDeclaration;
10246 /** @deprecated Use `factory.createConstructorDeclaration` or the factory supplied by your transformation context instead. */
10247 const createConstructor: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined) => ConstructorDeclaration;
10248 /** @deprecated Use `factory.updateConstructorDeclaration` or the factory supplied by your transformation context instead. */
10249 const updateConstructor: (node: ConstructorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined) => ConstructorDeclaration;
10250 /** @deprecated Use `factory.createGetAccessorDeclaration` or the factory supplied by your transformation context instead. */
10251 const createGetAccessor: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) => GetAccessorDeclaration;
10252 /** @deprecated Use `factory.updateGetAccessorDeclaration` or the factory supplied by your transformation context instead. */
10253 const updateGetAccessor: (node: GetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) => GetAccessorDeclaration;
10254 /** @deprecated Use `factory.createSetAccessorDeclaration` or the factory supplied by your transformation context instead. */
10255 const createSetAccessor: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined) => SetAccessorDeclaration;
10256 /** @deprecated Use `factory.updateSetAccessorDeclaration` or the factory supplied by your transformation context instead. */
10257 const updateSetAccessor: (node: SetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined) => SetAccessorDeclaration;
10258 /** @deprecated Use `factory.createCallSignature` or the factory supplied by your transformation context instead. */
10259 const createCallSignature: (typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined) => CallSignatureDeclaration;
10260 /** @deprecated Use `factory.updateCallSignature` or the factory supplied by your transformation context instead. */
10261 const updateCallSignature: (node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined) => CallSignatureDeclaration;
10262 /** @deprecated Use `factory.createConstructSignature` or the factory supplied by your transformation context instead. */
10263 const createConstructSignature: (typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined) => ConstructSignatureDeclaration;
10264 /** @deprecated Use `factory.updateConstructSignature` or the factory supplied by your transformation context instead. */
10265 const updateConstructSignature: (node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined) => ConstructSignatureDeclaration;
10266 /** @deprecated Use `factory.updateIndexSignature` or the factory supplied by your transformation context instead. */
10267 const updateIndexSignature: (node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode) => IndexSignatureDeclaration;
10268 /** @deprecated Use `factory.createKeywordTypeNode` or the factory supplied by your transformation context instead. */
10269 const createKeywordTypeNode: <TKind extends KeywordTypeSyntaxKind>(kind: TKind) => KeywordTypeNode<TKind>;
10270 /** @deprecated Use `factory.createTypePredicateNode` or the factory supplied by your transformation context instead. */
10271 const createTypePredicateNodeWithModifier: (assertsModifier: AssertsKeyword | undefined, parameterName: string | Identifier | ThisTypeNode, type: TypeNode | undefined) => TypePredicateNode;
10272 /** @deprecated Use `factory.updateTypePredicateNode` or the factory supplied by your transformation context instead. */
10273 const updateTypePredicateNodeWithModifier: (node: TypePredicateNode, assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined) => TypePredicateNode;
10274 /** @deprecated Use `factory.createTypeReferenceNode` or the factory supplied by your transformation context instead. */
10275 const createTypeReferenceNode: (typeName: string | EntityName, typeArguments?: readonly TypeNode[] | undefined) => TypeReferenceNode;
10276 /** @deprecated Use `factory.updateTypeReferenceNode` or the factory supplied by your transformation context instead. */
10277 const updateTypeReferenceNode: (node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray<TypeNode> | undefined) => TypeReferenceNode;
10278 /** @deprecated Use `factory.createFunctionTypeNode` or the factory supplied by your transformation context instead. */
10279 const createFunctionTypeNode: (typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode) => FunctionTypeNode;
10280 /** @deprecated Use `factory.updateFunctionTypeNode` or the factory supplied by your transformation context instead. */
10281 const updateFunctionTypeNode: (node: FunctionTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode) => FunctionTypeNode;
10282 /** @deprecated Use `factory.createConstructorTypeNode` or the factory supplied by your transformation context instead. */
10283 const createConstructorTypeNode: (typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode) => ConstructorTypeNode;
10284 /** @deprecated Use `factory.updateConstructorTypeNode` or the factory supplied by your transformation context instead. */
10285 const updateConstructorTypeNode: (node: ConstructorTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode) => ConstructorTypeNode;
10286 /** @deprecated Use `factory.createTypeQueryNode` or the factory supplied by your transformation context instead. */
10287 const createTypeQueryNode: (exprName: EntityName) => TypeQueryNode;
10288 /** @deprecated Use `factory.updateTypeQueryNode` or the factory supplied by your transformation context instead. */
10289 const updateTypeQueryNode: (node: TypeQueryNode, exprName: EntityName) => TypeQueryNode;
10290 /** @deprecated Use `factory.createTypeLiteralNode` or the factory supplied by your transformation context instead. */
10291 const createTypeLiteralNode: (members: readonly TypeElement[] | undefined) => TypeLiteralNode;
10292 /** @deprecated Use `factory.updateTypeLiteralNode` or the factory supplied by your transformation context instead. */
10293 const updateTypeLiteralNode: (node: TypeLiteralNode, members: NodeArray<TypeElement>) => TypeLiteralNode;
10294 /** @deprecated Use `factory.createArrayTypeNode` or the factory supplied by your transformation context instead. */
10295 const createArrayTypeNode: (elementType: TypeNode) => ArrayTypeNode;
10296 /** @deprecated Use `factory.updateArrayTypeNode` or the factory supplied by your transformation context instead. */
10297 const updateArrayTypeNode: (node: ArrayTypeNode, elementType: TypeNode) => ArrayTypeNode;
10298 /** @deprecated Use `factory.createTupleTypeNode` or the factory supplied by your transformation context instead. */
10299 const createTupleTypeNode: (elements: readonly (TypeNode | NamedTupleMember)[]) => TupleTypeNode;
10300 /** @deprecated Use `factory.updateTupleTypeNode` or the factory supplied by your transformation context instead. */
10301 const updateTupleTypeNode: (node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]) => TupleTypeNode;
10302 /** @deprecated Use `factory.createOptionalTypeNode` or the factory supplied by your transformation context instead. */
10303 const createOptionalTypeNode: (type: TypeNode) => OptionalTypeNode;
10304 /** @deprecated Use `factory.updateOptionalTypeNode` or the factory supplied by your transformation context instead. */
10305 const updateOptionalTypeNode: (node: OptionalTypeNode, type: TypeNode) => OptionalTypeNode;
10306 /** @deprecated Use `factory.createRestTypeNode` or the factory supplied by your transformation context instead. */
10307 const createRestTypeNode: (type: TypeNode) => RestTypeNode;
10308 /** @deprecated Use `factory.updateRestTypeNode` or the factory supplied by your transformation context instead. */
10309 const updateRestTypeNode: (node: RestTypeNode, type: TypeNode) => RestTypeNode;
10310 /** @deprecated Use `factory.createUnionTypeNode` or the factory supplied by your transformation context instead. */
10311 const createUnionTypeNode: (types: readonly TypeNode[]) => UnionTypeNode;
10312 /** @deprecated Use `factory.updateUnionTypeNode` or the factory supplied by your transformation context instead. */
10313 const updateUnionTypeNode: (node: UnionTypeNode, types: NodeArray<TypeNode>) => UnionTypeNode;
10314 /** @deprecated Use `factory.createIntersectionTypeNode` or the factory supplied by your transformation context instead. */
10315 const createIntersectionTypeNode: (types: readonly TypeNode[]) => IntersectionTypeNode;
10316 /** @deprecated Use `factory.updateIntersectionTypeNode` or the factory supplied by your transformation context instead. */
10317 const updateIntersectionTypeNode: (node: IntersectionTypeNode, types: NodeArray<TypeNode>) => IntersectionTypeNode;
10318 /** @deprecated Use `factory.createConditionalTypeNode` or the factory supplied by your transformation context instead. */
10319 const createConditionalTypeNode: (checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode) => ConditionalTypeNode;
10320 /** @deprecated Use `factory.updateConditionalTypeNode` or the factory supplied by your transformation context instead. */
10321 const updateConditionalTypeNode: (node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode) => ConditionalTypeNode;
10322 /** @deprecated Use `factory.createInferTypeNode` or the factory supplied by your transformation context instead. */
10323 const createInferTypeNode: (typeParameter: TypeParameterDeclaration) => InferTypeNode;
10324 /** @deprecated Use `factory.updateInferTypeNode` or the factory supplied by your transformation context instead. */
10325 const updateInferTypeNode: (node: InferTypeNode, typeParameter: TypeParameterDeclaration) => InferTypeNode;
10326 /** @deprecated Use `factory.createImportTypeNode` or the factory supplied by your transformation context instead. */
10327 const createImportTypeNode: (argument: TypeNode, qualifier?: EntityName | undefined, typeArguments?: readonly TypeNode[] | undefined, isTypeOf?: boolean | undefined) => ImportTypeNode;
10328 /** @deprecated Use `factory.updateImportTypeNode` or the factory supplied by your transformation context instead. */
10329 const updateImportTypeNode: (node: ImportTypeNode, argument: TypeNode, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean | undefined) => ImportTypeNode;
10330 /** @deprecated Use `factory.createParenthesizedType` or the factory supplied by your transformation context instead. */
10331 const createParenthesizedType: (type: TypeNode) => ParenthesizedTypeNode;
10332 /** @deprecated Use `factory.updateParenthesizedType` or the factory supplied by your transformation context instead. */
10333 const updateParenthesizedType: (node: ParenthesizedTypeNode, type: TypeNode) => ParenthesizedTypeNode;
10334 /** @deprecated Use `factory.createThisTypeNode` or the factory supplied by your transformation context instead. */
10335 const createThisTypeNode: () => ThisTypeNode;
10336 /** @deprecated Use `factory.updateTypeOperatorNode` or the factory supplied by your transformation context instead. */
10337 const updateTypeOperatorNode: (node: TypeOperatorNode, type: TypeNode) => TypeOperatorNode;
10338 /** @deprecated Use `factory.createIndexedAccessTypeNode` or the factory supplied by your transformation context instead. */
10339 const createIndexedAccessTypeNode: (objectType: TypeNode, indexType: TypeNode) => IndexedAccessTypeNode;
10340 /** @deprecated Use `factory.updateIndexedAccessTypeNode` or the factory supplied by your transformation context instead. */
10341 const updateIndexedAccessTypeNode: (node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode) => IndexedAccessTypeNode;
10342 /** @deprecated Use `factory.createMappedTypeNode` or the factory supplied by your transformation context instead. */
10343 const createMappedTypeNode: (readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined) => MappedTypeNode;
10344 /** @deprecated Use `factory.updateMappedTypeNode` or the factory supplied by your transformation context instead. */
10345 const updateMappedTypeNode: (node: MappedTypeNode, readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, nameType: TypeNode | undefined, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined) => MappedTypeNode;
10346 /** @deprecated Use `factory.createLiteralTypeNode` or the factory supplied by your transformation context instead. */
10347 const createLiteralTypeNode: (literal: LiteralExpression | BooleanLiteral | PrefixUnaryExpression | NullLiteral) => LiteralTypeNode;
10348 /** @deprecated Use `factory.updateLiteralTypeNode` or the factory supplied by your transformation context instead. */
10349 const updateLiteralTypeNode: (node: LiteralTypeNode, literal: LiteralExpression | BooleanLiteral | PrefixUnaryExpression | NullLiteral) => LiteralTypeNode;
10350 /** @deprecated Use `factory.createObjectBindingPattern` or the factory supplied by your transformation context instead. */
10351 const createObjectBindingPattern: (elements: readonly BindingElement[]) => ObjectBindingPattern;
10352 /** @deprecated Use `factory.updateObjectBindingPattern` or the factory supplied by your transformation context instead. */
10353 const updateObjectBindingPattern: (node: ObjectBindingPattern, elements: readonly BindingElement[]) => ObjectBindingPattern;
10354 /** @deprecated Use `factory.createArrayBindingPattern` or the factory supplied by your transformation context instead. */
10355 const createArrayBindingPattern: (elements: readonly ArrayBindingElement[]) => ArrayBindingPattern;
10356 /** @deprecated Use `factory.updateArrayBindingPattern` or the factory supplied by your transformation context instead. */
10357 const updateArrayBindingPattern: (node: ArrayBindingPattern, elements: readonly ArrayBindingElement[]) => ArrayBindingPattern;
10358 /** @deprecated Use `factory.createBindingElement` or the factory supplied by your transformation context instead. */
10359 const createBindingElement: (dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression | undefined) => BindingElement;
10360 /** @deprecated Use `factory.updateBindingElement` or the factory supplied by your transformation context instead. */
10361 const updateBindingElement: (node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined) => BindingElement;
10362 /** @deprecated Use `factory.createArrayLiteralExpression` or the factory supplied by your transformation context instead. */
10363 const createArrayLiteral: (elements?: readonly Expression[] | undefined, multiLine?: boolean | undefined) => ArrayLiteralExpression;
10364 /** @deprecated Use `factory.updateArrayLiteralExpression` or the factory supplied by your transformation context instead. */
10365 const updateArrayLiteral: (node: ArrayLiteralExpression, elements: readonly Expression[]) => ArrayLiteralExpression;
10366 /** @deprecated Use `factory.createObjectLiteralExpression` or the factory supplied by your transformation context instead. */
10367 const createObjectLiteral: (properties?: readonly ObjectLiteralElementLike[] | undefined, multiLine?: boolean | undefined) => ObjectLiteralExpression;
10368 /** @deprecated Use `factory.updateObjectLiteralExpression` or the factory supplied by your transformation context instead. */
10369 const updateObjectLiteral: (node: ObjectLiteralExpression, properties: readonly ObjectLiteralElementLike[]) => ObjectLiteralExpression;
10370 /** @deprecated Use `factory.createPropertyAccessExpression` or the factory supplied by your transformation context instead. */
10371 const createPropertyAccess: (expression: Expression, name: string | Identifier | PrivateIdentifier) => PropertyAccessExpression;
10372 /** @deprecated Use `factory.updatePropertyAccessExpression` or the factory supplied by your transformation context instead. */
10373 const updatePropertyAccess: (node: PropertyAccessExpression, expression: Expression, name: Identifier | PrivateIdentifier) => PropertyAccessExpression;
10374 /** @deprecated Use `factory.createPropertyAccessChain` or the factory supplied by your transformation context instead. */
10375 const createPropertyAccessChain: (expression: Expression, questionDotToken: QuestionDotToken | undefined, name: string | Identifier | PrivateIdentifier) => PropertyAccessChain;
10376 /** @deprecated Use `factory.updatePropertyAccessChain` or the factory supplied by your transformation context instead. */
10377 const updatePropertyAccessChain: (node: PropertyAccessChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, name: Identifier | PrivateIdentifier) => PropertyAccessChain;
10378 /** @deprecated Use `factory.createElementAccessExpression` or the factory supplied by your transformation context instead. */
10379 const createElementAccess: (expression: Expression, index: number | Expression) => ElementAccessExpression;
10380 /** @deprecated Use `factory.updateElementAccessExpression` or the factory supplied by your transformation context instead. */
10381 const updateElementAccess: (node: ElementAccessExpression, expression: Expression, argumentExpression: Expression) => ElementAccessExpression;
10382 /** @deprecated Use `factory.createElementAccessChain` or the factory supplied by your transformation context instead. */
10383 const createElementAccessChain: (expression: Expression, questionDotToken: QuestionDotToken | undefined, index: number | Expression) => ElementAccessChain;
10384 /** @deprecated Use `factory.updateElementAccessChain` or the factory supplied by your transformation context instead. */
10385 const updateElementAccessChain: (node: ElementAccessChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, argumentExpression: Expression) => ElementAccessChain;
10386 /** @deprecated Use `factory.createCallExpression` or the factory supplied by your transformation context instead. */
10387 const createCall: (expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined) => CallExpression;
10388 /** @deprecated Use `factory.updateCallExpression` or the factory supplied by your transformation context instead. */
10389 const updateCall: (node: CallExpression, expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[]) => CallExpression;
10390 /** @deprecated Use `factory.createCallChain` or the factory supplied by your transformation context instead. */
10391 const createCallChain: (expression: Expression, questionDotToken: QuestionDotToken | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined) => CallChain;
10392 /** @deprecated Use `factory.updateCallChain` or the factory supplied by your transformation context instead. */
10393 const updateCallChain: (node: CallChain, expression: Expression, questionDotToken: QuestionDotToken | undefined, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[]) => CallChain;
10394 /** @deprecated Use `factory.createNewExpression` or the factory supplied by your transformation context instead. */
10395 const createNew: (expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined) => NewExpression;
10396 /** @deprecated Use `factory.updateNewExpression` or the factory supplied by your transformation context instead. */
10397 const updateNew: (node: NewExpression, expression: Expression, typeArguments: readonly TypeNode[] | undefined, argumentsArray: readonly Expression[] | undefined) => NewExpression;
10398 /** @deprecated Use `factory.createTypeAssertion` or the factory supplied by your transformation context instead. */
10399 const createTypeAssertion: (type: TypeNode, expression: Expression) => TypeAssertion;
10400 /** @deprecated Use `factory.updateTypeAssertion` or the factory supplied by your transformation context instead. */
10401 const updateTypeAssertion: (node: TypeAssertion, type: TypeNode, expression: Expression) => TypeAssertion;
10402 /** @deprecated Use `factory.createParenthesizedExpression` or the factory supplied by your transformation context instead. */
10403 const createParen: (expression: Expression) => ParenthesizedExpression;
10404 /** @deprecated Use `factory.updateParenthesizedExpression` or the factory supplied by your transformation context instead. */
10405 const updateParen: (node: ParenthesizedExpression, expression: Expression) => ParenthesizedExpression;
10406 /** @deprecated Use `factory.createFunctionExpression` or the factory supplied by your transformation context instead. */
10407 const createFunctionExpression: (modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[] | undefined, type: TypeNode | undefined, body: Block) => FunctionExpression;
10408 /** @deprecated Use `factory.updateFunctionExpression` or the factory supplied by your transformation context instead. */
10409 const updateFunctionExpression: (node: FunctionExpression, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block) => FunctionExpression;
10410 /** @deprecated Use `factory.createDeleteExpression` or the factory supplied by your transformation context instead. */
10411 const createDelete: (expression: Expression) => DeleteExpression;
10412 /** @deprecated Use `factory.updateDeleteExpression` or the factory supplied by your transformation context instead. */
10413 const updateDelete: (node: DeleteExpression, expression: Expression) => DeleteExpression;
10414 /** @deprecated Use `factory.createTypeOfExpression` or the factory supplied by your transformation context instead. */
10415 const createTypeOf: (expression: Expression) => TypeOfExpression;
10416 /** @deprecated Use `factory.updateTypeOfExpression` or the factory supplied by your transformation context instead. */
10417 const updateTypeOf: (node: TypeOfExpression, expression: Expression) => TypeOfExpression;
10418 /** @deprecated Use `factory.createVoidExpression` or the factory supplied by your transformation context instead. */
10419 const createVoid: (expression: Expression) => VoidExpression;
10420 /** @deprecated Use `factory.updateVoidExpression` or the factory supplied by your transformation context instead. */
10421 const updateVoid: (node: VoidExpression, expression: Expression) => VoidExpression;
10422 /** @deprecated Use `factory.createAwaitExpression` or the factory supplied by your transformation context instead. */
10423 const createAwait: (expression: Expression) => AwaitExpression;
10424 /** @deprecated Use `factory.updateAwaitExpression` or the factory supplied by your transformation context instead. */
10425 const updateAwait: (node: AwaitExpression, expression: Expression) => AwaitExpression;
10426 /** @deprecated Use `factory.createPrefixExpression` or the factory supplied by your transformation context instead. */
10427 const createPrefix: (operator: PrefixUnaryOperator, operand: Expression) => PrefixUnaryExpression;
10428 /** @deprecated Use `factory.updatePrefixExpression` or the factory supplied by your transformation context instead. */
10429 const updatePrefix: (node: PrefixUnaryExpression, operand: Expression) => PrefixUnaryExpression;
10430 /** @deprecated Use `factory.createPostfixUnaryExpression` or the factory supplied by your transformation context instead. */
10431 const createPostfix: (operand: Expression, operator: PostfixUnaryOperator) => PostfixUnaryExpression;
10432 /** @deprecated Use `factory.updatePostfixUnaryExpression` or the factory supplied by your transformation context instead. */
10433 const updatePostfix: (node: PostfixUnaryExpression, operand: Expression) => PostfixUnaryExpression;
10434 /** @deprecated Use `factory.createBinaryExpression` or the factory supplied by your transformation context instead. */
10435 const createBinary: (left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression) => BinaryExpression;
10436 /** @deprecated Use `factory.updateConditionalExpression` or the factory supplied by your transformation context instead. */
10437 const updateConditional: (node: ConditionalExpression, condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression) => ConditionalExpression;
10438 /** @deprecated Use `factory.createTemplateExpression` or the factory supplied by your transformation context instead. */
10439 const createTemplateExpression: (head: TemplateHead, templateSpans: readonly TemplateSpan[]) => TemplateExpression;
10440 /** @deprecated Use `factory.updateTemplateExpression` or the factory supplied by your transformation context instead. */
10441 const updateTemplateExpression: (node: TemplateExpression, head: TemplateHead, templateSpans: readonly TemplateSpan[]) => TemplateExpression;
10442 /** @deprecated Use `factory.createTemplateHead` or the factory supplied by your transformation context instead. */
10443 const createTemplateHead: {
10444 (text: string, rawText?: string | undefined, templateFlags?: TokenFlags | undefined): TemplateHead;
10445 (text: string | undefined, rawText: string, templateFlags?: TokenFlags | undefined): TemplateHead;
10447 /** @deprecated Use `factory.createTemplateMiddle` or the factory supplied by your transformation context instead. */
10448 const createTemplateMiddle: {
10449 (text: string, rawText?: string | undefined, templateFlags?: TokenFlags | undefined): TemplateMiddle;
10450 (text: string | undefined, rawText: string, templateFlags?: TokenFlags | undefined): TemplateMiddle;
10452 /** @deprecated Use `factory.createTemplateTail` or the factory supplied by your transformation context instead. */
10453 const createTemplateTail: {
10454 (text: string, rawText?: string | undefined, templateFlags?: TokenFlags | undefined): TemplateTail;
10455 (text: string | undefined, rawText: string, templateFlags?: TokenFlags | undefined): TemplateTail;
10457 /** @deprecated Use `factory.createNoSubstitutionTemplateLiteral` or the factory supplied by your transformation context instead. */
10458 const createNoSubstitutionTemplateLiteral: {
10459 (text: string, rawText?: string | undefined): NoSubstitutionTemplateLiteral;
10460 (text: string | undefined, rawText: string): NoSubstitutionTemplateLiteral;
10462 /** @deprecated Use `factory.updateYieldExpression` or the factory supplied by your transformation context instead. */
10463 const updateYield: (node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression | undefined) => YieldExpression;
10464 /** @deprecated Use `factory.createSpreadExpression` or the factory supplied by your transformation context instead. */
10465 const createSpread: (expression: Expression) => SpreadElement;
10466 /** @deprecated Use `factory.updateSpreadExpression` or the factory supplied by your transformation context instead. */
10467 const updateSpread: (node: SpreadElement, expression: Expression) => SpreadElement;
10468 /** @deprecated Use `factory.createOmittedExpression` or the factory supplied by your transformation context instead. */
10469 const createOmittedExpression: () => OmittedExpression;
10470 /** @deprecated Use `factory.createAsExpression` or the factory supplied by your transformation context instead. */
10471 const createAsExpression: (expression: Expression, type: TypeNode) => AsExpression;
10472 /** @deprecated Use `factory.updateAsExpression` or the factory supplied by your transformation context instead. */
10473 const updateAsExpression: (node: AsExpression, expression: Expression, type: TypeNode) => AsExpression;
10474 /** @deprecated Use `factory.createNonNullExpression` or the factory supplied by your transformation context instead. */
10475 const createNonNullExpression: (expression: Expression) => NonNullExpression;
10476 /** @deprecated Use `factory.updateNonNullExpression` or the factory supplied by your transformation context instead. */
10477 const updateNonNullExpression: (node: NonNullExpression, expression: Expression) => NonNullExpression;
10478 /** @deprecated Use `factory.createNonNullChain` or the factory supplied by your transformation context instead. */
10479 const createNonNullChain: (expression: Expression) => NonNullChain;
10480 /** @deprecated Use `factory.updateNonNullChain` or the factory supplied by your transformation context instead. */
10481 const updateNonNullChain: (node: NonNullChain, expression: Expression) => NonNullChain;
10482 /** @deprecated Use `factory.createMetaProperty` or the factory supplied by your transformation context instead. */
10483 const createMetaProperty: (keywordToken: SyntaxKind.ImportKeyword | SyntaxKind.NewKeyword, name: Identifier) => MetaProperty;
10484 /** @deprecated Use `factory.updateMetaProperty` or the factory supplied by your transformation context instead. */
10485 const updateMetaProperty: (node: MetaProperty, name: Identifier) => MetaProperty;
10486 /** @deprecated Use `factory.createTemplateSpan` or the factory supplied by your transformation context instead. */
10487 const createTemplateSpan: (expression: Expression, literal: TemplateMiddle | TemplateTail) => TemplateSpan;
10488 /** @deprecated Use `factory.updateTemplateSpan` or the factory supplied by your transformation context instead. */
10489 const updateTemplateSpan: (node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail) => TemplateSpan;
10490 /** @deprecated Use `factory.createSemicolonClassElement` or the factory supplied by your transformation context instead. */
10491 const createSemicolonClassElement: () => SemicolonClassElement;
10492 /** @deprecated Use `factory.createBlock` or the factory supplied by your transformation context instead. */
10493 const createBlock: (statements: readonly Statement[], multiLine?: boolean | undefined) => Block;
10494 /** @deprecated Use `factory.updateBlock` or the factory supplied by your transformation context instead. */
10495 const updateBlock: (node: Block, statements: readonly Statement[]) => Block;
10496 /** @deprecated Use `factory.createVariableStatement` or the factory supplied by your transformation context instead. */
10497 const createVariableStatement: (modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]) => VariableStatement;
10498 /** @deprecated Use `factory.updateVariableStatement` or the factory supplied by your transformation context instead. */
10499 const updateVariableStatement: (node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList) => VariableStatement;
10500 /** @deprecated Use `factory.createEmptyStatement` or the factory supplied by your transformation context instead. */
10501 const createEmptyStatement: () => EmptyStatement;
10502 /** @deprecated Use `factory.createExpressionStatement` or the factory supplied by your transformation context instead. */
10503 const createExpressionStatement: (expression: Expression) => ExpressionStatement;
10504 /** @deprecated Use `factory.updateExpressionStatement` or the factory supplied by your transformation context instead. */
10505 const updateExpressionStatement: (node: ExpressionStatement, expression: Expression) => ExpressionStatement;
10506 /** @deprecated Use `factory.createExpressionStatement` or the factory supplied by your transformation context instead. */
10507 const createStatement: (expression: Expression) => ExpressionStatement;
10508 /** @deprecated Use `factory.updateExpressionStatement` or the factory supplied by your transformation context instead. */
10509 const updateStatement: (node: ExpressionStatement, expression: Expression) => ExpressionStatement;
10510 /** @deprecated Use `factory.createIfStatement` or the factory supplied by your transformation context instead. */
10511 const createIf: (expression: Expression, thenStatement: Statement, elseStatement?: Statement | undefined) => IfStatement;
10512 /** @deprecated Use `factory.updateIfStatement` or the factory supplied by your transformation context instead. */
10513 const updateIf: (node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined) => IfStatement;
10514 /** @deprecated Use `factory.createDoStatement` or the factory supplied by your transformation context instead. */
10515 const createDo: (statement: Statement, expression: Expression) => DoStatement;
10516 /** @deprecated Use `factory.updateDoStatement` or the factory supplied by your transformation context instead. */
10517 const updateDo: (node: DoStatement, statement: Statement, expression: Expression) => DoStatement;
10518 /** @deprecated Use `factory.createWhileStatement` or the factory supplied by your transformation context instead. */
10519 const createWhile: (expression: Expression, statement: Statement) => WhileStatement;
10520 /** @deprecated Use `factory.updateWhileStatement` or the factory supplied by your transformation context instead. */
10521 const updateWhile: (node: WhileStatement, expression: Expression, statement: Statement) => WhileStatement;
10522 /** @deprecated Use `factory.createForStatement` or the factory supplied by your transformation context instead. */
10523 const createFor: (initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement) => ForStatement;
10524 /** @deprecated Use `factory.updateForStatement` or the factory supplied by your transformation context instead. */
10525 const updateFor: (node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement) => ForStatement;
10526 /** @deprecated Use `factory.createForInStatement` or the factory supplied by your transformation context instead. */
10527 const createForIn: (initializer: ForInitializer, expression: Expression, statement: Statement) => ForInStatement;
10528 /** @deprecated Use `factory.updateForInStatement` or the factory supplied by your transformation context instead. */
10529 const updateForIn: (node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement) => ForInStatement;
10530 /** @deprecated Use `factory.createForOfStatement` or the factory supplied by your transformation context instead. */
10531 const createForOf: (awaitModifier: AwaitKeyword | undefined, initializer: ForInitializer, expression: Expression, statement: Statement) => ForOfStatement;
10532 /** @deprecated Use `factory.updateForOfStatement` or the factory supplied by your transformation context instead. */
10533 const updateForOf: (node: ForOfStatement, awaitModifier: AwaitKeyword | undefined, initializer: ForInitializer, expression: Expression, statement: Statement) => ForOfStatement;
10534 /** @deprecated Use `factory.createContinueStatement` or the factory supplied by your transformation context instead. */
10535 const createContinue: (label?: string | Identifier | undefined) => ContinueStatement;
10536 /** @deprecated Use `factory.updateContinueStatement` or the factory supplied by your transformation context instead. */
10537 const updateContinue: (node: ContinueStatement, label: Identifier | undefined) => ContinueStatement;
10538 /** @deprecated Use `factory.createBreakStatement` or the factory supplied by your transformation context instead. */
10539 const createBreak: (label?: string | Identifier | undefined) => BreakStatement;
10540 /** @deprecated Use `factory.updateBreakStatement` or the factory supplied by your transformation context instead. */
10541 const updateBreak: (node: BreakStatement, label: Identifier | undefined) => BreakStatement;
10542 /** @deprecated Use `factory.createReturnStatement` or the factory supplied by your transformation context instead. */
10543 const createReturn: (expression?: Expression | undefined) => ReturnStatement;
10544 /** @deprecated Use `factory.updateReturnStatement` or the factory supplied by your transformation context instead. */
10545 const updateReturn: (node: ReturnStatement, expression: Expression | undefined) => ReturnStatement;
10546 /** @deprecated Use `factory.createWithStatement` or the factory supplied by your transformation context instead. */
10547 const createWith: (expression: Expression, statement: Statement) => WithStatement;
10548 /** @deprecated Use `factory.updateWithStatement` or the factory supplied by your transformation context instead. */
10549 const updateWith: (node: WithStatement, expression: Expression, statement: Statement) => WithStatement;
10550 /** @deprecated Use `factory.createSwitchStatement` or the factory supplied by your transformation context instead. */
10551 const createSwitch: (expression: Expression, caseBlock: CaseBlock) => SwitchStatement;
10552 /** @deprecated Use `factory.updateSwitchStatement` or the factory supplied by your transformation context instead. */
10553 const updateSwitch: (node: SwitchStatement, expression: Expression, caseBlock: CaseBlock) => SwitchStatement;
10554 /** @deprecated Use `factory.createLabelStatement` or the factory supplied by your transformation context instead. */
10555 const createLabel: (label: string | Identifier, statement: Statement) => LabeledStatement;
10556 /** @deprecated Use `factory.updateLabelStatement` or the factory supplied by your transformation context instead. */
10557 const updateLabel: (node: LabeledStatement, label: Identifier, statement: Statement) => LabeledStatement;
10558 /** @deprecated Use `factory.createThrowStatement` or the factory supplied by your transformation context instead. */
10559 const createThrow: (expression: Expression) => ThrowStatement;
10560 /** @deprecated Use `factory.updateThrowStatement` or the factory supplied by your transformation context instead. */
10561 const updateThrow: (node: ThrowStatement, expression: Expression) => ThrowStatement;
10562 /** @deprecated Use `factory.createTryStatement` or the factory supplied by your transformation context instead. */
10563 const createTry: (tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined) => TryStatement;
10564 /** @deprecated Use `factory.updateTryStatement` or the factory supplied by your transformation context instead. */
10565 const updateTry: (node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined) => TryStatement;
10566 /** @deprecated Use `factory.createDebuggerStatement` or the factory supplied by your transformation context instead. */
10567 const createDebuggerStatement: () => DebuggerStatement;
10568 /** @deprecated Use `factory.createVariableDeclarationList` or the factory supplied by your transformation context instead. */
10569 const createVariableDeclarationList: (declarations: readonly VariableDeclaration[], flags?: NodeFlags | undefined) => VariableDeclarationList;
10570 /** @deprecated Use `factory.updateVariableDeclarationList` or the factory supplied by your transformation context instead. */
10571 const updateVariableDeclarationList: (node: VariableDeclarationList, declarations: readonly VariableDeclaration[]) => VariableDeclarationList;
10572 /** @deprecated Use `factory.createFunctionDeclaration` or the factory supplied by your transformation context instead. */
10573 const createFunctionDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) => FunctionDeclaration;
10574 /** @deprecated Use `factory.updateFunctionDeclaration` or the factory supplied by your transformation context instead. */
10575 const updateFunctionDeclaration: (node: FunctionDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) => FunctionDeclaration;
10576 /** @deprecated Use `factory.createClassDeclaration` or the factory supplied by your transformation context instead. */
10577 const createClassDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]) => ClassDeclaration;
10578 /** @deprecated Use `factory.updateClassDeclaration` or the factory supplied by your transformation context instead. */
10579 const updateClassDeclaration: (node: ClassDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]) => ClassDeclaration;
10580 /** @deprecated Use `factory.createInterfaceDeclaration` or the factory supplied by your transformation context instead. */
10581 const createInterfaceDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]) => InterfaceDeclaration;
10582 /** @deprecated Use `factory.updateInterfaceDeclaration` or the factory supplied by your transformation context instead. */
10583 const updateInterfaceDeclaration: (node: InterfaceDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]) => InterfaceDeclaration;
10584 /** @deprecated Use `factory.createTypeAliasDeclaration` or the factory supplied by your transformation context instead. */
10585 const createTypeAliasDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode) => TypeAliasDeclaration;
10586 /** @deprecated Use `factory.updateTypeAliasDeclaration` or the factory supplied by your transformation context instead. */
10587 const updateTypeAliasDeclaration: (node: TypeAliasDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode) => TypeAliasDeclaration;
10588 /** @deprecated Use `factory.createEnumDeclaration` or the factory supplied by your transformation context instead. */
10589 const createEnumDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]) => EnumDeclaration;
10590 /** @deprecated Use `factory.updateEnumDeclaration` or the factory supplied by your transformation context instead. */
10591 const updateEnumDeclaration: (node: EnumDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]) => EnumDeclaration;
10592 /** @deprecated Use `factory.createModuleDeclaration` or the factory supplied by your transformation context instead. */
10593 const createModuleDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags | undefined) => ModuleDeclaration;
10594 /** @deprecated Use `factory.updateModuleDeclaration` or the factory supplied by your transformation context instead. */
10595 const updateModuleDeclaration: (node: ModuleDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined) => ModuleDeclaration;
10596 /** @deprecated Use `factory.createModuleBlock` or the factory supplied by your transformation context instead. */
10597 const createModuleBlock: (statements: readonly Statement[]) => ModuleBlock;
10598 /** @deprecated Use `factory.updateModuleBlock` or the factory supplied by your transformation context instead. */
10599 const updateModuleBlock: (node: ModuleBlock, statements: readonly Statement[]) => ModuleBlock;
10600 /** @deprecated Use `factory.createCaseBlock` or the factory supplied by your transformation context instead. */
10601 const createCaseBlock: (clauses: readonly CaseOrDefaultClause[]) => CaseBlock;
10602 /** @deprecated Use `factory.updateCaseBlock` or the factory supplied by your transformation context instead. */
10603 const updateCaseBlock: (node: CaseBlock, clauses: readonly CaseOrDefaultClause[]) => CaseBlock;
10604 /** @deprecated Use `factory.createNamespaceExportDeclaration` or the factory supplied by your transformation context instead. */
10605 const createNamespaceExportDeclaration: (name: string | Identifier) => NamespaceExportDeclaration;
10606 /** @deprecated Use `factory.updateNamespaceExportDeclaration` or the factory supplied by your transformation context instead. */
10607 const updateNamespaceExportDeclaration: (node: NamespaceExportDeclaration, name: Identifier) => NamespaceExportDeclaration;
10608 /** @deprecated Use `factory.createImportEqualsDeclaration` or the factory supplied by your transformation context instead. */
10609 const createImportEqualsDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference) => ImportEqualsDeclaration;
10610 /** @deprecated Use `factory.updateImportEqualsDeclaration` or the factory supplied by your transformation context instead. */
10611 const updateImportEqualsDeclaration: (node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference) => ImportEqualsDeclaration;
10612 /** @deprecated Use `factory.createImportDeclaration` or the factory supplied by your transformation context instead. */
10613 const createImportDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression) => ImportDeclaration;
10614 /** @deprecated Use `factory.updateImportDeclaration` or the factory supplied by your transformation context instead. */
10615 const updateImportDeclaration: (node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression) => ImportDeclaration;
10616 /** @deprecated Use `factory.createNamespaceImport` or the factory supplied by your transformation context instead. */
10617 const createNamespaceImport: (name: Identifier) => NamespaceImport;
10618 /** @deprecated Use `factory.updateNamespaceImport` or the factory supplied by your transformation context instead. */
10619 const updateNamespaceImport: (node: NamespaceImport, name: Identifier) => NamespaceImport;
10620 /** @deprecated Use `factory.createNamedImports` or the factory supplied by your transformation context instead. */
10621 const createNamedImports: (elements: readonly ImportSpecifier[]) => NamedImports;
10622 /** @deprecated Use `factory.updateNamedImports` or the factory supplied by your transformation context instead. */
10623 const updateNamedImports: (node: NamedImports, elements: readonly ImportSpecifier[]) => NamedImports;
10624 /** @deprecated Use `factory.createImportSpecifier` or the factory supplied by your transformation context instead. */
10625 const createImportSpecifier: (propertyName: Identifier | undefined, name: Identifier) => ImportSpecifier;
10626 /** @deprecated Use `factory.updateImportSpecifier` or the factory supplied by your transformation context instead. */
10627 const updateImportSpecifier: (node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier) => ImportSpecifier;
10628 /** @deprecated Use `factory.createExportAssignment` or the factory supplied by your transformation context instead. */
10629 const createExportAssignment: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression) => ExportAssignment;
10630 /** @deprecated Use `factory.updateExportAssignment` or the factory supplied by your transformation context instead. */
10631 const updateExportAssignment: (node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression) => ExportAssignment;
10632 /** @deprecated Use `factory.createNamedExports` or the factory supplied by your transformation context instead. */
10633 const createNamedExports: (elements: readonly ExportSpecifier[]) => NamedExports;
10634 /** @deprecated Use `factory.updateNamedExports` or the factory supplied by your transformation context instead. */
10635 const updateNamedExports: (node: NamedExports, elements: readonly ExportSpecifier[]) => NamedExports;
10636 /** @deprecated Use `factory.createExportSpecifier` or the factory supplied by your transformation context instead. */
10637 const createExportSpecifier: (propertyName: string | Identifier | undefined, name: string | Identifier) => ExportSpecifier;
10638 /** @deprecated Use `factory.updateExportSpecifier` or the factory supplied by your transformation context instead. */
10639 const updateExportSpecifier: (node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier) => ExportSpecifier;
10640 /** @deprecated Use `factory.createExternalModuleReference` or the factory supplied by your transformation context instead. */
10641 const createExternalModuleReference: (expression: Expression) => ExternalModuleReference;
10642 /** @deprecated Use `factory.updateExternalModuleReference` or the factory supplied by your transformation context instead. */
10643 const updateExternalModuleReference: (node: ExternalModuleReference, expression: Expression) => ExternalModuleReference;
10644 /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */
10645 const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression;
10646 /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */
10647 const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocTypeTag;
10648 /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */
10649 const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocReturnTag;
10650 /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */
10651 const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocThisTag;
10652 /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */
10653 const createJSDocComment: (comment?: string | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc;
10654 /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */
10655 const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | undefined) => JSDocParameterTag;
10656 /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */
10657 const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocClassTag;
10658 /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */
10659 const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & {
10660 readonly expression: Identifier | PropertyAccessEntityNameExpression;
10661 }, comment?: string | undefined) => JSDocAugmentsTag;
10662 /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */
10663 const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocEnumTag;
10664 /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */
10665 const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | undefined) => JSDocTemplateTag;
10666 /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */
10667 const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | undefined) => JSDocTypedefTag;
10668 /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */
10669 const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | undefined) => JSDocCallbackTag;
10670 /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */
10671 const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature;
10672 /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */
10673 const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | undefined) => JSDocPropertyTag;
10674 /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */
10675 const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral;
10676 /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */
10677 const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & {
10678 readonly expression: Identifier | PropertyAccessEntityNameExpression;
10679 }, comment?: string | undefined) => JSDocImplementsTag;
10680 /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */
10681 const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocAuthorTag;
10682 /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */
10683 const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocPublicTag;
10684 /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */
10685 const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocPrivateTag;
10686 /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */
10687 const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocProtectedTag;
10688 /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */
10689 const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | undefined) => JSDocReadonlyTag;
10690 /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */
10691 const createJSDocTag: (tagName: Identifier, comment?: string | undefined) => JSDocUnknownTag;
10692 /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */
10693 const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement;
10694 /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */
10695 const updateJsxElement: (node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement;
10696 /** @deprecated Use `factory.createJsxSelfClosingElement` or the factory supplied by your transformation context instead. */
10697 const createJsxSelfClosingElement: (tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes) => JsxSelfClosingElement;
10698 /** @deprecated Use `factory.updateJsxSelfClosingElement` or the factory supplied by your transformation context instead. */
10699 const updateJsxSelfClosingElement: (node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes) => JsxSelfClosingElement;
10700 /** @deprecated Use `factory.createJsxOpeningElement` or the factory supplied by your transformation context instead. */
10701 const createJsxOpeningElement: (tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes) => JsxOpeningElement;
10702 /** @deprecated Use `factory.updateJsxOpeningElement` or the factory supplied by your transformation context instead. */
10703 const updateJsxOpeningElement: (node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes) => JsxOpeningElement;
10704 /** @deprecated Use `factory.createJsxClosingElement` or the factory supplied by your transformation context instead. */
10705 const createJsxClosingElement: (tagName: JsxTagNameExpression) => JsxClosingElement;
10706 /** @deprecated Use `factory.updateJsxClosingElement` or the factory supplied by your transformation context instead. */
10707 const updateJsxClosingElement: (node: JsxClosingElement, tagName: JsxTagNameExpression) => JsxClosingElement;
10708 /** @deprecated Use `factory.createJsxFragment` or the factory supplied by your transformation context instead. */
10709 const createJsxFragment: (openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment) => JsxFragment;
10710 /** @deprecated Use `factory.createJsxText` or the factory supplied by your transformation context instead. */
10711 const createJsxText: (text: string, containsOnlyTriviaWhiteSpaces?: boolean | undefined) => JsxText;
10712 /** @deprecated Use `factory.updateJsxText` or the factory supplied by your transformation context instead. */
10713 const updateJsxText: (node: JsxText, text: string, containsOnlyTriviaWhiteSpaces?: boolean | undefined) => JsxText;
10714 /** @deprecated Use `factory.createJsxOpeningFragment` or the factory supplied by your transformation context instead. */
10715 const createJsxOpeningFragment: () => JsxOpeningFragment;
10716 /** @deprecated Use `factory.createJsxJsxClosingFragment` or the factory supplied by your transformation context instead. */
10717 const createJsxJsxClosingFragment: () => JsxClosingFragment;
10718 /** @deprecated Use `factory.updateJsxFragment` or the factory supplied by your transformation context instead. */
10719 const updateJsxFragment: (node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment) => JsxFragment;
10720 /** @deprecated Use `factory.createJsxAttribute` or the factory supplied by your transformation context instead. */
10721 const createJsxAttribute: (name: Identifier, initializer: StringLiteral | JsxExpression | undefined) => JsxAttribute;
10722 /** @deprecated Use `factory.updateJsxAttribute` or the factory supplied by your transformation context instead. */
10723 const updateJsxAttribute: (node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression | undefined) => JsxAttribute;
10724 /** @deprecated Use `factory.createJsxAttributes` or the factory supplied by your transformation context instead. */
10725 const createJsxAttributes: (properties: readonly JsxAttributeLike[]) => JsxAttributes;
10726 /** @deprecated Use `factory.updateJsxAttributes` or the factory supplied by your transformation context instead. */
10727 const updateJsxAttributes: (node: JsxAttributes, properties: readonly JsxAttributeLike[]) => JsxAttributes;
10728 /** @deprecated Use `factory.createJsxSpreadAttribute` or the factory supplied by your transformation context instead. */
10729 const createJsxSpreadAttribute: (expression: Expression) => JsxSpreadAttribute;
10730 /** @deprecated Use `factory.updateJsxSpreadAttribute` or the factory supplied by your transformation context instead. */
10731 const updateJsxSpreadAttribute: (node: JsxSpreadAttribute, expression: Expression) => JsxSpreadAttribute;
10732 /** @deprecated Use `factory.createJsxExpression` or the factory supplied by your transformation context instead. */
10733 const createJsxExpression: (dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined) => JsxExpression;
10734 /** @deprecated Use `factory.updateJsxExpression` or the factory supplied by your transformation context instead. */
10735 const updateJsxExpression: (node: JsxExpression, expression: Expression | undefined) => JsxExpression;
10736 /** @deprecated Use `factory.createCaseClause` or the factory supplied by your transformation context instead. */
10737 const createCaseClause: (expression: Expression, statements: readonly Statement[]) => CaseClause;
10738 /** @deprecated Use `factory.updateCaseClause` or the factory supplied by your transformation context instead. */
10739 const updateCaseClause: (node: CaseClause, expression: Expression, statements: readonly Statement[]) => CaseClause;
10740 /** @deprecated Use `factory.createDefaultClause` or the factory supplied by your transformation context instead. */
10741 const createDefaultClause: (statements: readonly Statement[]) => DefaultClause;
10742 /** @deprecated Use `factory.updateDefaultClause` or the factory supplied by your transformation context instead. */
10743 const updateDefaultClause: (node: DefaultClause, statements: readonly Statement[]) => DefaultClause;
10744 /** @deprecated Use `factory.createHeritageClause` or the factory supplied by your transformation context instead. */
10745 const createHeritageClause: (token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword, types: readonly ExpressionWithTypeArguments[]) => HeritageClause;
10746 /** @deprecated Use `factory.updateHeritageClause` or the factory supplied by your transformation context instead. */
10747 const updateHeritageClause: (node: HeritageClause, types: readonly ExpressionWithTypeArguments[]) => HeritageClause;
10748 /** @deprecated Use `factory.createCatchClause` or the factory supplied by your transformation context instead. */
10749 const createCatchClause: (variableDeclaration: string | VariableDeclaration | undefined, block: Block) => CatchClause;
10750 /** @deprecated Use `factory.updateCatchClause` or the factory supplied by your transformation context instead. */
10751 const updateCatchClause: (node: CatchClause, variableDeclaration: VariableDeclaration | undefined, block: Block) => CatchClause;
10752 /** @deprecated Use `factory.createPropertyAssignment` or the factory supplied by your transformation context instead. */
10753 const createPropertyAssignment: (name: string | PropertyName, initializer: Expression) => PropertyAssignment;
10754 /** @deprecated Use `factory.updatePropertyAssignment` or the factory supplied by your transformation context instead. */
10755 const updatePropertyAssignment: (node: PropertyAssignment, name: PropertyName, initializer: Expression) => PropertyAssignment;
10756 /** @deprecated Use `factory.createShorthandPropertyAssignment` or the factory supplied by your transformation context instead. */
10757 const createShorthandPropertyAssignment: (name: string | Identifier, objectAssignmentInitializer?: Expression | undefined) => ShorthandPropertyAssignment;
10758 /** @deprecated Use `factory.updateShorthandPropertyAssignment` or the factory supplied by your transformation context instead. */
10759 const updateShorthandPropertyAssignment: (node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined) => ShorthandPropertyAssignment;
10760 /** @deprecated Use `factory.createSpreadAssignment` or the factory supplied by your transformation context instead. */
10761 const createSpreadAssignment: (expression: Expression) => SpreadAssignment;
10762 /** @deprecated Use `factory.updateSpreadAssignment` or the factory supplied by your transformation context instead. */
10763 const updateSpreadAssignment: (node: SpreadAssignment, expression: Expression) => SpreadAssignment;
10764 /** @deprecated Use `factory.createEnumMember` or the factory supplied by your transformation context instead. */
10765 const createEnumMember: (name: string | PropertyName, initializer?: Expression | undefined) => EnumMember;
10766 /** @deprecated Use `factory.updateEnumMember` or the factory supplied by your transformation context instead. */
10767 const updateEnumMember: (node: EnumMember, name: PropertyName, initializer: Expression | undefined) => EnumMember;
10768 /** @deprecated Use `factory.updateSourceFile` or the factory supplied by your transformation context instead. */
10769 const updateSourceFileNode: (node: SourceFile, statements: readonly Statement[], isDeclarationFile?: boolean | undefined, referencedFiles?: readonly FileReference[] | undefined, typeReferences?: readonly FileReference[] | undefined, hasNoDefaultLib?: boolean | undefined, libReferences?: readonly FileReference[] | undefined) => SourceFile;
10770 /** @deprecated Use `factory.createNotEmittedStatement` or the factory supplied by your transformation context instead. */
10771 const createNotEmittedStatement: (original: Node) => NotEmittedStatement;
10772 /** @deprecated Use `factory.createPartiallyEmittedExpression` or the factory supplied by your transformation context instead. */
10773 const createPartiallyEmittedExpression: (expression: Expression, original?: Node | undefined) => PartiallyEmittedExpression;
10774 /** @deprecated Use `factory.updatePartiallyEmittedExpression` or the factory supplied by your transformation context instead. */
10775 const updatePartiallyEmittedExpression: (node: PartiallyEmittedExpression, expression: Expression) => PartiallyEmittedExpression;
10776 /** @deprecated Use `factory.createCommaListExpression` or the factory supplied by your transformation context instead. */
10777 const createCommaList: (elements: readonly Expression[]) => CommaListExpression;
10778 /** @deprecated Use `factory.updateCommaListExpression` or the factory supplied by your transformation context instead. */
10779 const updateCommaList: (node: CommaListExpression, elements: readonly Expression[]) => CommaListExpression;
10780 /** @deprecated Use `factory.createBundle` or the factory supplied by your transformation context instead. */
10781 const createBundle: (sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[] | undefined) => Bundle;
10782 /** @deprecated Use `factory.updateBundle` or the factory supplied by your transformation context instead. */
10783 const updateBundle: (node: Bundle, sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[] | undefined) => Bundle;
10784 /** @deprecated Use `factory.createImmediatelyInvokedFunctionExpression` or the factory supplied by your transformation context instead. */
10785 const createImmediatelyInvokedFunctionExpression: {
10786 (statements: readonly Statement[]): CallExpression;
10787 (statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression;
10789 /** @deprecated Use `factory.createImmediatelyInvokedArrowFunction` or the factory supplied by your transformation context instead. */
10790 const createImmediatelyInvokedArrowFunction: {
10791 (statements: readonly Statement[]): CallExpression;
10792 (statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression;
10794 /** @deprecated Use `factory.createVoidZero` or the factory supplied by your transformation context instead. */
10795 const createVoidZero: () => VoidExpression;
10796 /** @deprecated Use `factory.createExportDefault` or the factory supplied by your transformation context instead. */
10797 const createExportDefault: (expression: Expression) => ExportAssignment;
10798 /** @deprecated Use `factory.createExternalModuleExport` or the factory supplied by your transformation context instead. */
10799 const createExternalModuleExport: (exportName: Identifier) => ExportDeclaration;
10800 /** @deprecated Use `factory.createNamespaceExport` or the factory supplied by your transformation context instead. */
10801 const createNamespaceExport: (name: Identifier) => NamespaceExport;
10802 /** @deprecated Use `factory.updateNamespaceExport` or the factory supplied by your transformation context instead. */
10803 const updateNamespaceExport: (node: NamespaceExport, name: Identifier) => NamespaceExport;
10804 /** @deprecated Use `factory.createToken` or the factory supplied by your transformation context instead. */
10805 const createToken: <TKind extends SyntaxKind>(kind: TKind) => Token<TKind>;
10806 /** @deprecated Use `factory.createIdentifier` or the factory supplied by your transformation context instead. */
10807 const createIdentifier: (text: string) => Identifier;
10808 /** @deprecated Use `factory.createTempVariable` or the factory supplied by your transformation context instead. */
10809 const createTempVariable: (recordTempVariable: ((node: Identifier) => void) | undefined) => Identifier;
10810 /** @deprecated Use `factory.getGeneratedNameForNode` or the factory supplied by your transformation context instead. */
10811 const getGeneratedNameForNode: (node: Node | undefined) => Identifier;
10812 /** @deprecated Use `factory.createUniqueName(text, GeneratedIdentifierFlags.Optimistic)` or the factory supplied by your transformation context instead. */
10813 const createOptimisticUniqueName: (text: string) => Identifier;
10814 /** @deprecated Use `factory.createUniqueName(text, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel)` or the factory supplied by your transformation context instead. */
10815 const createFileLevelUniqueName: (text: string) => Identifier;
10816 /** @deprecated Use `factory.createIndexSignature` or the factory supplied by your transformation context instead. */
10817 const createIndexSignature: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode) => IndexSignatureDeclaration;
10818 /** @deprecated Use `factory.createTypePredicateNode` or the factory supplied by your transformation context instead. */
10819 const createTypePredicateNode: (parameterName: Identifier | ThisTypeNode | string, type: TypeNode) => TypePredicateNode;
10820 /** @deprecated Use `factory.updateTypePredicateNode` or the factory supplied by your transformation context instead. */
10821 const updateTypePredicateNode: (node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode) => TypePredicateNode;
10822 /** @deprecated Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead. */
10823 const createLiteral: {
10824 (value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral;
10825 (value: number | PseudoBigInt): NumericLiteral;
10826 (value: boolean): BooleanLiteral;
10827 (value: string | number | PseudoBigInt | boolean): PrimaryExpression;
10829 /** @deprecated Use `factory.createMethodSignature` or the factory supplied by your transformation context instead. */
10830 const createMethodSignature: (typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined) => MethodSignature;
10831 /** @deprecated Use `factory.updateMethodSignature` or the factory supplied by your transformation context instead. */
10832 const updateMethodSignature: (node: MethodSignature, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined, name: PropertyName, questionToken: QuestionToken | undefined) => MethodSignature;
10833 /** @deprecated Use `factory.createTypeOperatorNode` or the factory supplied by your transformation context instead. */
10834 const createTypeOperatorNode: {
10835 (type: TypeNode): TypeOperatorNode;
10836 (operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode;
10838 /** @deprecated Use `factory.createTaggedTemplate` or the factory supplied by your transformation context instead. */
10839 const createTaggedTemplate: {
10840 (tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
10841 (tag: Expression, typeArguments: readonly TypeNode[] | undefined, template: TemplateLiteral): TaggedTemplateExpression;
10843 /** @deprecated Use `factory.updateTaggedTemplate` or the factory supplied by your transformation context instead. */
10844 const updateTaggedTemplate: {
10845 (node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
10846 (node: TaggedTemplateExpression, tag: Expression, typeArguments: readonly TypeNode[] | undefined, template: TemplateLiteral): TaggedTemplateExpression;
10848 /** @deprecated Use `factory.updateBinary` or the factory supplied by your transformation context instead. */
10849 const updateBinary: (node: BinaryExpression, left: Expression, right: Expression, operator?: BinaryOperator | BinaryOperatorToken) => BinaryExpression;
10850 /** @deprecated Use `factory.createConditional` or the factory supplied by your transformation context instead. */
10851 const createConditional: {
10852 (condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression;
10853 (condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression;
10855 /** @deprecated Use `factory.createYield` or the factory supplied by your transformation context instead. */
10856 const createYield: {
10857 (expression?: Expression | undefined): YieldExpression;
10858 (asteriskToken: AsteriskToken | undefined, expression: Expression): YieldExpression;
10860 /** @deprecated Use `factory.createClassExpression` or the factory supplied by your transformation context instead. */
10861 const createClassExpression: (modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]) => ClassExpression;
10862 /** @deprecated Use `factory.updateClassExpression` or the factory supplied by your transformation context instead. */
10863 const updateClassExpression: (node: ClassExpression, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]) => ClassExpression;
10864 /** @deprecated Use `factory.createPropertySignature` or the factory supplied by your transformation context instead. */
10865 const createPropertySignature: (modifiers: readonly Modifier[] | undefined, name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer?: Expression | undefined) => PropertySignature;
10866 /** @deprecated Use `factory.updatePropertySignature` or the factory supplied by your transformation context instead. */
10867 const updatePropertySignature: (node: PropertySignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined) => PropertySignature;
10868 /** @deprecated Use `factory.createExpressionWithTypeArguments` or the factory supplied by your transformation context instead. */
10869 const createExpressionWithTypeArguments: (typeArguments: readonly TypeNode[] | undefined, expression: Expression) => ExpressionWithTypeArguments;
10870 /** @deprecated Use `factory.updateExpressionWithTypeArguments` or the factory supplied by your transformation context instead. */
10871 const updateExpressionWithTypeArguments: (node: ExpressionWithTypeArguments, typeArguments: readonly TypeNode[] | undefined, expression: Expression) => ExpressionWithTypeArguments;
10872 /** @deprecated Use `factory.createArrowFunction` or the factory supplied by your transformation context instead. */
10873 const createArrowFunction: {
10874 (modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction;
10875 (modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody): ArrowFunction;
10877 /** @deprecated Use `factory.updateArrowFunction` or the factory supplied by your transformation context instead. */
10878 const updateArrowFunction: {
10879 (node: ArrowFunction, modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody): ArrowFunction;
10880 (node: ArrowFunction, modifiers: readonly Modifier[] | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody): ArrowFunction;
10882 /** @deprecated Use `factory.createVariableDeclaration` or the factory supplied by your transformation context instead. */
10883 const createVariableDeclaration: {
10884 (name: string | BindingName, type?: TypeNode | undefined, initializer?: Expression | undefined): VariableDeclaration;
10885 (name: string | BindingName, exclamationToken: ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration;
10887 /** @deprecated Use `factory.updateVariableDeclaration` or the factory supplied by your transformation context instead. */
10888 const updateVariableDeclaration: {
10889 (node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration;
10890 (node: VariableDeclaration, name: BindingName, exclamationToken: ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration;
10892 /** @deprecated Use `factory.createImportClause` or the factory supplied by your transformation context instead. */
10893 const createImportClause: (name: Identifier | undefined, namedBindings: NamedImportBindings | undefined, isTypeOnly?: any) => ImportClause;
10894 /** @deprecated Use `factory.updateImportClause` or the factory supplied by your transformation context instead. */
10895 const updateImportClause: (node: ImportClause, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined, isTypeOnly: boolean) => ImportClause;
10896 /** @deprecated Use `factory.createExportDeclaration` or the factory supplied by your transformation context instead. */
10897 const createExportDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression | undefined, isTypeOnly?: any) => ExportDeclaration;
10898 /** @deprecated Use `factory.updateExportDeclaration` or the factory supplied by your transformation context instead. */
10899 const updateExportDeclaration: (node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, isTypeOnly: boolean) => ExportDeclaration;
10900 /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */
10901 const createJSDocParamTag: (name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocParameterTag;
10902 /** @deprecated Use `factory.createComma` or the factory supplied by your transformation context instead. */
10903 const createComma: (left: Expression, right: Expression) => Expression;
10904 /** @deprecated Use `factory.createLessThan` or the factory supplied by your transformation context instead. */
10905 const createLessThan: (left: Expression, right: Expression) => Expression;
10906 /** @deprecated Use `factory.createAssignment` or the factory supplied by your transformation context instead. */
10907 const createAssignment: (left: Expression, right: Expression) => BinaryExpression;
10908 /** @deprecated Use `factory.createStrictEquality` or the factory supplied by your transformation context instead. */
10909 const createStrictEquality: (left: Expression, right: Expression) => BinaryExpression;
10910 /** @deprecated Use `factory.createStrictInequality` or the factory supplied by your transformation context instead. */
10911 const createStrictInequality: (left: Expression, right: Expression) => BinaryExpression;
10912 /** @deprecated Use `factory.createAdd` or the factory supplied by your transformation context instead. */
10913 const createAdd: (left: Expression, right: Expression) => BinaryExpression;
10914 /** @deprecated Use `factory.createSubtract` or the factory supplied by your transformation context instead. */
10915 const createSubtract: (left: Expression, right: Expression) => BinaryExpression;
10916 /** @deprecated Use `factory.createLogicalAnd` or the factory supplied by your transformation context instead. */
10917 const createLogicalAnd: (left: Expression, right: Expression) => BinaryExpression;
10918 /** @deprecated Use `factory.createLogicalOr` or the factory supplied by your transformation context instead. */
10919 const createLogicalOr: (left: Expression, right: Expression) => BinaryExpression;
10920 /** @deprecated Use `factory.createPostfixIncrement` or the factory supplied by your transformation context instead. */
10921 const createPostfixIncrement: (operand: Expression) => PostfixUnaryExpression;
10922 /** @deprecated Use `factory.createLogicalNot` or the factory supplied by your transformation context instead. */
10923 const createLogicalNot: (operand: Expression) => PrefixUnaryExpression;
10924 /** @deprecated Use an appropriate `factory` method instead. */
10925 const createNode: (kind: SyntaxKind, pos?: any, end?: any) => Node;
10927 * Creates a shallow, memberwise clone of a node ~for mutation~ with its `pos`, `end`, and `parent` set.
10929 * NOTE: It is unsafe to change any properties of a `Node` that relate to its AST children, as those changes won't be
10930 * captured with respect to transformations.
10932 * @deprecated Use an appropriate `factory.update...` method instead, use `setCommentRange` or `setSourceMapRange`, and avoid setting `parent`.
10934 const getMutableClone: <T extends Node>(node: T) => T;
10935 /** @deprecated Use `isTypeAssertionExpression` instead. */
10936 const isTypeAssertion: (node: Node) => node is TypeAssertion;
10938 * @deprecated Use `ts.ReadonlyESMap<K, V>` instead.
10940 interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
10943 * @deprecated Use `ts.ESMap<K, V>` instead.
10945 interface Map<T> extends ESMap<string, T> {
10950 export as namespace ts;