UNPKG

419 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation. All rights reserved.
3Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4this file except in compliance with the License. You may obtain a copy of the
5License at http://www.apache.org/licenses/LICENSE-2.0
6
7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10MERCHANTABLITY OR NON-INFRINGEMENT.
11
12See the Apache Version 2.0 License for specific language governing permissions
13and limitations under the License.
14***************************************************************************** */
15
16declare namespace ts {
17 const versionMajorMinor = "3.5";
18 /** The version of the TypeScript compiler release */
19 const version: string;
20}
21declare namespace ts {
22 /**
23 * Type of objects whose values are all of the same type.
24 * The `in` and `for-in` operators can *not* be safely used,
25 * since `Object.prototype` may be modified by outside code.
26 */
27 interface MapLike<T> {
28 [index: string]: T;
29 }
30 interface SortedReadonlyArray<T> extends ReadonlyArray<T> {
31 " __sortedArrayBrand": any;
32 }
33 interface SortedArray<T> extends Array<T> {
34 " __sortedArrayBrand": any;
35 }
36 /** ES6 Map interface, only read methods included. */
37 interface ReadonlyMap<T> {
38 get(key: string): T | undefined;
39 has(key: string): boolean;
40 forEach(action: (value: T, key: string) => void): void;
41 readonly size: number;
42 keys(): Iterator<string>;
43 values(): Iterator<T>;
44 entries(): Iterator<[string, T]>;
45 }
46 /** ES6 Map interface. */
47 interface Map<T> extends ReadonlyMap<T> {
48 set(key: string, value: T): this;
49 delete(key: string): boolean;
50 clear(): void;
51 }
52 /** ES6 Iterator type. */
53 interface Iterator<T> {
54 next(): {
55 value: T;
56 done: false;
57 } | {
58 value: never;
59 done: true;
60 };
61 }
62 /** Array that is only intended to be pushed to, never read. */
63 interface Push<T> {
64 push(...values: T[]): void;
65 }
66}
67declare namespace ts {
68 type Path = string & {
69 __pathBrand: any;
70 };
71 interface TextRange {
72 pos: number;
73 end: number;
74 }
75 type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
76 type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword;
77 type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
78 enum SyntaxKind {
79 Unknown = 0,
80 EndOfFileToken = 1,
81 SingleLineCommentTrivia = 2,
82 MultiLineCommentTrivia = 3,
83 NewLineTrivia = 4,
84 WhitespaceTrivia = 5,
85 ShebangTrivia = 6,
86 ConflictMarkerTrivia = 7,
87 NumericLiteral = 8,
88 BigIntLiteral = 9,
89 StringLiteral = 10,
90 JsxText = 11,
91 JsxTextAllWhiteSpaces = 12,
92 RegularExpressionLiteral = 13,
93 NoSubstitutionTemplateLiteral = 14,
94 TemplateHead = 15,
95 TemplateMiddle = 16,
96 TemplateTail = 17,
97 OpenBraceToken = 18,
98 CloseBraceToken = 19,
99 OpenParenToken = 20,
100 CloseParenToken = 21,
101 OpenBracketToken = 22,
102 CloseBracketToken = 23,
103 DotToken = 24,
104 DotDotDotToken = 25,
105 SemicolonToken = 26,
106 CommaToken = 27,
107 LessThanToken = 28,
108 LessThanSlashToken = 29,
109 GreaterThanToken = 30,
110 LessThanEqualsToken = 31,
111 GreaterThanEqualsToken = 32,
112 EqualsEqualsToken = 33,
113 ExclamationEqualsToken = 34,
114 EqualsEqualsEqualsToken = 35,
115 ExclamationEqualsEqualsToken = 36,
116 EqualsGreaterThanToken = 37,
117 PlusToken = 38,
118 MinusToken = 39,
119 AsteriskToken = 40,
120 AsteriskAsteriskToken = 41,
121 SlashToken = 42,
122 PercentToken = 43,
123 PlusPlusToken = 44,
124 MinusMinusToken = 45,
125 LessThanLessThanToken = 46,
126 GreaterThanGreaterThanToken = 47,
127 GreaterThanGreaterThanGreaterThanToken = 48,
128 AmpersandToken = 49,
129 BarToken = 50,
130 CaretToken = 51,
131 ExclamationToken = 52,
132 TildeToken = 53,
133 AmpersandAmpersandToken = 54,
134 BarBarToken = 55,
135 QuestionToken = 56,
136 ColonToken = 57,
137 AtToken = 58,
138 /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
139 BacktickToken = 59,
140 EqualsToken = 60,
141 PlusEqualsToken = 61,
142 MinusEqualsToken = 62,
143 AsteriskEqualsToken = 63,
144 AsteriskAsteriskEqualsToken = 64,
145 SlashEqualsToken = 65,
146 PercentEqualsToken = 66,
147 LessThanLessThanEqualsToken = 67,
148 GreaterThanGreaterThanEqualsToken = 68,
149 GreaterThanGreaterThanGreaterThanEqualsToken = 69,
150 AmpersandEqualsToken = 70,
151 BarEqualsToken = 71,
152 CaretEqualsToken = 72,
153 Identifier = 73,
154 BreakKeyword = 74,
155 CaseKeyword = 75,
156 CatchKeyword = 76,
157 ClassKeyword = 77,
158 ConstKeyword = 78,
159 ContinueKeyword = 79,
160 DebuggerKeyword = 80,
161 DefaultKeyword = 81,
162 DeleteKeyword = 82,
163 DoKeyword = 83,
164 ElseKeyword = 84,
165 EnumKeyword = 85,
166 ExportKeyword = 86,
167 ExtendsKeyword = 87,
168 FalseKeyword = 88,
169 FinallyKeyword = 89,
170 ForKeyword = 90,
171 FunctionKeyword = 91,
172 IfKeyword = 92,
173 ImportKeyword = 93,
174 InKeyword = 94,
175 InstanceOfKeyword = 95,
176 NewKeyword = 96,
177 NullKeyword = 97,
178 ReturnKeyword = 98,
179 SuperKeyword = 99,
180 SwitchKeyword = 100,
181 ThisKeyword = 101,
182 ThrowKeyword = 102,
183 TrueKeyword = 103,
184 TryKeyword = 104,
185 TypeOfKeyword = 105,
186 VarKeyword = 106,
187 VoidKeyword = 107,
188 WhileKeyword = 108,
189 WithKeyword = 109,
190 ImplementsKeyword = 110,
191 InterfaceKeyword = 111,
192 LetKeyword = 112,
193 PackageKeyword = 113,
194 PrivateKeyword = 114,
195 ProtectedKeyword = 115,
196 PublicKeyword = 116,
197 StaticKeyword = 117,
198 YieldKeyword = 118,
199 AbstractKeyword = 119,
200 AsKeyword = 120,
201 AnyKeyword = 121,
202 AsyncKeyword = 122,
203 AwaitKeyword = 123,
204 BooleanKeyword = 124,
205 ConstructorKeyword = 125,
206 DeclareKeyword = 126,
207 GetKeyword = 127,
208 InferKeyword = 128,
209 IsKeyword = 129,
210 KeyOfKeyword = 130,
211 ModuleKeyword = 131,
212 NamespaceKeyword = 132,
213 NeverKeyword = 133,
214 ReadonlyKeyword = 134,
215 RequireKeyword = 135,
216 NumberKeyword = 136,
217 ObjectKeyword = 137,
218 SetKeyword = 138,
219 StringKeyword = 139,
220 SymbolKeyword = 140,
221 TypeKeyword = 141,
222 UndefinedKeyword = 142,
223 UniqueKeyword = 143,
224 UnknownKeyword = 144,
225 FromKeyword = 145,
226 GlobalKeyword = 146,
227 BigIntKeyword = 147,
228 OfKeyword = 148,
229 QualifiedName = 149,
230 ComputedPropertyName = 150,
231 TypeParameter = 151,
232 Parameter = 152,
233 Decorator = 153,
234 PropertySignature = 154,
235 PropertyDeclaration = 155,
236 MethodSignature = 156,
237 MethodDeclaration = 157,
238 Constructor = 158,
239 GetAccessor = 159,
240 SetAccessor = 160,
241 CallSignature = 161,
242 ConstructSignature = 162,
243 IndexSignature = 163,
244 TypePredicate = 164,
245 TypeReference = 165,
246 FunctionType = 166,
247 ConstructorType = 167,
248 TypeQuery = 168,
249 TypeLiteral = 169,
250 ArrayType = 170,
251 TupleType = 171,
252 OptionalType = 172,
253 RestType = 173,
254 UnionType = 174,
255 IntersectionType = 175,
256 ConditionalType = 176,
257 InferType = 177,
258 ParenthesizedType = 178,
259 ThisType = 179,
260 TypeOperator = 180,
261 IndexedAccessType = 181,
262 MappedType = 182,
263 LiteralType = 183,
264 ImportType = 184,
265 ObjectBindingPattern = 185,
266 ArrayBindingPattern = 186,
267 BindingElement = 187,
268 ArrayLiteralExpression = 188,
269 ObjectLiteralExpression = 189,
270 PropertyAccessExpression = 190,
271 ElementAccessExpression = 191,
272 CallExpression = 192,
273 NewExpression = 193,
274 TaggedTemplateExpression = 194,
275 TypeAssertionExpression = 195,
276 ParenthesizedExpression = 196,
277 FunctionExpression = 197,
278 ArrowFunction = 198,
279 DeleteExpression = 199,
280 TypeOfExpression = 200,
281 VoidExpression = 201,
282 AwaitExpression = 202,
283 PrefixUnaryExpression = 203,
284 PostfixUnaryExpression = 204,
285 BinaryExpression = 205,
286 ConditionalExpression = 206,
287 TemplateExpression = 207,
288 YieldExpression = 208,
289 SpreadElement = 209,
290 ClassExpression = 210,
291 OmittedExpression = 211,
292 ExpressionWithTypeArguments = 212,
293 AsExpression = 213,
294 NonNullExpression = 214,
295 MetaProperty = 215,
296 SyntheticExpression = 216,
297 TemplateSpan = 217,
298 SemicolonClassElement = 218,
299 Block = 219,
300 VariableStatement = 220,
301 EmptyStatement = 221,
302 ExpressionStatement = 222,
303 IfStatement = 223,
304 DoStatement = 224,
305 WhileStatement = 225,
306 ForStatement = 226,
307 ForInStatement = 227,
308 ForOfStatement = 228,
309 ContinueStatement = 229,
310 BreakStatement = 230,
311 ReturnStatement = 231,
312 WithStatement = 232,
313 SwitchStatement = 233,
314 LabeledStatement = 234,
315 ThrowStatement = 235,
316 TryStatement = 236,
317 DebuggerStatement = 237,
318 VariableDeclaration = 238,
319 VariableDeclarationList = 239,
320 FunctionDeclaration = 240,
321 ClassDeclaration = 241,
322 InterfaceDeclaration = 242,
323 TypeAliasDeclaration = 243,
324 EnumDeclaration = 244,
325 ModuleDeclaration = 245,
326 ModuleBlock = 246,
327 CaseBlock = 247,
328 NamespaceExportDeclaration = 248,
329 ImportEqualsDeclaration = 249,
330 ImportDeclaration = 250,
331 ImportClause = 251,
332 NamespaceImport = 252,
333 NamedImports = 253,
334 ImportSpecifier = 254,
335 ExportAssignment = 255,
336 ExportDeclaration = 256,
337 NamedExports = 257,
338 ExportSpecifier = 258,
339 MissingDeclaration = 259,
340 ExternalModuleReference = 260,
341 JsxElement = 261,
342 JsxSelfClosingElement = 262,
343 JsxOpeningElement = 263,
344 JsxClosingElement = 264,
345 JsxFragment = 265,
346 JsxOpeningFragment = 266,
347 JsxClosingFragment = 267,
348 JsxAttribute = 268,
349 JsxAttributes = 269,
350 JsxSpreadAttribute = 270,
351 JsxExpression = 271,
352 CaseClause = 272,
353 DefaultClause = 273,
354 HeritageClause = 274,
355 CatchClause = 275,
356 PropertyAssignment = 276,
357 ShorthandPropertyAssignment = 277,
358 SpreadAssignment = 278,
359 EnumMember = 279,
360 UnparsedPrologue = 280,
361 UnparsedPrepend = 281,
362 UnparsedText = 282,
363 UnparsedInternalText = 283,
364 UnparsedSyntheticReference = 284,
365 SourceFile = 285,
366 Bundle = 286,
367 UnparsedSource = 287,
368 InputFiles = 288,
369 JSDocTypeExpression = 289,
370 JSDocAllType = 290,
371 JSDocUnknownType = 291,
372 JSDocNullableType = 292,
373 JSDocNonNullableType = 293,
374 JSDocOptionalType = 294,
375 JSDocFunctionType = 295,
376 JSDocVariadicType = 296,
377 JSDocComment = 297,
378 JSDocTypeLiteral = 298,
379 JSDocSignature = 299,
380 JSDocTag = 300,
381 JSDocAugmentsTag = 301,
382 JSDocClassTag = 302,
383 JSDocCallbackTag = 303,
384 JSDocEnumTag = 304,
385 JSDocParameterTag = 305,
386 JSDocReturnTag = 306,
387 JSDocThisTag = 307,
388 JSDocTypeTag = 308,
389 JSDocTemplateTag = 309,
390 JSDocTypedefTag = 310,
391 JSDocPropertyTag = 311,
392 SyntaxList = 312,
393 NotEmittedStatement = 313,
394 PartiallyEmittedExpression = 314,
395 CommaListExpression = 315,
396 MergeDeclarationMarker = 316,
397 EndOfDeclarationMarker = 317,
398 Count = 318,
399 FirstAssignment = 60,
400 LastAssignment = 72,
401 FirstCompoundAssignment = 61,
402 LastCompoundAssignment = 72,
403 FirstReservedWord = 74,
404 LastReservedWord = 109,
405 FirstKeyword = 74,
406 LastKeyword = 148,
407 FirstFutureReservedWord = 110,
408 LastFutureReservedWord = 118,
409 FirstTypeNode = 164,
410 LastTypeNode = 184,
411 FirstPunctuation = 18,
412 LastPunctuation = 72,
413 FirstToken = 0,
414 LastToken = 148,
415 FirstTriviaToken = 2,
416 LastTriviaToken = 7,
417 FirstLiteralToken = 8,
418 LastLiteralToken = 14,
419 FirstTemplateToken = 14,
420 LastTemplateToken = 17,
421 FirstBinaryOperator = 28,
422 LastBinaryOperator = 72,
423 FirstNode = 149,
424 FirstJSDocNode = 289,
425 LastJSDocNode = 311,
426 FirstJSDocTagNode = 300,
427 LastJSDocTagNode = 311,
428 }
429 enum NodeFlags {
430 None = 0,
431 Let = 1,
432 Const = 2,
433 NestedNamespace = 4,
434 Synthesized = 8,
435 Namespace = 16,
436 ExportContext = 32,
437 ContainsThis = 64,
438 HasImplicitReturn = 128,
439 HasExplicitReturn = 256,
440 GlobalAugmentation = 512,
441 HasAsyncFunctions = 1024,
442 DisallowInContext = 2048,
443 YieldContext = 4096,
444 DecoratorContext = 8192,
445 AwaitContext = 16384,
446 ThisNodeHasError = 32768,
447 JavaScriptFile = 65536,
448 ThisNodeOrAnySubNodesHasError = 131072,
449 HasAggregatedChildData = 262144,
450 JSDoc = 2097152,
451 JsonFile = 16777216,
452 BlockScoped = 3,
453 ReachabilityCheckFlags = 384,
454 ReachabilityAndEmitFlags = 1408,
455 ContextFlags = 12679168,
456 TypeExcludesFlags = 20480,
457 }
458 enum ModifierFlags {
459 None = 0,
460 Export = 1,
461 Ambient = 2,
462 Public = 4,
463 Private = 8,
464 Protected = 16,
465 Static = 32,
466 Readonly = 64,
467 Abstract = 128,
468 Async = 256,
469 Default = 512,
470 Const = 2048,
471 HasComputedFlags = 536870912,
472 AccessibilityModifier = 28,
473 ParameterPropertyModifier = 92,
474 NonPublicAccessibilityModifier = 24,
475 TypeScriptModifier = 2270,
476 ExportDefault = 513,
477 All = 3071
478 }
479 enum JsxFlags {
480 None = 0,
481 /** An element from a named property of the JSX.IntrinsicElements interface */
482 IntrinsicNamedElement = 1,
483 /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
484 IntrinsicIndexedElement = 2,
485 IntrinsicElement = 3
486 }
487 interface Node extends TextRange {
488 kind: SyntaxKind;
489 flags: NodeFlags;
490 decorators?: NodeArray<Decorator>;
491 modifiers?: ModifiersArray;
492 parent: Node;
493 }
494 interface JSDocContainer {
495 }
496 type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | EndOfFileToken;
497 type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
498 type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
499 type HasExpressionInitializer = VariableDeclaration | ParameterDeclaration | BindingElement | PropertySignature | PropertyDeclaration | PropertyAssignment | EnumMember;
500 interface NodeArray<T extends Node> extends ReadonlyArray<T>, TextRange {
501 hasTrailingComma?: boolean;
502 }
503 interface Token<TKind extends SyntaxKind> extends Node {
504 kind: TKind;
505 }
506 type DotDotDotToken = Token<SyntaxKind.DotDotDotToken>;
507 type QuestionToken = Token<SyntaxKind.QuestionToken>;
508 type ExclamationToken = Token<SyntaxKind.ExclamationToken>;
509 type ColonToken = Token<SyntaxKind.ColonToken>;
510 type EqualsToken = Token<SyntaxKind.EqualsToken>;
511 type AsteriskToken = Token<SyntaxKind.AsteriskToken>;
512 type EqualsGreaterThanToken = Token<SyntaxKind.EqualsGreaterThanToken>;
513 type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & JSDocContainer;
514 type ReadonlyToken = Token<SyntaxKind.ReadonlyKeyword>;
515 type AwaitKeywordToken = Token<SyntaxKind.AwaitKeyword>;
516 type PlusToken = Token<SyntaxKind.PlusToken>;
517 type MinusToken = Token<SyntaxKind.MinusToken>;
518 type Modifier = Token<SyntaxKind.AbstractKeyword> | Token<SyntaxKind.AsyncKeyword> | Token<SyntaxKind.ConstKeyword> | Token<SyntaxKind.DeclareKeyword> | Token<SyntaxKind.DefaultKeyword> | Token<SyntaxKind.ExportKeyword> | Token<SyntaxKind.PublicKeyword> | Token<SyntaxKind.PrivateKeyword> | Token<SyntaxKind.ProtectedKeyword> | Token<SyntaxKind.ReadonlyKeyword> | Token<SyntaxKind.StaticKeyword>;
519 type ModifiersArray = NodeArray<Modifier>;
520 interface Identifier extends PrimaryExpression, Declaration {
521 kind: SyntaxKind.Identifier;
522 /**
523 * Prefer to use `id.unescapedText`. (Note: This is available only in services, not internally to the TypeScript compiler.)
524 * Text of identifier, but if the identifier begins with two underscores, this will begin with three.
525 */
526 escapedText: __String;
527 originalKeywordKind?: SyntaxKind;
528 isInJSDocNamespace?: boolean;
529 }
530 interface TransientIdentifier extends Identifier {
531 resolvedSymbol: Symbol;
532 }
533 interface QualifiedName extends Node {
534 kind: SyntaxKind.QualifiedName;
535 left: EntityName;
536 right: Identifier;
537 }
538 type EntityName = Identifier | QualifiedName;
539 type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
540 type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | BindingPattern;
541 interface Declaration extends Node {
542 _declarationBrand: any;
543 }
544 interface NamedDeclaration extends Declaration {
545 name?: DeclarationName;
546 }
547 interface DeclarationStatement extends NamedDeclaration, Statement {
548 name?: Identifier | StringLiteral | NumericLiteral;
549 }
550 interface ComputedPropertyName extends Node {
551 parent: Declaration;
552 kind: SyntaxKind.ComputedPropertyName;
553 expression: Expression;
554 }
555 interface Decorator extends Node {
556 kind: SyntaxKind.Decorator;
557 parent: NamedDeclaration;
558 expression: LeftHandSideExpression;
559 }
560 interface TypeParameterDeclaration extends NamedDeclaration {
561 kind: SyntaxKind.TypeParameter;
562 parent: DeclarationWithTypeParameterChildren | InferTypeNode;
563 name: Identifier;
564 /** Note: Consider calling `getEffectiveConstraintOfTypeParameter` */
565 constraint?: TypeNode;
566 default?: TypeNode;
567 expression?: Expression;
568 }
569 interface SignatureDeclarationBase extends NamedDeclaration, JSDocContainer {
570 kind: SignatureDeclaration["kind"];
571 name?: PropertyName;
572 typeParameters?: NodeArray<TypeParameterDeclaration>;
573 parameters: NodeArray<ParameterDeclaration>;
574 type?: TypeNode;
575 }
576 type SignatureDeclaration = CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction;
577 interface CallSignatureDeclaration extends SignatureDeclarationBase, TypeElement {
578 kind: SyntaxKind.CallSignature;
579 }
580 interface ConstructSignatureDeclaration extends SignatureDeclarationBase, TypeElement {
581 kind: SyntaxKind.ConstructSignature;
582 }
583 type BindingName = Identifier | BindingPattern;
584 interface VariableDeclaration extends NamedDeclaration {
585 kind: SyntaxKind.VariableDeclaration;
586 parent: VariableDeclarationList | CatchClause;
587 name: BindingName;
588 exclamationToken?: ExclamationToken;
589 type?: TypeNode;
590 initializer?: Expression;
591 }
592 interface VariableDeclarationList extends Node {
593 kind: SyntaxKind.VariableDeclarationList;
594 parent: VariableStatement | ForStatement | ForOfStatement | ForInStatement;
595 declarations: NodeArray<VariableDeclaration>;
596 }
597 interface ParameterDeclaration extends NamedDeclaration, JSDocContainer {
598 kind: SyntaxKind.Parameter;
599 parent: SignatureDeclaration;
600 dotDotDotToken?: DotDotDotToken;
601 name: BindingName;
602 questionToken?: QuestionToken;
603 type?: TypeNode;
604 initializer?: Expression;
605 }
606 interface BindingElement extends NamedDeclaration {
607 kind: SyntaxKind.BindingElement;
608 parent: BindingPattern;
609 propertyName?: PropertyName;
610 dotDotDotToken?: DotDotDotToken;
611 name: BindingName;
612 initializer?: Expression;
613 }
614 interface PropertySignature extends TypeElement, JSDocContainer {
615 kind: SyntaxKind.PropertySignature;
616 name: PropertyName;
617 questionToken?: QuestionToken;
618 type?: TypeNode;
619 initializer?: Expression;
620 }
621 interface PropertyDeclaration extends ClassElement, JSDocContainer {
622 kind: SyntaxKind.PropertyDeclaration;
623 parent: ClassLikeDeclaration;
624 name: PropertyName;
625 questionToken?: QuestionToken;
626 exclamationToken?: ExclamationToken;
627 type?: TypeNode;
628 initializer?: Expression;
629 }
630 interface ObjectLiteralElement extends NamedDeclaration {
631 _objectLiteralBrand: any;
632 name?: PropertyName;
633 }
634 /** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
635 type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
636 interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer {
637 parent: ObjectLiteralExpression;
638 kind: SyntaxKind.PropertyAssignment;
639 name: PropertyName;
640 questionToken?: QuestionToken;
641 initializer: Expression;
642 }
643 interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer {
644 parent: ObjectLiteralExpression;
645 kind: SyntaxKind.ShorthandPropertyAssignment;
646 name: Identifier;
647 questionToken?: QuestionToken;
648 exclamationToken?: ExclamationToken;
649 equalsToken?: Token<SyntaxKind.EqualsToken>;
650 objectAssignmentInitializer?: Expression;
651 }
652 interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer {
653 parent: ObjectLiteralExpression;
654 kind: SyntaxKind.SpreadAssignment;
655 expression: Expression;
656 }
657 type VariableLikeDeclaration = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertyAssignment | PropertySignature | JsxAttribute | ShorthandPropertyAssignment | EnumMember | JSDocPropertyTag | JSDocParameterTag;
658 interface PropertyLikeDeclaration extends NamedDeclaration {
659 name: PropertyName;
660 }
661 interface ObjectBindingPattern extends Node {
662 kind: SyntaxKind.ObjectBindingPattern;
663 parent: VariableDeclaration | ParameterDeclaration | BindingElement;
664 elements: NodeArray<BindingElement>;
665 }
666 interface ArrayBindingPattern extends Node {
667 kind: SyntaxKind.ArrayBindingPattern;
668 parent: VariableDeclaration | ParameterDeclaration | BindingElement;
669 elements: NodeArray<ArrayBindingElement>;
670 }
671 type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
672 type ArrayBindingElement = BindingElement | OmittedExpression;
673 /**
674 * Several node kinds share function-like features such as a signature,
675 * a name, and a body. These nodes should extend FunctionLikeDeclarationBase.
676 * Examples:
677 * - FunctionDeclaration
678 * - MethodDeclaration
679 * - AccessorDeclaration
680 */
681 interface FunctionLikeDeclarationBase extends SignatureDeclarationBase {
682 _functionLikeDeclarationBrand: any;
683 asteriskToken?: AsteriskToken;
684 questionToken?: QuestionToken;
685 exclamationToken?: ExclamationToken;
686 body?: Block | Expression;
687 }
688 type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
689 /** @deprecated Use SignatureDeclaration */
690 type FunctionLike = SignatureDeclaration;
691 interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement {
692 kind: SyntaxKind.FunctionDeclaration;
693 name?: Identifier;
694 body?: FunctionBody;
695 }
696 interface MethodSignature extends SignatureDeclarationBase, TypeElement {
697 kind: SyntaxKind.MethodSignature;
698 parent: ObjectTypeDeclaration;
699 name: PropertyName;
700 }
701 interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
702 kind: SyntaxKind.MethodDeclaration;
703 parent: ClassLikeDeclaration | ObjectLiteralExpression;
704 name: PropertyName;
705 body?: FunctionBody;
706 }
707 interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer {
708 kind: SyntaxKind.Constructor;
709 parent: ClassLikeDeclaration;
710 body?: FunctionBody;
711 }
712 /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
713 interface SemicolonClassElement extends ClassElement {
714 kind: SyntaxKind.SemicolonClassElement;
715 parent: ClassLikeDeclaration;
716 }
717 interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
718 kind: SyntaxKind.GetAccessor;
719 parent: ClassLikeDeclaration | ObjectLiteralExpression;
720 name: PropertyName;
721 body?: FunctionBody;
722 }
723 interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
724 kind: SyntaxKind.SetAccessor;
725 parent: ClassLikeDeclaration | ObjectLiteralExpression;
726 name: PropertyName;
727 body?: FunctionBody;
728 }
729 type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
730 interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement {
731 kind: SyntaxKind.IndexSignature;
732 parent: ObjectTypeDeclaration;
733 }
734 interface TypeNode extends Node {
735 _typeNodeBrand: any;
736 }
737 interface KeywordTypeNode extends TypeNode {
738 kind: SyntaxKind.AnyKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword;
739 }
740 interface ImportTypeNode extends NodeWithTypeArguments {
741 kind: SyntaxKind.ImportType;
742 isTypeOf?: boolean;
743 argument: TypeNode;
744 qualifier?: EntityName;
745 }
746 interface ThisTypeNode extends TypeNode {
747 kind: SyntaxKind.ThisType;
748 }
749 type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode;
750 interface FunctionOrConstructorTypeNodeBase extends TypeNode, SignatureDeclarationBase {
751 kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType;
752 type: TypeNode;
753 }
754 interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase {
755 kind: SyntaxKind.FunctionType;
756 }
757 interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase {
758 kind: SyntaxKind.ConstructorType;
759 }
760 interface NodeWithTypeArguments extends TypeNode {
761 typeArguments?: NodeArray<TypeNode>;
762 }
763 type TypeReferenceType = TypeReferenceNode | ExpressionWithTypeArguments;
764 interface TypeReferenceNode extends NodeWithTypeArguments {
765 kind: SyntaxKind.TypeReference;
766 typeName: EntityName;
767 }
768 interface TypePredicateNode extends TypeNode {
769 kind: SyntaxKind.TypePredicate;
770 parent: SignatureDeclaration | JSDocTypeExpression;
771 parameterName: Identifier | ThisTypeNode;
772 type: TypeNode;
773 }
774 interface TypeQueryNode extends TypeNode {
775 kind: SyntaxKind.TypeQuery;
776 exprName: EntityName;
777 }
778 interface TypeLiteralNode extends TypeNode, Declaration {
779 kind: SyntaxKind.TypeLiteral;
780 members: NodeArray<TypeElement>;
781 }
782 interface ArrayTypeNode extends TypeNode {
783 kind: SyntaxKind.ArrayType;
784 elementType: TypeNode;
785 }
786 interface TupleTypeNode extends TypeNode {
787 kind: SyntaxKind.TupleType;
788 elementTypes: NodeArray<TypeNode>;
789 }
790 interface OptionalTypeNode extends TypeNode {
791 kind: SyntaxKind.OptionalType;
792 type: TypeNode;
793 }
794 interface RestTypeNode extends TypeNode {
795 kind: SyntaxKind.RestType;
796 type: TypeNode;
797 }
798 type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode;
799 interface UnionTypeNode extends TypeNode {
800 kind: SyntaxKind.UnionType;
801 types: NodeArray<TypeNode>;
802 }
803 interface IntersectionTypeNode extends TypeNode {
804 kind: SyntaxKind.IntersectionType;
805 types: NodeArray<TypeNode>;
806 }
807 interface ConditionalTypeNode extends TypeNode {
808 kind: SyntaxKind.ConditionalType;
809 checkType: TypeNode;
810 extendsType: TypeNode;
811 trueType: TypeNode;
812 falseType: TypeNode;
813 }
814 interface InferTypeNode extends TypeNode {
815 kind: SyntaxKind.InferType;
816 typeParameter: TypeParameterDeclaration;
817 }
818 interface ParenthesizedTypeNode extends TypeNode {
819 kind: SyntaxKind.ParenthesizedType;
820 type: TypeNode;
821 }
822 interface TypeOperatorNode extends TypeNode {
823 kind: SyntaxKind.TypeOperator;
824 operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword;
825 type: TypeNode;
826 }
827 interface IndexedAccessTypeNode extends TypeNode {
828 kind: SyntaxKind.IndexedAccessType;
829 objectType: TypeNode;
830 indexType: TypeNode;
831 }
832 interface MappedTypeNode extends TypeNode, Declaration {
833 kind: SyntaxKind.MappedType;
834 readonlyToken?: ReadonlyToken | PlusToken | MinusToken;
835 typeParameter: TypeParameterDeclaration;
836 questionToken?: QuestionToken | PlusToken | MinusToken;
837 type?: TypeNode;
838 }
839 interface LiteralTypeNode extends TypeNode {
840 kind: SyntaxKind.LiteralType;
841 literal: BooleanLiteral | LiteralExpression | PrefixUnaryExpression;
842 }
843 interface StringLiteral extends LiteralExpression {
844 kind: SyntaxKind.StringLiteral;
845 }
846 type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
847 interface Expression extends Node {
848 _expressionBrand: any;
849 }
850 interface OmittedExpression extends Expression {
851 kind: SyntaxKind.OmittedExpression;
852 }
853 interface PartiallyEmittedExpression extends LeftHandSideExpression {
854 kind: SyntaxKind.PartiallyEmittedExpression;
855 expression: Expression;
856 }
857 interface UnaryExpression extends Expression {
858 _unaryExpressionBrand: any;
859 }
860 /** Deprecated, please use UpdateExpression */
861 type IncrementExpression = UpdateExpression;
862 interface UpdateExpression extends UnaryExpression {
863 _updateExpressionBrand: any;
864 }
865 type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken;
866 interface PrefixUnaryExpression extends UpdateExpression {
867 kind: SyntaxKind.PrefixUnaryExpression;
868 operator: PrefixUnaryOperator;
869 operand: UnaryExpression;
870 }
871 type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken;
872 interface PostfixUnaryExpression extends UpdateExpression {
873 kind: SyntaxKind.PostfixUnaryExpression;
874 operand: LeftHandSideExpression;
875 operator: PostfixUnaryOperator;
876 }
877 interface LeftHandSideExpression extends UpdateExpression {
878 _leftHandSideExpressionBrand: any;
879 }
880 interface MemberExpression extends LeftHandSideExpression {
881 _memberExpressionBrand: any;
882 }
883 interface PrimaryExpression extends MemberExpression {
884 _primaryExpressionBrand: any;
885 }
886 interface NullLiteral extends PrimaryExpression, TypeNode {
887 kind: SyntaxKind.NullKeyword;
888 }
889 interface BooleanLiteral extends PrimaryExpression, TypeNode {
890 kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword;
891 }
892 interface ThisExpression extends PrimaryExpression, KeywordTypeNode {
893 kind: SyntaxKind.ThisKeyword;
894 }
895 interface SuperExpression extends PrimaryExpression {
896 kind: SyntaxKind.SuperKeyword;
897 }
898 interface ImportExpression extends PrimaryExpression {
899 kind: SyntaxKind.ImportKeyword;
900 }
901 interface DeleteExpression extends UnaryExpression {
902 kind: SyntaxKind.DeleteExpression;
903 expression: UnaryExpression;
904 }
905 interface TypeOfExpression extends UnaryExpression {
906 kind: SyntaxKind.TypeOfExpression;
907 expression: UnaryExpression;
908 }
909 interface VoidExpression extends UnaryExpression {
910 kind: SyntaxKind.VoidExpression;
911 expression: UnaryExpression;
912 }
913 interface AwaitExpression extends UnaryExpression {
914 kind: SyntaxKind.AwaitExpression;
915 expression: UnaryExpression;
916 }
917 interface YieldExpression extends Expression {
918 kind: SyntaxKind.YieldExpression;
919 asteriskToken?: AsteriskToken;
920 expression?: Expression;
921 }
922 interface SyntheticExpression extends Expression {
923 kind: SyntaxKind.SyntheticExpression;
924 isSpread: boolean;
925 type: Type;
926 }
927 type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken;
928 type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken;
929 type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator;
930 type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken;
931 type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator;
932 type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken;
933 type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator;
934 type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword;
935 type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator;
936 type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken;
937 type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator;
938 type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken;
939 type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
940 type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
941 type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
942 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;
943 type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
944 type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator;
945 type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
946 type BinaryOperatorToken = Token<BinaryOperator>;
947 interface BinaryExpression extends Expression, Declaration {
948 kind: SyntaxKind.BinaryExpression;
949 left: Expression;
950 operatorToken: BinaryOperatorToken;
951 right: Expression;
952 }
953 type AssignmentOperatorToken = Token<AssignmentOperator>;
954 interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
955 left: LeftHandSideExpression;
956 operatorToken: TOperator;
957 }
958 interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
959 left: ObjectLiteralExpression;
960 }
961 interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
962 left: ArrayLiteralExpression;
963 }
964 type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
965 type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
966 type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
967 type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Identifier | PropertyAccessExpression | ElementAccessExpression | OmittedExpression;
968 type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
969 type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
970 type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
971 type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
972 interface ConditionalExpression extends Expression {
973 kind: SyntaxKind.ConditionalExpression;
974 condition: Expression;
975 questionToken: QuestionToken;
976 whenTrue: Expression;
977 colonToken: ColonToken;
978 whenFalse: Expression;
979 }
980 type FunctionBody = Block;
981 type ConciseBody = FunctionBody | Expression;
982 interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclarationBase, JSDocContainer {
983 kind: SyntaxKind.FunctionExpression;
984 name?: Identifier;
985 body: FunctionBody;
986 }
987 interface ArrowFunction extends Expression, FunctionLikeDeclarationBase, JSDocContainer {
988 kind: SyntaxKind.ArrowFunction;
989 equalsGreaterThanToken: EqualsGreaterThanToken;
990 body: ConciseBody;
991 name: never;
992 }
993 interface LiteralLikeNode extends Node {
994 text: string;
995 isUnterminated?: boolean;
996 hasExtendedUnicodeEscape?: boolean;
997 }
998 interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
999 _literalExpressionBrand: any;
1000 }
1001 interface RegularExpressionLiteral extends LiteralExpression {
1002 kind: SyntaxKind.RegularExpressionLiteral;
1003 }
1004 interface NoSubstitutionTemplateLiteral extends LiteralExpression {
1005 kind: SyntaxKind.NoSubstitutionTemplateLiteral;
1006 }
1007 enum TokenFlags {
1008 None = 0,
1009 Scientific = 16,
1010 Octal = 32,
1011 HexSpecifier = 64,
1012 BinarySpecifier = 128,
1013 OctalSpecifier = 256,
1014 }
1015 interface NumericLiteral extends LiteralExpression {
1016 kind: SyntaxKind.NumericLiteral;
1017 }
1018 interface BigIntLiteral extends LiteralExpression {
1019 kind: SyntaxKind.BigIntLiteral;
1020 }
1021 interface TemplateHead extends LiteralLikeNode {
1022 kind: SyntaxKind.TemplateHead;
1023 parent: TemplateExpression;
1024 }
1025 interface TemplateMiddle extends LiteralLikeNode {
1026 kind: SyntaxKind.TemplateMiddle;
1027 parent: TemplateSpan;
1028 }
1029 interface TemplateTail extends LiteralLikeNode {
1030 kind: SyntaxKind.TemplateTail;
1031 parent: TemplateSpan;
1032 }
1033 type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
1034 interface TemplateExpression extends PrimaryExpression {
1035 kind: SyntaxKind.TemplateExpression;
1036 head: TemplateHead;
1037 templateSpans: NodeArray<TemplateSpan>;
1038 }
1039 interface TemplateSpan extends Node {
1040 kind: SyntaxKind.TemplateSpan;
1041 parent: TemplateExpression;
1042 expression: Expression;
1043 literal: TemplateMiddle | TemplateTail;
1044 }
1045 interface ParenthesizedExpression extends PrimaryExpression, JSDocContainer {
1046 kind: SyntaxKind.ParenthesizedExpression;
1047 expression: Expression;
1048 }
1049 interface ArrayLiteralExpression extends PrimaryExpression {
1050 kind: SyntaxKind.ArrayLiteralExpression;
1051 elements: NodeArray<Expression>;
1052 }
1053 interface SpreadElement extends Expression {
1054 kind: SyntaxKind.SpreadElement;
1055 parent: ArrayLiteralExpression | CallExpression | NewExpression;
1056 expression: Expression;
1057 }
1058 /**
1059 * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to
1060 * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be
1061 * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type
1062 * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.)
1063 */
1064 interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration {
1065 properties: NodeArray<T>;
1066 }
1067 interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> {
1068 kind: SyntaxKind.ObjectLiteralExpression;
1069 }
1070 type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
1071 type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
1072 interface PropertyAccessExpression extends MemberExpression, NamedDeclaration {
1073 kind: SyntaxKind.PropertyAccessExpression;
1074 expression: LeftHandSideExpression;
1075 name: Identifier;
1076 }
1077 interface SuperPropertyAccessExpression extends PropertyAccessExpression {
1078 expression: SuperExpression;
1079 }
1080 /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */
1081 interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
1082 _propertyAccessExpressionLikeQualifiedNameBrand?: any;
1083 expression: EntityNameExpression;
1084 }
1085 interface ElementAccessExpression extends MemberExpression {
1086 kind: SyntaxKind.ElementAccessExpression;
1087 expression: LeftHandSideExpression;
1088 argumentExpression: Expression;
1089 }
1090 interface SuperElementAccessExpression extends ElementAccessExpression {
1091 expression: SuperExpression;
1092 }
1093 type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
1094 interface CallExpression extends LeftHandSideExpression, Declaration {
1095 kind: SyntaxKind.CallExpression;
1096 expression: LeftHandSideExpression;
1097 typeArguments?: NodeArray<TypeNode>;
1098 arguments: NodeArray<Expression>;
1099 }
1100 interface SuperCall extends CallExpression {
1101 expression: SuperExpression;
1102 }
1103 interface ImportCall extends CallExpression {
1104 expression: ImportExpression;
1105 }
1106 interface ExpressionWithTypeArguments extends NodeWithTypeArguments {
1107 kind: SyntaxKind.ExpressionWithTypeArguments;
1108 parent: HeritageClause | JSDocAugmentsTag;
1109 expression: LeftHandSideExpression;
1110 }
1111 interface NewExpression extends PrimaryExpression, Declaration {
1112 kind: SyntaxKind.NewExpression;
1113 expression: LeftHandSideExpression;
1114 typeArguments?: NodeArray<TypeNode>;
1115 arguments?: NodeArray<Expression>;
1116 }
1117 interface TaggedTemplateExpression extends MemberExpression {
1118 kind: SyntaxKind.TaggedTemplateExpression;
1119 tag: LeftHandSideExpression;
1120 typeArguments?: NodeArray<TypeNode>;
1121 template: TemplateLiteral;
1122 }
1123 type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;
1124 interface AsExpression extends Expression {
1125 kind: SyntaxKind.AsExpression;
1126 expression: Expression;
1127 type: TypeNode;
1128 }
1129 interface TypeAssertion extends UnaryExpression {
1130 kind: SyntaxKind.TypeAssertionExpression;
1131 type: TypeNode;
1132 expression: UnaryExpression;
1133 }
1134 type AssertionExpression = TypeAssertion | AsExpression;
1135 interface NonNullExpression extends LeftHandSideExpression {
1136 kind: SyntaxKind.NonNullExpression;
1137 expression: Expression;
1138 }
1139 interface MetaProperty extends PrimaryExpression {
1140 kind: SyntaxKind.MetaProperty;
1141 keywordToken: SyntaxKind.NewKeyword | SyntaxKind.ImportKeyword;
1142 name: Identifier;
1143 }
1144 interface JsxElement extends PrimaryExpression {
1145 kind: SyntaxKind.JsxElement;
1146 openingElement: JsxOpeningElement;
1147 children: NodeArray<JsxChild>;
1148 closingElement: JsxClosingElement;
1149 }
1150 type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
1151 type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
1152 type JsxTagNameExpression = Identifier | ThisExpression | JsxTagNamePropertyAccess;
1153 interface JsxTagNamePropertyAccess extends PropertyAccessExpression {
1154 expression: JsxTagNameExpression;
1155 }
1156 interface JsxAttributes extends ObjectLiteralExpressionBase<JsxAttributeLike> {
1157 parent: JsxOpeningLikeElement;
1158 }
1159 interface JsxOpeningElement extends Expression {
1160 kind: SyntaxKind.JsxOpeningElement;
1161 parent: JsxElement;
1162 tagName: JsxTagNameExpression;
1163 typeArguments?: NodeArray<TypeNode>;
1164 attributes: JsxAttributes;
1165 }
1166 interface JsxSelfClosingElement extends PrimaryExpression {
1167 kind: SyntaxKind.JsxSelfClosingElement;
1168 tagName: JsxTagNameExpression;
1169 typeArguments?: NodeArray<TypeNode>;
1170 attributes: JsxAttributes;
1171 }
1172 interface JsxFragment extends PrimaryExpression {
1173 kind: SyntaxKind.JsxFragment;
1174 openingFragment: JsxOpeningFragment;
1175 children: NodeArray<JsxChild>;
1176 closingFragment: JsxClosingFragment;
1177 }
1178 interface JsxOpeningFragment extends Expression {
1179 kind: SyntaxKind.JsxOpeningFragment;
1180 parent: JsxFragment;
1181 }
1182 interface JsxClosingFragment extends Expression {
1183 kind: SyntaxKind.JsxClosingFragment;
1184 parent: JsxFragment;
1185 }
1186 interface JsxAttribute extends ObjectLiteralElement {
1187 kind: SyntaxKind.JsxAttribute;
1188 parent: JsxAttributes;
1189 name: Identifier;
1190 initializer?: StringLiteral | JsxExpression;
1191 }
1192 interface JsxSpreadAttribute extends ObjectLiteralElement {
1193 kind: SyntaxKind.JsxSpreadAttribute;
1194 parent: JsxAttributes;
1195 expression: Expression;
1196 }
1197 interface JsxClosingElement extends Node {
1198 kind: SyntaxKind.JsxClosingElement;
1199 parent: JsxElement;
1200 tagName: JsxTagNameExpression;
1201 }
1202 interface JsxExpression extends Expression {
1203 kind: SyntaxKind.JsxExpression;
1204 parent: JsxElement | JsxAttributeLike;
1205 dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
1206 expression?: Expression;
1207 }
1208 interface JsxText extends LiteralLikeNode {
1209 kind: SyntaxKind.JsxText;
1210 containsOnlyTriviaWhiteSpaces: boolean;
1211 parent: JsxElement;
1212 }
1213 type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
1214 interface Statement extends Node {
1215 _statementBrand: any;
1216 }
1217 interface NotEmittedStatement extends Statement {
1218 kind: SyntaxKind.NotEmittedStatement;
1219 }
1220 /**
1221 * A list of comma-separated expressions. This node is only created by transformations.
1222 */
1223 interface CommaListExpression extends Expression {
1224 kind: SyntaxKind.CommaListExpression;
1225 elements: NodeArray<Expression>;
1226 }
1227 interface EmptyStatement extends Statement {
1228 kind: SyntaxKind.EmptyStatement;
1229 }
1230 interface DebuggerStatement extends Statement {
1231 kind: SyntaxKind.DebuggerStatement;
1232 }
1233 interface MissingDeclaration extends DeclarationStatement {
1234 kind: SyntaxKind.MissingDeclaration;
1235 name?: Identifier;
1236 }
1237 type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause;
1238 interface Block extends Statement {
1239 kind: SyntaxKind.Block;
1240 statements: NodeArray<Statement>;
1241 }
1242 interface VariableStatement extends Statement, JSDocContainer {
1243 kind: SyntaxKind.VariableStatement;
1244 declarationList: VariableDeclarationList;
1245 }
1246 interface ExpressionStatement extends Statement, JSDocContainer {
1247 kind: SyntaxKind.ExpressionStatement;
1248 expression: Expression;
1249 }
1250 interface IfStatement extends Statement {
1251 kind: SyntaxKind.IfStatement;
1252 expression: Expression;
1253 thenStatement: Statement;
1254 elseStatement?: Statement;
1255 }
1256 interface IterationStatement extends Statement {
1257 statement: Statement;
1258 }
1259 interface DoStatement extends IterationStatement {
1260 kind: SyntaxKind.DoStatement;
1261 expression: Expression;
1262 }
1263 interface WhileStatement extends IterationStatement {
1264 kind: SyntaxKind.WhileStatement;
1265 expression: Expression;
1266 }
1267 type ForInitializer = VariableDeclarationList | Expression;
1268 interface ForStatement extends IterationStatement {
1269 kind: SyntaxKind.ForStatement;
1270 initializer?: ForInitializer;
1271 condition?: Expression;
1272 incrementor?: Expression;
1273 }
1274 type ForInOrOfStatement = ForInStatement | ForOfStatement;
1275 interface ForInStatement extends IterationStatement {
1276 kind: SyntaxKind.ForInStatement;
1277 initializer: ForInitializer;
1278 expression: Expression;
1279 }
1280 interface ForOfStatement extends IterationStatement {
1281 kind: SyntaxKind.ForOfStatement;
1282 awaitModifier?: AwaitKeywordToken;
1283 initializer: ForInitializer;
1284 expression: Expression;
1285 }
1286 interface BreakStatement extends Statement {
1287 kind: SyntaxKind.BreakStatement;
1288 label?: Identifier;
1289 }
1290 interface ContinueStatement extends Statement {
1291 kind: SyntaxKind.ContinueStatement;
1292 label?: Identifier;
1293 }
1294 type BreakOrContinueStatement = BreakStatement | ContinueStatement;
1295 interface ReturnStatement extends Statement {
1296 kind: SyntaxKind.ReturnStatement;
1297 expression?: Expression;
1298 }
1299 interface WithStatement extends Statement {
1300 kind: SyntaxKind.WithStatement;
1301 expression: Expression;
1302 statement: Statement;
1303 }
1304 interface SwitchStatement extends Statement {
1305 kind: SyntaxKind.SwitchStatement;
1306 expression: Expression;
1307 caseBlock: CaseBlock;
1308 possiblyExhaustive?: boolean;
1309 }
1310 interface CaseBlock extends Node {
1311 kind: SyntaxKind.CaseBlock;
1312 parent: SwitchStatement;
1313 clauses: NodeArray<CaseOrDefaultClause>;
1314 }
1315 interface CaseClause extends Node {
1316 kind: SyntaxKind.CaseClause;
1317 parent: CaseBlock;
1318 expression: Expression;
1319 statements: NodeArray<Statement>;
1320 }
1321 interface DefaultClause extends Node {
1322 kind: SyntaxKind.DefaultClause;
1323 parent: CaseBlock;
1324 statements: NodeArray<Statement>;
1325 }
1326 type CaseOrDefaultClause = CaseClause | DefaultClause;
1327 interface LabeledStatement extends Statement, JSDocContainer {
1328 kind: SyntaxKind.LabeledStatement;
1329 label: Identifier;
1330 statement: Statement;
1331 }
1332 interface ThrowStatement extends Statement {
1333 kind: SyntaxKind.ThrowStatement;
1334 expression?: Expression;
1335 }
1336 interface TryStatement extends Statement {
1337 kind: SyntaxKind.TryStatement;
1338 tryBlock: Block;
1339 catchClause?: CatchClause;
1340 finallyBlock?: Block;
1341 }
1342 interface CatchClause extends Node {
1343 kind: SyntaxKind.CatchClause;
1344 parent: TryStatement;
1345 variableDeclaration?: VariableDeclaration;
1346 block: Block;
1347 }
1348 type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
1349 type DeclarationWithTypeParameters = DeclarationWithTypeParameterChildren | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature;
1350 type DeclarationWithTypeParameterChildren = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
1351 interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
1352 kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
1353 name?: Identifier;
1354 typeParameters?: NodeArray<TypeParameterDeclaration>;
1355 heritageClauses?: NodeArray<HeritageClause>;
1356 members: NodeArray<ClassElement>;
1357 }
1358 interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement {
1359 kind: SyntaxKind.ClassDeclaration;
1360 /** May be undefined in `export default class { ... }`. */
1361 name?: Identifier;
1362 }
1363 interface ClassExpression extends ClassLikeDeclarationBase, PrimaryExpression {
1364 kind: SyntaxKind.ClassExpression;
1365 }
1366 type ClassLikeDeclaration = ClassDeclaration | ClassExpression;
1367 interface ClassElement extends NamedDeclaration {
1368 _classElementBrand: any;
1369 name?: PropertyName;
1370 }
1371 interface TypeElement extends NamedDeclaration {
1372 _typeElementBrand: any;
1373 name?: PropertyName;
1374 questionToken?: QuestionToken;
1375 }
1376 interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer {
1377 kind: SyntaxKind.InterfaceDeclaration;
1378 name: Identifier;
1379 typeParameters?: NodeArray<TypeParameterDeclaration>;
1380 heritageClauses?: NodeArray<HeritageClause>;
1381 members: NodeArray<TypeElement>;
1382 }
1383 interface HeritageClause extends Node {
1384 kind: SyntaxKind.HeritageClause;
1385 parent: InterfaceDeclaration | ClassLikeDeclaration;
1386 token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword;
1387 types: NodeArray<ExpressionWithTypeArguments>;
1388 }
1389 interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer {
1390 kind: SyntaxKind.TypeAliasDeclaration;
1391 name: Identifier;
1392 typeParameters?: NodeArray<TypeParameterDeclaration>;
1393 type: TypeNode;
1394 }
1395 interface EnumMember extends NamedDeclaration, JSDocContainer {
1396 kind: SyntaxKind.EnumMember;
1397 parent: EnumDeclaration;
1398 name: PropertyName;
1399 initializer?: Expression;
1400 }
1401 interface EnumDeclaration extends DeclarationStatement, JSDocContainer {
1402 kind: SyntaxKind.EnumDeclaration;
1403 name: Identifier;
1404 members: NodeArray<EnumMember>;
1405 }
1406 type ModuleName = Identifier | StringLiteral;
1407 type ModuleBody = NamespaceBody | JSDocNamespaceBody;
1408 interface ModuleDeclaration extends DeclarationStatement, JSDocContainer {
1409 kind: SyntaxKind.ModuleDeclaration;
1410 parent: ModuleBody | SourceFile;
1411 name: ModuleName;
1412 body?: ModuleBody | JSDocNamespaceDeclaration;
1413 }
1414 type NamespaceBody = ModuleBlock | NamespaceDeclaration;
1415 interface NamespaceDeclaration extends ModuleDeclaration {
1416 name: Identifier;
1417 body: NamespaceBody;
1418 }
1419 type JSDocNamespaceBody = Identifier | JSDocNamespaceDeclaration;
1420 interface JSDocNamespaceDeclaration extends ModuleDeclaration {
1421 name: Identifier;
1422 body?: JSDocNamespaceBody;
1423 }
1424 interface ModuleBlock extends Node, Statement {
1425 kind: SyntaxKind.ModuleBlock;
1426 parent: ModuleDeclaration;
1427 statements: NodeArray<Statement>;
1428 }
1429 type ModuleReference = EntityName | ExternalModuleReference;
1430 /**
1431 * One of:
1432 * - import x = require("mod");
1433 * - import x = M.x;
1434 */
1435 interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer {
1436 kind: SyntaxKind.ImportEqualsDeclaration;
1437 parent: SourceFile | ModuleBlock;
1438 name: Identifier;
1439 moduleReference: ModuleReference;
1440 }
1441 interface ExternalModuleReference extends Node {
1442 kind: SyntaxKind.ExternalModuleReference;
1443 parent: ImportEqualsDeclaration;
1444 expression: Expression;
1445 }
1446 interface ImportDeclaration extends Statement {
1447 kind: SyntaxKind.ImportDeclaration;
1448 parent: SourceFile | ModuleBlock;
1449 importClause?: ImportClause;
1450 /** If this is not a StringLiteral it will be a grammar error. */
1451 moduleSpecifier: Expression;
1452 }
1453 type NamedImportBindings = NamespaceImport | NamedImports;
1454 interface ImportClause extends NamedDeclaration {
1455 kind: SyntaxKind.ImportClause;
1456 parent: ImportDeclaration;
1457 name?: Identifier;
1458 namedBindings?: NamedImportBindings;
1459 }
1460 interface NamespaceImport extends NamedDeclaration {
1461 kind: SyntaxKind.NamespaceImport;
1462 parent: ImportClause;
1463 name: Identifier;
1464 }
1465 interface NamespaceExportDeclaration extends DeclarationStatement {
1466 kind: SyntaxKind.NamespaceExportDeclaration;
1467 name: Identifier;
1468 }
1469 interface ExportDeclaration extends DeclarationStatement, JSDocContainer {
1470 kind: SyntaxKind.ExportDeclaration;
1471 parent: SourceFile | ModuleBlock;
1472 /** Will not be assigned in the case of `export * from "foo";` */
1473 exportClause?: NamedExports;
1474 /** If this is not a StringLiteral it will be a grammar error. */
1475 moduleSpecifier?: Expression;
1476 }
1477 interface NamedImports extends Node {
1478 kind: SyntaxKind.NamedImports;
1479 parent: ImportClause;
1480 elements: NodeArray<ImportSpecifier>;
1481 }
1482 interface NamedExports extends Node {
1483 kind: SyntaxKind.NamedExports;
1484 parent: ExportDeclaration;
1485 elements: NodeArray<ExportSpecifier>;
1486 }
1487 type NamedImportsOrExports = NamedImports | NamedExports;
1488 interface ImportSpecifier extends NamedDeclaration {
1489 kind: SyntaxKind.ImportSpecifier;
1490 parent: NamedImports;
1491 propertyName?: Identifier;
1492 name: Identifier;
1493 }
1494 interface ExportSpecifier extends NamedDeclaration {
1495 kind: SyntaxKind.ExportSpecifier;
1496 parent: NamedExports;
1497 propertyName?: Identifier;
1498 name: Identifier;
1499 }
1500 type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
1501 /**
1502 * This is either an `export =` or an `export default` declaration.
1503 * Unless `isExportEquals` is set, this node was parsed as an `export default`.
1504 */
1505 interface ExportAssignment extends DeclarationStatement {
1506 kind: SyntaxKind.ExportAssignment;
1507 parent: SourceFile;
1508 isExportEquals?: boolean;
1509 expression: Expression;
1510 }
1511 interface FileReference extends TextRange {
1512 fileName: string;
1513 }
1514 interface CheckJsDirective extends TextRange {
1515 enabled: boolean;
1516 }
1517 type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia;
1518 interface CommentRange extends TextRange {
1519 hasTrailingNewLine?: boolean;
1520 kind: CommentKind;
1521 }
1522 interface SynthesizedComment extends CommentRange {
1523 text: string;
1524 pos: -1;
1525 end: -1;
1526 }
1527 interface JSDocTypeExpression extends TypeNode {
1528 kind: SyntaxKind.JSDocTypeExpression;
1529 type: TypeNode;
1530 }
1531 interface JSDocType extends TypeNode {
1532 _jsDocTypeBrand: any;
1533 }
1534 interface JSDocAllType extends JSDocType {
1535 kind: SyntaxKind.JSDocAllType;
1536 }
1537 interface JSDocUnknownType extends JSDocType {
1538 kind: SyntaxKind.JSDocUnknownType;
1539 }
1540 interface JSDocNonNullableType extends JSDocType {
1541 kind: SyntaxKind.JSDocNonNullableType;
1542 type: TypeNode;
1543 }
1544 interface JSDocNullableType extends JSDocType {
1545 kind: SyntaxKind.JSDocNullableType;
1546 type: TypeNode;
1547 }
1548 interface JSDocOptionalType extends JSDocType {
1549 kind: SyntaxKind.JSDocOptionalType;
1550 type: TypeNode;
1551 }
1552 interface JSDocFunctionType extends JSDocType, SignatureDeclarationBase {
1553 kind: SyntaxKind.JSDocFunctionType;
1554 }
1555 interface JSDocVariadicType extends JSDocType {
1556 kind: SyntaxKind.JSDocVariadicType;
1557 type: TypeNode;
1558 }
1559 type JSDocTypeReferencingNode = JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
1560 interface JSDoc extends Node {
1561 kind: SyntaxKind.JSDocComment;
1562 parent: HasJSDoc;
1563 tags?: NodeArray<JSDocTag>;
1564 comment?: string;
1565 }
1566 interface JSDocTag extends Node {
1567 parent: JSDoc | JSDocTypeLiteral;
1568 tagName: Identifier;
1569 comment?: string;
1570 }
1571 interface JSDocUnknownTag extends JSDocTag {
1572 kind: SyntaxKind.JSDocTag;
1573 }
1574 /**
1575 * Note that `@extends` is a synonym of `@augments`.
1576 * Both tags are represented by this interface.
1577 */
1578 interface JSDocAugmentsTag extends JSDocTag {
1579 kind: SyntaxKind.JSDocAugmentsTag;
1580 class: ExpressionWithTypeArguments & {
1581 expression: Identifier | PropertyAccessEntityNameExpression;
1582 };
1583 }
1584 interface JSDocClassTag extends JSDocTag {
1585 kind: SyntaxKind.JSDocClassTag;
1586 }
1587 interface JSDocEnumTag extends JSDocTag {
1588 kind: SyntaxKind.JSDocEnumTag;
1589 typeExpression?: JSDocTypeExpression;
1590 }
1591 interface JSDocThisTag extends JSDocTag {
1592 kind: SyntaxKind.JSDocThisTag;
1593 typeExpression?: JSDocTypeExpression;
1594 }
1595 interface JSDocTemplateTag extends JSDocTag {
1596 kind: SyntaxKind.JSDocTemplateTag;
1597 constraint: JSDocTypeExpression | undefined;
1598 typeParameters: NodeArray<TypeParameterDeclaration>;
1599 }
1600 interface JSDocReturnTag extends JSDocTag {
1601 kind: SyntaxKind.JSDocReturnTag;
1602 typeExpression?: JSDocTypeExpression;
1603 }
1604 interface JSDocTypeTag extends JSDocTag {
1605 kind: SyntaxKind.JSDocTypeTag;
1606 typeExpression: JSDocTypeExpression;
1607 }
1608 interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
1609 parent: JSDoc;
1610 kind: SyntaxKind.JSDocTypedefTag;
1611 fullName?: JSDocNamespaceDeclaration | Identifier;
1612 name?: Identifier;
1613 typeExpression?: JSDocTypeExpression | JSDocTypeLiteral;
1614 }
1615 interface JSDocCallbackTag extends JSDocTag, NamedDeclaration {
1616 parent: JSDoc;
1617 kind: SyntaxKind.JSDocCallbackTag;
1618 fullName?: JSDocNamespaceDeclaration | Identifier;
1619 name?: Identifier;
1620 typeExpression: JSDocSignature;
1621 }
1622 interface JSDocSignature extends JSDocType, Declaration {
1623 kind: SyntaxKind.JSDocSignature;
1624 typeParameters?: ReadonlyArray<JSDocTemplateTag>;
1625 parameters: ReadonlyArray<JSDocParameterTag>;
1626 type: JSDocReturnTag | undefined;
1627 }
1628 interface JSDocPropertyLikeTag extends JSDocTag, Declaration {
1629 parent: JSDoc;
1630 name: EntityName;
1631 typeExpression?: JSDocTypeExpression;
1632 /** Whether the property name came before the type -- non-standard for JSDoc, but Typescript-like */
1633 isNameFirst: boolean;
1634 isBracketed: boolean;
1635 }
1636 interface JSDocPropertyTag extends JSDocPropertyLikeTag {
1637 kind: SyntaxKind.JSDocPropertyTag;
1638 }
1639 interface JSDocParameterTag extends JSDocPropertyLikeTag {
1640 kind: SyntaxKind.JSDocParameterTag;
1641 }
1642 interface JSDocTypeLiteral extends JSDocType {
1643 kind: SyntaxKind.JSDocTypeLiteral;
1644 jsDocPropertyTags?: ReadonlyArray<JSDocPropertyLikeTag>;
1645 /** If true, then this type literal represents an *array* of its type. */
1646 isArrayType?: boolean;
1647 }
1648 enum FlowFlags {
1649 Unreachable = 1,
1650 Start = 2,
1651 BranchLabel = 4,
1652 LoopLabel = 8,
1653 Assignment = 16,
1654 TrueCondition = 32,
1655 FalseCondition = 64,
1656 SwitchClause = 128,
1657 ArrayMutation = 256,
1658 Referenced = 512,
1659 Shared = 1024,
1660 PreFinally = 2048,
1661 AfterFinally = 4096,
1662 Label = 12,
1663 Condition = 96
1664 }
1665 interface FlowLock {
1666 locked?: boolean;
1667 }
1668 interface AfterFinallyFlow extends FlowNodeBase, FlowLock {
1669 antecedent: FlowNode;
1670 }
1671 interface PreFinallyFlow extends FlowNodeBase {
1672 antecedent: FlowNode;
1673 lock: FlowLock;
1674 }
1675 type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation;
1676 interface FlowNodeBase {
1677 flags: FlowFlags;
1678 id?: number;
1679 }
1680 interface FlowStart extends FlowNodeBase {
1681 container?: FunctionExpression | ArrowFunction | MethodDeclaration;
1682 }
1683 interface FlowLabel extends FlowNodeBase {
1684 antecedents: FlowNode[] | undefined;
1685 }
1686 interface FlowAssignment extends FlowNodeBase {
1687 node: Expression | VariableDeclaration | BindingElement;
1688 antecedent: FlowNode;
1689 }
1690 interface FlowCondition extends FlowNodeBase {
1691 expression: Expression;
1692 antecedent: FlowNode;
1693 }
1694 interface FlowSwitchClause extends FlowNodeBase {
1695 switchStatement: SwitchStatement;
1696 clauseStart: number;
1697 clauseEnd: number;
1698 antecedent: FlowNode;
1699 }
1700 interface FlowArrayMutation extends FlowNodeBase {
1701 node: CallExpression | BinaryExpression;
1702 antecedent: FlowNode;
1703 }
1704 type FlowType = Type | IncompleteType;
1705 interface IncompleteType {
1706 flags: TypeFlags;
1707 type: Type;
1708 }
1709 interface AmdDependency {
1710 path: string;
1711 name?: string;
1712 }
1713 interface SourceFile extends Declaration {
1714 kind: SyntaxKind.SourceFile;
1715 statements: NodeArray<Statement>;
1716 endOfFileToken: Token<SyntaxKind.EndOfFileToken>;
1717 fileName: string;
1718 text: string;
1719 amdDependencies: ReadonlyArray<AmdDependency>;
1720 moduleName?: string;
1721 referencedFiles: ReadonlyArray<FileReference>;
1722 typeReferenceDirectives: ReadonlyArray<FileReference>;
1723 libReferenceDirectives: ReadonlyArray<FileReference>;
1724 languageVariant: LanguageVariant;
1725 isDeclarationFile: boolean;
1726 /**
1727 * lib.d.ts should have a reference comment like
1728 *
1729 * /// <reference no-default-lib="true"/>
1730 *
1731 * If any other file has this comment, it signals not to include lib.d.ts
1732 * because this containing file is intended to act as a default library.
1733 */
1734 hasNoDefaultLib: boolean;
1735 languageVersion: ScriptTarget;
1736 }
1737 interface Bundle extends Node {
1738 kind: SyntaxKind.Bundle;
1739 prepends: ReadonlyArray<InputFiles | UnparsedSource>;
1740 sourceFiles: ReadonlyArray<SourceFile>;
1741 }
1742 interface InputFiles extends Node {
1743 kind: SyntaxKind.InputFiles;
1744 javascriptPath?: string;
1745 javascriptText: string;
1746 javascriptMapPath?: string;
1747 javascriptMapText?: string;
1748 declarationPath?: string;
1749 declarationText: string;
1750 declarationMapPath?: string;
1751 declarationMapText?: string;
1752 }
1753 interface UnparsedSource extends Node {
1754 kind: SyntaxKind.UnparsedSource;
1755 fileName: string;
1756 text: string;
1757 prologues: ReadonlyArray<UnparsedPrologue>;
1758 helpers: ReadonlyArray<UnscopedEmitHelper> | undefined;
1759 referencedFiles: ReadonlyArray<FileReference>;
1760 typeReferenceDirectives: ReadonlyArray<string> | undefined;
1761 libReferenceDirectives: ReadonlyArray<FileReference>;
1762 hasNoDefaultLib?: boolean;
1763 sourceMapPath?: string;
1764 sourceMapText?: string;
1765 syntheticReferences?: ReadonlyArray<UnparsedSyntheticReference>;
1766 texts: ReadonlyArray<UnparsedSourceText>;
1767 }
1768 type UnparsedSourceText = UnparsedPrepend | UnparsedTextLike;
1769 type UnparsedNode = UnparsedPrologue | UnparsedSourceText | UnparsedSyntheticReference;
1770 interface UnparsedSection extends Node {
1771 kind: SyntaxKind;
1772 data?: string;
1773 parent: UnparsedSource;
1774 }
1775 interface UnparsedPrologue extends UnparsedSection {
1776 kind: SyntaxKind.UnparsedPrologue;
1777 data: string;
1778 parent: UnparsedSource;
1779 }
1780 interface UnparsedPrepend extends UnparsedSection {
1781 kind: SyntaxKind.UnparsedPrepend;
1782 data: string;
1783 parent: UnparsedSource;
1784 texts: ReadonlyArray<UnparsedTextLike>;
1785 }
1786 interface UnparsedTextLike extends UnparsedSection {
1787 kind: SyntaxKind.UnparsedText | SyntaxKind.UnparsedInternalText;
1788 parent: UnparsedSource;
1789 }
1790 interface UnparsedSyntheticReference extends UnparsedSection {
1791 kind: SyntaxKind.UnparsedSyntheticReference;
1792 parent: UnparsedSource;
1793 }
1794 interface JsonSourceFile extends SourceFile {
1795 statements: NodeArray<JsonObjectExpressionStatement>;
1796 }
1797 interface TsConfigSourceFile extends JsonSourceFile {
1798 extendedSourceFiles?: string[];
1799 }
1800 interface JsonMinusNumericLiteral extends PrefixUnaryExpression {
1801 kind: SyntaxKind.PrefixUnaryExpression;
1802 operator: SyntaxKind.MinusToken;
1803 operand: NumericLiteral;
1804 }
1805 interface JsonObjectExpressionStatement extends ExpressionStatement {
1806 expression: ObjectLiteralExpression | ArrayLiteralExpression | JsonMinusNumericLiteral | NumericLiteral | StringLiteral | BooleanLiteral | NullLiteral;
1807 }
1808 interface ScriptReferenceHost {
1809 getCompilerOptions(): CompilerOptions;
1810 getSourceFile(fileName: string): SourceFile | undefined;
1811 getSourceFileByPath(path: Path): SourceFile | undefined;
1812 getCurrentDirectory(): string;
1813 }
1814 interface ParseConfigHost {
1815 useCaseSensitiveFileNames: boolean;
1816 readDirectory(rootDir: string, extensions: ReadonlyArray<string>, excludes: ReadonlyArray<string> | undefined, includes: ReadonlyArray<string>, depth?: number): ReadonlyArray<string>;
1817 /**
1818 * Gets a value indicating whether the specified path exists and is a file.
1819 * @param path The path to test.
1820 */
1821 fileExists(path: string): boolean;
1822 readFile(path: string): string | undefined;
1823 trace?(s: string): void;
1824 }
1825 /**
1826 * Branded string for keeping track of when we've turned an ambiguous path
1827 * specified like "./blah" to an absolute path to an actual
1828 * tsconfig file, e.g. "/root/blah/tsconfig.json"
1829 */
1830 type ResolvedConfigFileName = string & {
1831 _isResolvedConfigFileName: never;
1832 };
1833 type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: ReadonlyArray<SourceFile>) => void;
1834 class OperationCanceledException {
1835 }
1836 interface CancellationToken {
1837 isCancellationRequested(): boolean;
1838 /** @throws OperationCanceledException if isCancellationRequested is true */
1839 throwIfCancellationRequested(): void;
1840 }
1841 interface Program extends ScriptReferenceHost {
1842 /**
1843 * Get a list of root file names that were passed to a 'createProgram'
1844 */
1845 getRootFileNames(): ReadonlyArray<string>;
1846 /**
1847 * Get a list of files in the program
1848 */
1849 getSourceFiles(): ReadonlyArray<SourceFile>;
1850 /**
1851 * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
1852 * the JavaScript and declaration files will be produced for all the files in this program.
1853 * If targetSourceFile is specified, then only the JavaScript and declaration for that
1854 * specific file will be generated.
1855 *
1856 * If writeFile is not specified then the writeFile callback from the compiler host will be
1857 * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
1858 * will be invoked when writing the JavaScript and declaration files.
1859 */
1860 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
1861 getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
1862 getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
1863 getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
1864 /** The first time this is called, it will return global diagnostics (no location). */
1865 getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
1866 getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
1867 getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
1868 /**
1869 * Gets a type checker that can be used to semantically analyze source files in the program.
1870 */
1871 getTypeChecker(): TypeChecker;
1872 isSourceFileFromExternalLibrary(file: SourceFile): boolean;
1873 isSourceFileDefaultLibrary(file: SourceFile): boolean;
1874 getProjectReferences(): ReadonlyArray<ProjectReference> | undefined;
1875 getResolvedProjectReferences(): ReadonlyArray<ResolvedProjectReference | undefined> | undefined;
1876 }
1877 interface ResolvedProjectReference {
1878 commandLine: ParsedCommandLine;
1879 sourceFile: SourceFile;
1880 references?: ReadonlyArray<ResolvedProjectReference | undefined>;
1881 }
1882 type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer;
1883 interface CustomTransformer {
1884 transformSourceFile(node: SourceFile): SourceFile;
1885 transformBundle(node: Bundle): Bundle;
1886 }
1887 interface CustomTransformers {
1888 /** Custom transformers to evaluate before built-in .js transformations. */
1889 before?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
1890 /** Custom transformers to evaluate after built-in .js transformations. */
1891 after?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
1892 /** Custom transformers to evaluate after built-in .d.ts transformations. */
1893 afterDeclarations?: (TransformerFactory<Bundle | SourceFile> | CustomTransformerFactory)[];
1894 }
1895 interface SourceMapSpan {
1896 /** Line number in the .js file. */
1897 emittedLine: number;
1898 /** Column number in the .js file. */
1899 emittedColumn: number;
1900 /** Line number in the .ts file. */
1901 sourceLine: number;
1902 /** Column number in the .ts file. */
1903 sourceColumn: number;
1904 /** Optional name (index into names array) associated with this span. */
1905 nameIndex?: number;
1906 /** .ts file (index into sources array) associated with this span */
1907 sourceIndex: number;
1908 }
1909 /** Return code used by getEmitOutput function to indicate status of the function */
1910 enum ExitStatus {
1911 Success = 0,
1912 DiagnosticsPresent_OutputsSkipped = 1,
1913 DiagnosticsPresent_OutputsGenerated = 2
1914 }
1915 interface EmitResult {
1916 emitSkipped: boolean;
1917 /** Contains declaration emit diagnostics */
1918 diagnostics: ReadonlyArray<Diagnostic>;
1919 emittedFiles?: string[];
1920 }
1921 interface TypeChecker {
1922 getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
1923 getDeclaredTypeOfSymbol(symbol: Symbol): Type;
1924 getPropertiesOfType(type: Type): Symbol[];
1925 getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
1926 getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
1927 getSignaturesOfType(type: Type, kind: SignatureKind): ReadonlyArray<Signature>;
1928 getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
1929 getBaseTypes(type: InterfaceType): BaseType[];
1930 getBaseTypeOfLiteralType(type: Type): Type;
1931 getWidenedType(type: Type): Type;
1932 getReturnTypeOfSignature(signature: Signature): Type;
1933 getNullableType(type: Type, flags: TypeFlags): Type;
1934 getNonNullableType(type: Type): Type;
1935 /** Note that the resulting nodes cannot be checked. */
1936 typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
1937 /** Note that the resulting nodes cannot be checked. */
1938 signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & {
1939 typeArguments?: NodeArray<TypeNode>;
1940 }) | undefined;
1941 /** Note that the resulting nodes cannot be checked. */
1942 indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
1943 /** Note that the resulting nodes cannot be checked. */
1944 symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): EntityName | undefined;
1945 /** Note that the resulting nodes cannot be checked. */
1946 symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Expression | undefined;
1947 /** Note that the resulting nodes cannot be checked. */
1948 symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): NodeArray<TypeParameterDeclaration> | undefined;
1949 /** Note that the resulting nodes cannot be checked. */
1950 symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): ParameterDeclaration | undefined;
1951 /** Note that the resulting nodes cannot be checked. */
1952 typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeParameterDeclaration | undefined;
1953 getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
1954 getSymbolAtLocation(node: Node): Symbol | undefined;
1955 getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
1956 /**
1957 * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment.
1958 * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value.
1959 */
1960 getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
1961 getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined;
1962 /**
1963 * If a symbol is a local symbol with an associated exported symbol, returns the exported symbol.
1964 * Otherwise returns its input.
1965 * For example, at `export type T = number;`:
1966 * - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`.
1967 * - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol.
1968 * - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol.
1969 */
1970 getExportSymbolOfSymbol(symbol: Symbol): Symbol;
1971 getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
1972 getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type;
1973 getTypeAtLocation(node: Node): Type;
1974 getTypeFromTypeNode(node: TypeNode): Type;
1975 signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
1976 typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
1977 symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string;
1978 typePredicateToString(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
1979 getFullyQualifiedName(symbol: Symbol): string;
1980 getAugmentedPropertiesOfType(type: Type): Symbol[];
1981 getRootSymbols(symbol: Symbol): ReadonlyArray<Symbol>;
1982 getContextualType(node: Expression): Type | undefined;
1983 /**
1984 * returns unknownSignature in the case of an error.
1985 * returns undefined if the node is not valid.
1986 * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`.
1987 */
1988 getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined;
1989 getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined;
1990 isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined;
1991 isUndefinedSymbol(symbol: Symbol): boolean;
1992 isArgumentsSymbol(symbol: Symbol): boolean;
1993 isUnknownSymbol(symbol: Symbol): boolean;
1994 getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined;
1995 isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean;
1996 /** Follow all aliases to get the original symbol. */
1997 getAliasedSymbol(symbol: Symbol): Symbol;
1998 getExportsOfModule(moduleSymbol: Symbol): Symbol[];
1999 getJsxIntrinsicTagNamesAt(location: Node): Symbol[];
2000 isOptionalParameter(node: ParameterDeclaration): boolean;
2001 getAmbientModules(): Symbol[];
2002 tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
2003 getApparentType(type: Type): Type;
2004 getBaseConstraintOfType(type: Type): Type | undefined;
2005 getDefaultFromTypeParameter(type: Type): Type | undefined;
2006 /**
2007 * Depending on the operation performed, it may be appropriate to throw away the checker
2008 * if the cancellation token is triggered. Typically, if it is used for error checking
2009 * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep.
2010 */
2011 runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
2012 }
2013 enum NodeBuilderFlags {
2014 None = 0,
2015 NoTruncation = 1,
2016 WriteArrayAsGenericType = 2,
2017 GenerateNamesForShadowedTypeParams = 4,
2018 UseStructuralFallback = 8,
2019 ForbidIndexedAccessSymbolReferences = 16,
2020 WriteTypeArgumentsOfSignature = 32,
2021 UseFullyQualifiedType = 64,
2022 UseOnlyExternalAliasing = 128,
2023 SuppressAnyReturnType = 256,
2024 WriteTypeParametersInQualifiedName = 512,
2025 MultilineObjectLiterals = 1024,
2026 WriteClassExpressionAsTypeLiteral = 2048,
2027 UseTypeOfFunction = 4096,
2028 OmitParameterModifiers = 8192,
2029 UseAliasDefinedOutsideCurrentScope = 16384,
2030 AllowThisInObjectLiteral = 32768,
2031 AllowQualifedNameInPlaceOfIdentifier = 65536,
2032 AllowAnonymousIdentifier = 131072,
2033 AllowEmptyUnionOrIntersection = 262144,
2034 AllowEmptyTuple = 524288,
2035 AllowUniqueESSymbolType = 1048576,
2036 AllowEmptyIndexInfoType = 2097152,
2037 AllowNodeModulesRelativePaths = 67108864,
2038 IgnoreErrors = 70221824,
2039 InObjectTypeLiteral = 4194304,
2040 InTypeAlias = 8388608,
2041 InInitialEntityName = 16777216,
2042 InReverseMappedType = 33554432
2043 }
2044 enum TypeFormatFlags {
2045 None = 0,
2046 NoTruncation = 1,
2047 WriteArrayAsGenericType = 2,
2048 UseStructuralFallback = 8,
2049 WriteTypeArgumentsOfSignature = 32,
2050 UseFullyQualifiedType = 64,
2051 SuppressAnyReturnType = 256,
2052 MultilineObjectLiterals = 1024,
2053 WriteClassExpressionAsTypeLiteral = 2048,
2054 UseTypeOfFunction = 4096,
2055 OmitParameterModifiers = 8192,
2056 UseAliasDefinedOutsideCurrentScope = 16384,
2057 AllowUniqueESSymbolType = 1048576,
2058 AddUndefined = 131072,
2059 WriteArrowStyleSignature = 262144,
2060 InArrayType = 524288,
2061 InElementType = 2097152,
2062 InFirstTypeArgument = 4194304,
2063 InTypeAlias = 8388608,
2064 /** @deprecated */ WriteOwnNameForAnyLike = 0,
2065 NodeBuilderFlagsMask = 9469291
2066 }
2067 enum SymbolFormatFlags {
2068 None = 0,
2069 WriteTypeParametersOrArguments = 1,
2070 UseOnlyExternalAliasing = 2,
2071 AllowAnyNodeKind = 4,
2072 UseAliasDefinedOutsideCurrentScope = 8,
2073 }
2074 enum TypePredicateKind {
2075 This = 0,
2076 Identifier = 1
2077 }
2078 interface TypePredicateBase {
2079 kind: TypePredicateKind;
2080 type: Type;
2081 }
2082 interface ThisTypePredicate extends TypePredicateBase {
2083 kind: TypePredicateKind.This;
2084 }
2085 interface IdentifierTypePredicate extends TypePredicateBase {
2086 kind: TypePredicateKind.Identifier;
2087 parameterName: string;
2088 parameterIndex: number;
2089 }
2090 type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
2091 enum SymbolFlags {
2092 None = 0,
2093 FunctionScopedVariable = 1,
2094 BlockScopedVariable = 2,
2095 Property = 4,
2096 EnumMember = 8,
2097 Function = 16,
2098 Class = 32,
2099 Interface = 64,
2100 ConstEnum = 128,
2101 RegularEnum = 256,
2102 ValueModule = 512,
2103 NamespaceModule = 1024,
2104 TypeLiteral = 2048,
2105 ObjectLiteral = 4096,
2106 Method = 8192,
2107 Constructor = 16384,
2108 GetAccessor = 32768,
2109 SetAccessor = 65536,
2110 Signature = 131072,
2111 TypeParameter = 262144,
2112 TypeAlias = 524288,
2113 ExportValue = 1048576,
2114 Alias = 2097152,
2115 Prototype = 4194304,
2116 ExportStar = 8388608,
2117 Optional = 16777216,
2118 Transient = 33554432,
2119 Assignment = 67108864,
2120 ModuleExports = 134217728,
2121 Enum = 384,
2122 Variable = 3,
2123 Value = 67220415,
2124 Type = 67897832,
2125 Namespace = 1920,
2126 Module = 1536,
2127 Accessor = 98304,
2128 FunctionScopedVariableExcludes = 67220414,
2129 BlockScopedVariableExcludes = 67220415,
2130 ParameterExcludes = 67220415,
2131 PropertyExcludes = 0,
2132 EnumMemberExcludes = 68008959,
2133 FunctionExcludes = 67219887,
2134 ClassExcludes = 68008383,
2135 InterfaceExcludes = 67897736,
2136 RegularEnumExcludes = 68008191,
2137 ConstEnumExcludes = 68008831,
2138 ValueModuleExcludes = 110735,
2139 NamespaceModuleExcludes = 0,
2140 MethodExcludes = 67212223,
2141 GetAccessorExcludes = 67154879,
2142 SetAccessorExcludes = 67187647,
2143 TypeParameterExcludes = 67635688,
2144 TypeAliasExcludes = 67897832,
2145 AliasExcludes = 2097152,
2146 ModuleMember = 2623475,
2147 ExportHasLocal = 944,
2148 BlockScoped = 418,
2149 PropertyOrAccessor = 98308,
2150 ClassMember = 106500,
2151 }
2152 interface Symbol {
2153 flags: SymbolFlags;
2154 escapedName: __String;
2155 declarations: Declaration[];
2156 valueDeclaration: Declaration;
2157 members?: SymbolTable;
2158 exports?: SymbolTable;
2159 globalExports?: SymbolTable;
2160 }
2161 enum InternalSymbolName {
2162 Call = "__call",
2163 Constructor = "__constructor",
2164 New = "__new",
2165 Index = "__index",
2166 ExportStar = "__export",
2167 Global = "__global",
2168 Missing = "__missing",
2169 Type = "__type",
2170 Object = "__object",
2171 JSXAttributes = "__jsxAttributes",
2172 Class = "__class",
2173 Function = "__function",
2174 Computed = "__computed",
2175 Resolving = "__resolving__",
2176 ExportEquals = "export=",
2177 Default = "default",
2178 This = "this"
2179 }
2180 /**
2181 * This represents a string whose leading underscore have been escaped by adding extra leading underscores.
2182 * The shape of this brand is rather unique compared to others we've used.
2183 * Instead of just an intersection of a string and an object, it is that union-ed
2184 * with an intersection of void and an object. This makes it wholly incompatible
2185 * with a normal string (which is good, it cannot be misused on assignment or on usage),
2186 * while still being comparable with a normal string via === (also good) and castable from a string.
2187 */
2188 type __String = (string & {
2189 __escapedIdentifier: void;
2190 }) | (void & {
2191 __escapedIdentifier: void;
2192 }) | InternalSymbolName;
2193 /** ReadonlyMap where keys are `__String`s. */
2194 interface ReadonlyUnderscoreEscapedMap<T> {
2195 get(key: __String): T | undefined;
2196 has(key: __String): boolean;
2197 forEach(action: (value: T, key: __String) => void): void;
2198 readonly size: number;
2199 keys(): Iterator<__String>;
2200 values(): Iterator<T>;
2201 entries(): Iterator<[__String, T]>;
2202 }
2203 /** Map where keys are `__String`s. */
2204 interface UnderscoreEscapedMap<T> extends ReadonlyUnderscoreEscapedMap<T> {
2205 set(key: __String, value: T): this;
2206 delete(key: __String): boolean;
2207 clear(): void;
2208 }
2209 /** SymbolTable based on ES6 Map interface. */
2210 type SymbolTable = UnderscoreEscapedMap<Symbol>;
2211 enum TypeFlags {
2212 Any = 1,
2213 Unknown = 2,
2214 String = 4,
2215 Number = 8,
2216 Boolean = 16,
2217 Enum = 32,
2218 BigInt = 64,
2219 StringLiteral = 128,
2220 NumberLiteral = 256,
2221 BooleanLiteral = 512,
2222 EnumLiteral = 1024,
2223 BigIntLiteral = 2048,
2224 ESSymbol = 4096,
2225 UniqueESSymbol = 8192,
2226 Void = 16384,
2227 Undefined = 32768,
2228 Null = 65536,
2229 Never = 131072,
2230 TypeParameter = 262144,
2231 Object = 524288,
2232 Union = 1048576,
2233 Intersection = 2097152,
2234 Index = 4194304,
2235 IndexedAccess = 8388608,
2236 Conditional = 16777216,
2237 Substitution = 33554432,
2238 NonPrimitive = 67108864,
2239 Literal = 2944,
2240 Unit = 109440,
2241 StringOrNumberLiteral = 384,
2242 PossiblyFalsy = 117724,
2243 StringLike = 132,
2244 NumberLike = 296,
2245 BigIntLike = 2112,
2246 BooleanLike = 528,
2247 EnumLike = 1056,
2248 ESSymbolLike = 12288,
2249 VoidLike = 49152,
2250 UnionOrIntersection = 3145728,
2251 StructuredType = 3670016,
2252 TypeVariable = 8650752,
2253 InstantiableNonPrimitive = 58982400,
2254 InstantiablePrimitive = 4194304,
2255 Instantiable = 63176704,
2256 StructuredOrInstantiable = 66846720,
2257 Narrowable = 133970943,
2258 NotUnionOrUnit = 67637251,
2259 }
2260 type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
2261 interface Type {
2262 flags: TypeFlags;
2263 symbol: Symbol;
2264 pattern?: DestructuringPattern;
2265 aliasSymbol?: Symbol;
2266 aliasTypeArguments?: ReadonlyArray<Type>;
2267 }
2268 interface LiteralType extends Type {
2269 value: string | number | PseudoBigInt;
2270 freshType: LiteralType;
2271 regularType: LiteralType;
2272 }
2273 interface UniqueESSymbolType extends Type {
2274 symbol: Symbol;
2275 escapedName: __String;
2276 }
2277 interface StringLiteralType extends LiteralType {
2278 value: string;
2279 }
2280 interface NumberLiteralType extends LiteralType {
2281 value: number;
2282 }
2283 interface BigIntLiteralType extends LiteralType {
2284 value: PseudoBigInt;
2285 }
2286 interface EnumType extends Type {
2287 }
2288 enum ObjectFlags {
2289 Class = 1,
2290 Interface = 2,
2291 Reference = 4,
2292 Tuple = 8,
2293 Anonymous = 16,
2294 Mapped = 32,
2295 Instantiated = 64,
2296 ObjectLiteral = 128,
2297 EvolvingArray = 256,
2298 ObjectLiteralPatternWithComputedProperties = 512,
2299 ContainsSpread = 1024,
2300 ReverseMapped = 2048,
2301 JsxAttributes = 4096,
2302 MarkerType = 8192,
2303 JSLiteral = 16384,
2304 FreshLiteral = 32768,
2305 ClassOrInterface = 3,
2306 }
2307 interface ObjectType extends Type {
2308 objectFlags: ObjectFlags;
2309 }
2310 /** Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). */
2311 interface InterfaceType extends ObjectType {
2312 typeParameters: TypeParameter[] | undefined;
2313 outerTypeParameters: TypeParameter[] | undefined;
2314 localTypeParameters: TypeParameter[] | undefined;
2315 thisType: TypeParameter | undefined;
2316 }
2317 type BaseType = ObjectType | IntersectionType;
2318 interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
2319 declaredProperties: Symbol[];
2320 declaredCallSignatures: Signature[];
2321 declaredConstructSignatures: Signature[];
2322 declaredStringIndexInfo?: IndexInfo;
2323 declaredNumberIndexInfo?: IndexInfo;
2324 }
2325 /**
2326 * Type references (ObjectFlags.Reference). When a class or interface has type parameters or
2327 * a "this" type, references to the class or interface are made using type references. The
2328 * typeArguments property specifies the types to substitute for the type parameters of the
2329 * class or interface and optionally includes an extra element that specifies the type to
2330 * substitute for "this" in the resulting instantiation. When no extra argument is present,
2331 * the type reference itself is substituted for "this". The typeArguments property is undefined
2332 * if the class or interface has no type parameters and the reference isn't specifying an
2333 * explicit "this" argument.
2334 */
2335 interface TypeReference extends ObjectType {
2336 target: GenericType;
2337 typeArguments?: ReadonlyArray<Type>;
2338 }
2339 interface GenericType extends InterfaceType, TypeReference {
2340 }
2341 interface TupleType extends GenericType {
2342 minLength: number;
2343 hasRestElement: boolean;
2344 readonly: boolean;
2345 associatedNames?: __String[];
2346 }
2347 interface TupleTypeReference extends TypeReference {
2348 target: TupleType;
2349 }
2350 interface UnionOrIntersectionType extends Type {
2351 types: Type[];
2352 }
2353 interface UnionType extends UnionOrIntersectionType {
2354 }
2355 interface IntersectionType extends UnionOrIntersectionType {
2356 }
2357 type StructuredType = ObjectType | UnionType | IntersectionType;
2358 interface EvolvingArrayType extends ObjectType {
2359 elementType: Type;
2360 finalArrayType?: Type;
2361 }
2362 interface InstantiableType extends Type {
2363 }
2364 interface TypeParameter extends InstantiableType {
2365 }
2366 interface IndexedAccessType extends InstantiableType {
2367 objectType: Type;
2368 indexType: Type;
2369 constraint?: Type;
2370 simplifiedForReading?: Type;
2371 simplifiedForWriting?: Type;
2372 }
2373 type TypeVariable = TypeParameter | IndexedAccessType;
2374 interface IndexType extends InstantiableType {
2375 type: InstantiableType | UnionOrIntersectionType;
2376 }
2377 interface ConditionalRoot {
2378 node: ConditionalTypeNode;
2379 checkType: Type;
2380 extendsType: Type;
2381 trueType: Type;
2382 falseType: Type;
2383 isDistributive: boolean;
2384 inferTypeParameters?: TypeParameter[];
2385 outerTypeParameters?: TypeParameter[];
2386 instantiations?: Map<Type>;
2387 aliasSymbol?: Symbol;
2388 aliasTypeArguments?: Type[];
2389 }
2390 interface ConditionalType extends InstantiableType {
2391 root: ConditionalRoot;
2392 checkType: Type;
2393 extendsType: Type;
2394 resolvedTrueType: Type;
2395 resolvedFalseType: Type;
2396 }
2397 interface SubstitutionType extends InstantiableType {
2398 typeVariable: TypeVariable;
2399 substitute: Type;
2400 }
2401 enum SignatureKind {
2402 Call = 0,
2403 Construct = 1
2404 }
2405 interface Signature {
2406 declaration?: SignatureDeclaration | JSDocSignature;
2407 typeParameters?: ReadonlyArray<TypeParameter>;
2408 parameters: ReadonlyArray<Symbol>;
2409 }
2410 enum IndexKind {
2411 String = 0,
2412 Number = 1
2413 }
2414 interface IndexInfo {
2415 type: Type;
2416 isReadonly: boolean;
2417 declaration?: IndexSignatureDeclaration;
2418 }
2419 enum InferencePriority {
2420 NakedTypeVariable = 1,
2421 HomomorphicMappedType = 2,
2422 PartialHomomorphicMappedType = 4,
2423 MappedTypeConstraint = 8,
2424 ReturnType = 16,
2425 LiteralKeyof = 32,
2426 NoConstraints = 64,
2427 AlwaysStrict = 128,
2428 PriorityImpliesCombination = 56
2429 }
2430 /** @deprecated Use FileExtensionInfo instead. */
2431 type JsFileExtensionInfo = FileExtensionInfo;
2432 interface FileExtensionInfo {
2433 extension: string;
2434 isMixedContent: boolean;
2435 scriptKind?: ScriptKind;
2436 }
2437 interface DiagnosticMessage {
2438 key: string;
2439 category: DiagnosticCategory;
2440 code: number;
2441 message: string;
2442 reportsUnnecessary?: {};
2443 }
2444 /**
2445 * A linked list of formatted diagnostic messages to be used as part of a multiline message.
2446 * It is built from the bottom up, leaving the head to be the "main" diagnostic.
2447 * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
2448 * the difference is that messages are all preformatted in DMC.
2449 */
2450 interface DiagnosticMessageChain {
2451 messageText: string;
2452 category: DiagnosticCategory;
2453 code: number;
2454 next?: DiagnosticMessageChain;
2455 }
2456 interface Diagnostic extends DiagnosticRelatedInformation {
2457 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
2458 reportsUnnecessary?: {};
2459 source?: string;
2460 relatedInformation?: DiagnosticRelatedInformation[];
2461 }
2462 interface DiagnosticRelatedInformation {
2463 category: DiagnosticCategory;
2464 code: number;
2465 file: SourceFile | undefined;
2466 start: number | undefined;
2467 length: number | undefined;
2468 messageText: string | DiagnosticMessageChain;
2469 }
2470 interface DiagnosticWithLocation extends Diagnostic {
2471 file: SourceFile;
2472 start: number;
2473 length: number;
2474 }
2475 enum DiagnosticCategory {
2476 Warning = 0,
2477 Error = 1,
2478 Suggestion = 2,
2479 Message = 3
2480 }
2481 enum ModuleResolutionKind {
2482 Classic = 1,
2483 NodeJs = 2
2484 }
2485 interface PluginImport {
2486 name: string;
2487 }
2488 interface ProjectReference {
2489 /** A normalized path on disk */
2490 path: string;
2491 /** The path as the user originally wrote it */
2492 originalPath?: string;
2493 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
2494 prepend?: boolean;
2495 /** True if it is intended that this reference form a circularity */
2496 circular?: boolean;
2497 }
2498 type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined;
2499 interface CompilerOptions {
2500 allowJs?: boolean;
2501 allowSyntheticDefaultImports?: boolean;
2502 allowUmdGlobalAccess?: boolean;
2503 allowUnreachableCode?: boolean;
2504 allowUnusedLabels?: boolean;
2505 alwaysStrict?: boolean;
2506 baseUrl?: string;
2507 charset?: string;
2508 checkJs?: boolean;
2509 declaration?: boolean;
2510 declarationMap?: boolean;
2511 emitDeclarationOnly?: boolean;
2512 declarationDir?: string;
2513 disableSizeLimit?: boolean;
2514 downlevelIteration?: boolean;
2515 emitBOM?: boolean;
2516 emitDecoratorMetadata?: boolean;
2517 experimentalDecorators?: boolean;
2518 forceConsistentCasingInFileNames?: boolean;
2519 importHelpers?: boolean;
2520 inlineSourceMap?: boolean;
2521 inlineSources?: boolean;
2522 isolatedModules?: boolean;
2523 jsx?: JsxEmit;
2524 keyofStringsOnly?: boolean;
2525 lib?: string[];
2526 locale?: string;
2527 mapRoot?: string;
2528 maxNodeModuleJsDepth?: number;
2529 module?: ModuleKind;
2530 moduleResolution?: ModuleResolutionKind;
2531 newLine?: NewLineKind;
2532 noEmit?: boolean;
2533 noEmitHelpers?: boolean;
2534 noEmitOnError?: boolean;
2535 noErrorTruncation?: boolean;
2536 noFallthroughCasesInSwitch?: boolean;
2537 noImplicitAny?: boolean;
2538 noImplicitReturns?: boolean;
2539 noImplicitThis?: boolean;
2540 noStrictGenericChecks?: boolean;
2541 noUnusedLocals?: boolean;
2542 noUnusedParameters?: boolean;
2543 noImplicitUseStrict?: boolean;
2544 noLib?: boolean;
2545 noResolve?: boolean;
2546 out?: string;
2547 outDir?: string;
2548 outFile?: string;
2549 paths?: MapLike<string[]>;
2550 preserveConstEnums?: boolean;
2551 preserveSymlinks?: boolean;
2552 project?: string;
2553 reactNamespace?: string;
2554 jsxFactory?: string;
2555 composite?: boolean;
2556 incremental?: boolean;
2557 tsBuildInfoFile?: string;
2558 removeComments?: boolean;
2559 rootDir?: string;
2560 rootDirs?: string[];
2561 skipLibCheck?: boolean;
2562 skipDefaultLibCheck?: boolean;
2563 sourceMap?: boolean;
2564 sourceRoot?: string;
2565 strict?: boolean;
2566 strictFunctionTypes?: boolean;
2567 strictBindCallApply?: boolean;
2568 strictNullChecks?: boolean;
2569 strictPropertyInitialization?: boolean;
2570 stripInternal?: boolean;
2571 suppressExcessPropertyErrors?: boolean;
2572 suppressImplicitAnyIndexErrors?: boolean;
2573 target?: ScriptTarget;
2574 traceResolution?: boolean;
2575 resolveJsonModule?: boolean;
2576 types?: string[];
2577 /** Paths used to compute primary types search locations */
2578 typeRoots?: string[];
2579 esModuleInterop?: boolean;
2580 [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined;
2581 }
2582 interface TypeAcquisition {
2583 enableAutoDiscovery?: boolean;
2584 enable?: boolean;
2585 include?: string[];
2586 exclude?: string[];
2587 [option: string]: string[] | boolean | undefined;
2588 }
2589 enum ModuleKind {
2590 None = 0,
2591 CommonJS = 1,
2592 AMD = 2,
2593 UMD = 3,
2594 System = 4,
2595 ES2015 = 5,
2596 ESNext = 6
2597 }
2598 enum JsxEmit {
2599 None = 0,
2600 Preserve = 1,
2601 React = 2,
2602 ReactNative = 3
2603 }
2604 enum NewLineKind {
2605 CarriageReturnLineFeed = 0,
2606 LineFeed = 1
2607 }
2608 interface LineAndCharacter {
2609 /** 0-based. */
2610 line: number;
2611 character: number;
2612 }
2613 enum ScriptKind {
2614 Unknown = 0,
2615 JS = 1,
2616 JSX = 2,
2617 TS = 3,
2618 TSX = 4,
2619 External = 5,
2620 JSON = 6,
2621 /**
2622 * Used on extensions that doesn't define the ScriptKind but the content defines it.
2623 * Deferred extensions are going to be included in all project contexts.
2624 */
2625 Deferred = 7
2626 }
2627 enum ScriptTarget {
2628 ES3 = 0,
2629 ES5 = 1,
2630 ES2015 = 2,
2631 ES2016 = 3,
2632 ES2017 = 4,
2633 ES2018 = 5,
2634 ES2019 = 6,
2635 ES2020 = 7,
2636 ESNext = 8,
2637 JSON = 100,
2638 Latest = 8
2639 }
2640 enum LanguageVariant {
2641 Standard = 0,
2642 JSX = 1
2643 }
2644 /** Either a parsed command line or a parsed tsconfig.json */
2645 interface ParsedCommandLine {
2646 options: CompilerOptions;
2647 typeAcquisition?: TypeAcquisition;
2648 fileNames: string[];
2649 projectReferences?: ReadonlyArray<ProjectReference>;
2650 raw?: any;
2651 errors: Diagnostic[];
2652 wildcardDirectories?: MapLike<WatchDirectoryFlags>;
2653 compileOnSave?: boolean;
2654 }
2655 enum WatchDirectoryFlags {
2656 None = 0,
2657 Recursive = 1
2658 }
2659 interface ExpandResult {
2660 fileNames: string[];
2661 wildcardDirectories: MapLike<WatchDirectoryFlags>;
2662 }
2663 interface CreateProgramOptions {
2664 rootNames: ReadonlyArray<string>;
2665 options: CompilerOptions;
2666 projectReferences?: ReadonlyArray<ProjectReference>;
2667 host?: CompilerHost;
2668 oldProgram?: Program;
2669 configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>;
2670 }
2671 interface ModuleResolutionHost {
2672 fileExists(fileName: string): boolean;
2673 readFile(fileName: string): string | undefined;
2674 trace?(s: string): void;
2675 directoryExists?(directoryName: string): boolean;
2676 /**
2677 * Resolve a symbolic link.
2678 * @see https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options
2679 */
2680 realpath?(path: string): string;
2681 getCurrentDirectory?(): string;
2682 getDirectories?(path: string): string[];
2683 }
2684 /**
2685 * Represents the result of module resolution.
2686 * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
2687 * The Program will then filter results based on these flags.
2688 *
2689 * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
2690 */
2691 interface ResolvedModule {
2692 /** Path of the file the module was resolved to. */
2693 resolvedFileName: string;
2694 /** True if `resolvedFileName` comes from `node_modules`. */
2695 isExternalLibraryImport?: boolean;
2696 }
2697 /**
2698 * ResolvedModule with an explicitly provided `extension` property.
2699 * Prefer this over `ResolvedModule`.
2700 * If changing this, remember to change `moduleResolutionIsEqualTo`.
2701 */
2702 interface ResolvedModuleFull extends ResolvedModule {
2703 /**
2704 * Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
2705 * This is optional for backwards-compatibility, but will be added if not provided.
2706 */
2707 extension: Extension;
2708 packageId?: PackageId;
2709 }
2710 /**
2711 * Unique identifier with a package name and version.
2712 * If changing this, remember to change `packageIdIsEqual`.
2713 */
2714 interface PackageId {
2715 /**
2716 * Name of the package.
2717 * Should not include `@types`.
2718 * If accessing a non-index file, this should include its name e.g. "foo/bar".
2719 */
2720 name: string;
2721 /**
2722 * Name of a submodule within this package.
2723 * May be "".
2724 */
2725 subModuleName: string;
2726 /** Version of the package, e.g. "1.2.3" */
2727 version: string;
2728 }
2729 enum Extension {
2730 Ts = ".ts",
2731 Tsx = ".tsx",
2732 Dts = ".d.ts",
2733 Js = ".js",
2734 Jsx = ".jsx",
2735 Json = ".json",
2736 TsBuildInfo = ".tsbuildinfo"
2737 }
2738 interface ResolvedModuleWithFailedLookupLocations {
2739 readonly resolvedModule: ResolvedModuleFull | undefined;
2740 }
2741 interface ResolvedTypeReferenceDirective {
2742 primary: boolean;
2743 resolvedFileName: string | undefined;
2744 packageId?: PackageId;
2745 /** True if `resolvedFileName` comes from `node_modules`. */
2746 isExternalLibraryImport?: boolean;
2747 }
2748 interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
2749 readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined;
2750 readonly failedLookupLocations: ReadonlyArray<string>;
2751 }
2752 interface CompilerHost extends ModuleResolutionHost {
2753 getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
2754 getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
2755 getCancellationToken?(): CancellationToken;
2756 getDefaultLibFileName(options: CompilerOptions): string;
2757 getDefaultLibLocation?(): string;
2758 writeFile: WriteFileCallback;
2759 getCurrentDirectory(): string;
2760 getCanonicalFileName(fileName: string): string;
2761 useCaseSensitiveFileNames(): boolean;
2762 getNewLine(): string;
2763 readDirectory?(rootDir: string, extensions: ReadonlyArray<string>, excludes: ReadonlyArray<string> | undefined, includes: ReadonlyArray<string>, depth?: number): string[];
2764 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
2765 /**
2766 * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
2767 */
2768 resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
2769 getEnvironmentVariable?(name: string): string | undefined;
2770 createHash?(data: string): string;
2771 getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
2772 }
2773 interface SourceMapRange extends TextRange {
2774 source?: SourceMapSource;
2775 }
2776 interface SourceMapSource {
2777 fileName: string;
2778 text: string;
2779 skipTrivia?: (pos: number) => number;
2780 }
2781 enum EmitFlags {
2782 None = 0,
2783 SingleLine = 1,
2784 AdviseOnEmitNode = 2,
2785 NoSubstitution = 4,
2786 CapturesThis = 8,
2787 NoLeadingSourceMap = 16,
2788 NoTrailingSourceMap = 32,
2789 NoSourceMap = 48,
2790 NoNestedSourceMaps = 64,
2791 NoTokenLeadingSourceMaps = 128,
2792 NoTokenTrailingSourceMaps = 256,
2793 NoTokenSourceMaps = 384,
2794 NoLeadingComments = 512,
2795 NoTrailingComments = 1024,
2796 NoComments = 1536,
2797 NoNestedComments = 2048,
2798 HelperName = 4096,
2799 ExportName = 8192,
2800 LocalName = 16384,
2801 InternalName = 32768,
2802 Indented = 65536,
2803 NoIndentation = 131072,
2804 AsyncFunctionBody = 262144,
2805 ReuseTempVariableScope = 524288,
2806 CustomPrologue = 1048576,
2807 NoHoisting = 2097152,
2808 HasEndOfDeclarationMarker = 4194304,
2809 Iterator = 8388608,
2810 NoAsciiEscaping = 16777216,
2811 }
2812 interface EmitHelper {
2813 readonly name: string;
2814 readonly scoped: boolean;
2815 readonly text: string | ((node: EmitHelperUniqueNameCallback) => string);
2816 readonly priority?: number;
2817 }
2818 interface UnscopedEmitHelper extends EmitHelper {
2819 readonly scoped: false;
2820 readonly text: string;
2821 }
2822 type EmitHelperUniqueNameCallback = (name: string) => string;
2823 enum EmitHint {
2824 SourceFile = 0,
2825 Expression = 1,
2826 IdentifierName = 2,
2827 MappedTypeParameter = 3,
2828 Unspecified = 4,
2829 EmbeddedStatement = 5
2830 }
2831 interface TransformationContext {
2832 /** Gets the compiler options supplied to the transformer. */
2833 getCompilerOptions(): CompilerOptions;
2834 /** Starts a new lexical environment. */
2835 startLexicalEnvironment(): void;
2836 /** Suspends the current lexical environment, usually after visiting a parameter list. */
2837 suspendLexicalEnvironment(): void;
2838 /** Resumes a suspended lexical environment, usually before visiting a function body. */
2839 resumeLexicalEnvironment(): void;
2840 /** Ends a lexical environment, returning any declarations. */
2841 endLexicalEnvironment(): Statement[] | undefined;
2842 /** Hoists a function declaration to the containing scope. */
2843 hoistFunctionDeclaration(node: FunctionDeclaration): void;
2844 /** Hoists a variable declaration to the containing scope. */
2845 hoistVariableDeclaration(node: Identifier): void;
2846 /** Records a request for a non-scoped emit helper in the current context. */
2847 requestEmitHelper(helper: EmitHelper): void;
2848 /** Gets and resets the requested non-scoped emit helpers. */
2849 readEmitHelpers(): EmitHelper[] | undefined;
2850 /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */
2851 enableSubstitution(kind: SyntaxKind): void;
2852 /** Determines whether expression substitutions are enabled for the provided node. */
2853 isSubstitutionEnabled(node: Node): boolean;
2854 /**
2855 * Hook used by transformers to substitute expressions just before they
2856 * are emitted by the pretty printer.
2857 *
2858 * NOTE: Transformation hooks should only be modified during `Transformer` initialization,
2859 * before returning the `NodeTransformer` callback.
2860 */
2861 onSubstituteNode: (hint: EmitHint, node: Node) => Node;
2862 /**
2863 * Enables before/after emit notifications in the pretty printer for the provided
2864 * SyntaxKind.
2865 */
2866 enableEmitNotification(kind: SyntaxKind): void;
2867 /**
2868 * Determines whether before/after emit notifications should be raised in the pretty
2869 * printer when it emits a node.
2870 */
2871 isEmitNotificationEnabled(node: Node): boolean;
2872 /**
2873 * Hook used to allow transformers to capture state before or after
2874 * the printer emits a node.
2875 *
2876 * NOTE: Transformation hooks should only be modified during `Transformer` initialization,
2877 * before returning the `NodeTransformer` callback.
2878 */
2879 onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void;
2880 }
2881 interface TransformationResult<T extends Node> {
2882 /** Gets the transformed source files. */
2883 transformed: T[];
2884 /** Gets diagnostics for the transformation. */
2885 diagnostics?: DiagnosticWithLocation[];
2886 /**
2887 * Gets a substitute for a node, if one is available; otherwise, returns the original node.
2888 *
2889 * @param hint A hint as to the intended usage of the node.
2890 * @param node The node to substitute.
2891 */
2892 substituteNode(hint: EmitHint, node: Node): Node;
2893 /**
2894 * Emits a node with possible notification.
2895 *
2896 * @param hint A hint as to the intended usage of the node.
2897 * @param node The node to emit.
2898 * @param emitCallback A callback used to emit the node.
2899 */
2900 emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void;
2901 /**
2902 * Clean up EmitNode entries on any parse-tree nodes.
2903 */
2904 dispose(): void;
2905 }
2906 /**
2907 * A function that is used to initialize and return a `Transformer` callback, which in turn
2908 * will be used to transform one or more nodes.
2909 */
2910 type TransformerFactory<T extends Node> = (context: TransformationContext) => Transformer<T>;
2911 /**
2912 * A function that transforms a node.
2913 */
2914 type Transformer<T extends Node> = (node: T) => T;
2915 /**
2916 * A function that accepts and possibly transforms a node.
2917 */
2918 type Visitor = (node: Node) => VisitResult<Node>;
2919 type VisitResult<T extends Node> = T | T[] | undefined;
2920 interface Printer {
2921 /**
2922 * Print a node and its subtree as-is, without any emit transformations.
2923 * @param hint A value indicating the purpose of a node. This is primarily used to
2924 * distinguish between an `Identifier` used in an expression position, versus an
2925 * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you
2926 * should just pass `Unspecified`.
2927 * @param node The node to print. The node and its subtree are printed as-is, without any
2928 * emit transformations.
2929 * @param sourceFile A source file that provides context for the node. The source text of
2930 * the file is used to emit the original source content for literals and identifiers, while
2931 * the identifiers of the source file are used when generating unique names to avoid
2932 * collisions.
2933 */
2934 printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string;
2935 /**
2936 * Prints a list of nodes using the given format flags
2937 */
2938 printList<T extends Node>(format: ListFormat, list: NodeArray<T>, sourceFile: SourceFile): string;
2939 /**
2940 * Prints a source file as-is, without any emit transformations.
2941 */
2942 printFile(sourceFile: SourceFile): string;
2943 /**
2944 * Prints a bundle of source files as-is, without any emit transformations.
2945 */
2946 printBundle(bundle: Bundle): string;
2947 }
2948 interface PrintHandlers {
2949 /**
2950 * A hook used by the Printer when generating unique names to avoid collisions with
2951 * globally defined names that exist outside of the current source file.
2952 */
2953 hasGlobalName?(name: string): boolean;
2954 /**
2955 * A hook used by the Printer to provide notifications prior to emitting a node. A
2956 * compatible implementation **must** invoke `emitCallback` with the provided `hint` and
2957 * `node` values.
2958 * @param hint A hint indicating the intended purpose of the node.
2959 * @param node The node to emit.
2960 * @param emitCallback A callback that, when invoked, will emit the node.
2961 * @example
2962 * ```ts
2963 * var printer = createPrinter(printerOptions, {
2964 * onEmitNode(hint, node, emitCallback) {
2965 * // set up or track state prior to emitting the node...
2966 * emitCallback(hint, node);
2967 * // restore state after emitting the node...
2968 * }
2969 * });
2970 * ```
2971 */
2972 onEmitNode?(hint: EmitHint, node: Node | undefined, emitCallback: (hint: EmitHint, node: Node | undefined) => void): void;
2973 /**
2974 * A hook used by the Printer to perform just-in-time substitution of a node. This is
2975 * primarily used by node transformations that need to substitute one node for another,
2976 * such as replacing `myExportedVar` with `exports.myExportedVar`.
2977 * @param hint A hint indicating the intended purpose of the node.
2978 * @param node The node to emit.
2979 * @example
2980 * ```ts
2981 * var printer = createPrinter(printerOptions, {
2982 * substituteNode(hint, node) {
2983 * // perform substitution if necessary...
2984 * return node;
2985 * }
2986 * });
2987 * ```
2988 */
2989 substituteNode?(hint: EmitHint, node: Node): Node;
2990 }
2991 interface PrinterOptions {
2992 removeComments?: boolean;
2993 newLine?: NewLineKind;
2994 omitTrailingSemicolon?: boolean;
2995 noEmitHelpers?: boolean;
2996 }
2997 interface GetEffectiveTypeRootsHost {
2998 directoryExists?(directoryName: string): boolean;
2999 getCurrentDirectory?(): string;
3000 }
3001 interface TextSpan {
3002 start: number;
3003 length: number;
3004 }
3005 interface TextChangeRange {
3006 span: TextSpan;
3007 newLength: number;
3008 }
3009 interface SyntaxList extends Node {
3010 _children: Node[];
3011 }
3012 enum ListFormat {
3013 None = 0,
3014 SingleLine = 0,
3015 MultiLine = 1,
3016 PreserveLines = 2,
3017 LinesMask = 3,
3018 NotDelimited = 0,
3019 BarDelimited = 4,
3020 AmpersandDelimited = 8,
3021 CommaDelimited = 16,
3022 AsteriskDelimited = 32,
3023 DelimitersMask = 60,
3024 AllowTrailingComma = 64,
3025 Indented = 128,
3026 SpaceBetweenBraces = 256,
3027 SpaceBetweenSiblings = 512,
3028 Braces = 1024,
3029 Parenthesis = 2048,
3030 AngleBrackets = 4096,
3031 SquareBrackets = 8192,
3032 BracketsMask = 15360,
3033 OptionalIfUndefined = 16384,
3034 OptionalIfEmpty = 32768,
3035 Optional = 49152,
3036 PreferNewLine = 65536,
3037 NoTrailingNewLine = 131072,
3038 NoInterveningComments = 262144,
3039 NoSpaceIfEmpty = 524288,
3040 SingleElement = 1048576,
3041 Modifiers = 262656,
3042 HeritageClauses = 512,
3043 SingleLineTypeLiteralMembers = 768,
3044 MultiLineTypeLiteralMembers = 32897,
3045 TupleTypeElements = 528,
3046 UnionTypeConstituents = 516,
3047 IntersectionTypeConstituents = 520,
3048 ObjectBindingPatternElements = 525136,
3049 ArrayBindingPatternElements = 524880,
3050 ObjectLiteralExpressionProperties = 526226,
3051 ArrayLiteralExpressionElements = 8914,
3052 CommaListElements = 528,
3053 CallExpressionArguments = 2576,
3054 NewExpressionArguments = 18960,
3055 TemplateExpressionSpans = 262144,
3056 SingleLineBlockStatements = 768,
3057 MultiLineBlockStatements = 129,
3058 VariableDeclarationList = 528,
3059 SingleLineFunctionBodyStatements = 768,
3060 MultiLineFunctionBodyStatements = 1,
3061 ClassHeritageClauses = 0,
3062 ClassMembers = 129,
3063 InterfaceMembers = 129,
3064 EnumMembers = 145,
3065 CaseBlockClauses = 129,
3066 NamedImportsOrExportsElements = 525136,
3067 JsxElementOrFragmentChildren = 262144,
3068 JsxElementAttributes = 262656,
3069 CaseOrDefaultClauseStatements = 163969,
3070 HeritageClauseTypes = 528,
3071 SourceFileStatements = 131073,
3072 Decorators = 49153,
3073 TypeArguments = 53776,
3074 TypeParameters = 53776,
3075 Parameters = 2576,
3076 IndexSignatureParameters = 8848,
3077 JSDocComment = 33
3078 }
3079 interface UserPreferences {
3080 readonly disableSuggestions?: boolean;
3081 readonly quotePreference?: "auto" | "double" | "single";
3082 readonly includeCompletionsForModuleExports?: boolean;
3083 readonly includeCompletionsWithInsertText?: boolean;
3084 readonly importModuleSpecifierPreference?: "relative" | "non-relative";
3085 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
3086 readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
3087 readonly allowTextChangesInNewFiles?: boolean;
3088 readonly providePrefixAndSuffixTextForRename?: boolean;
3089 }
3090 /** Represents a bigint literal value without requiring bigint support */
3091 interface PseudoBigInt {
3092 negative: boolean;
3093 base10Value: string;
3094 }
3095}
3096declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
3097declare function clearTimeout(handle: any): void;
3098declare namespace ts {
3099 enum FileWatcherEventKind {
3100 Created = 0,
3101 Changed = 1,
3102 Deleted = 2
3103 }
3104 type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind) => void;
3105 type DirectoryWatcherCallback = (fileName: string) => void;
3106 interface System {
3107 args: string[];
3108 newLine: string;
3109 useCaseSensitiveFileNames: boolean;
3110 write(s: string): void;
3111 writeOutputIsTTY?(): boolean;
3112 readFile(path: string, encoding?: string): string | undefined;
3113 getFileSize?(path: string): number;
3114 writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
3115 /**
3116 * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
3117 * use native OS file watching
3118 */
3119 watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
3120 watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
3121 resolvePath(path: string): string;
3122 fileExists(path: string): boolean;
3123 directoryExists(path: string): boolean;
3124 createDirectory(path: string): void;
3125 getExecutingFilePath(): string;
3126 getCurrentDirectory(): string;
3127 getDirectories(path: string): string[];
3128 readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
3129 getModifiedTime?(path: string): Date | undefined;
3130 setModifiedTime?(path: string, time: Date): void;
3131 deleteFile?(path: string): void;
3132 /**
3133 * A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm)
3134 */
3135 createHash?(data: string): string;
3136 /** This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. */
3137 createSHA256Hash?(data: string): string;
3138 getMemoryUsage?(): number;
3139 exit(exitCode?: number): void;
3140 realpath?(path: string): string;
3141 setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
3142 clearTimeout?(timeoutId: any): void;
3143 clearScreen?(): void;
3144 base64decode?(input: string): string;
3145 base64encode?(input: string): string;
3146 }
3147 interface FileWatcher {
3148 close(): void;
3149 }
3150 function getNodeMajorVersion(): number | undefined;
3151 let sys: System;
3152}
3153declare namespace ts {
3154 type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
3155 interface Scanner {
3156 getStartPos(): number;
3157 getToken(): SyntaxKind;
3158 getTextPos(): number;
3159 getTokenPos(): number;
3160 getTokenText(): string;
3161 getTokenValue(): string;
3162 hasExtendedUnicodeEscape(): boolean;
3163 hasPrecedingLineBreak(): boolean;
3164 isIdentifier(): boolean;
3165 isReservedWord(): boolean;
3166 isUnterminated(): boolean;
3167 reScanGreaterToken(): SyntaxKind;
3168 reScanSlashToken(): SyntaxKind;
3169 reScanTemplateToken(): SyntaxKind;
3170 scanJsxIdentifier(): SyntaxKind;
3171 scanJsxAttributeValue(): SyntaxKind;
3172 reScanJsxToken(): JsxTokenSyntaxKind;
3173 reScanLessThanToken(): SyntaxKind;
3174 scanJsxToken(): JsxTokenSyntaxKind;
3175 scanJsDocToken(): JSDocSyntaxKind;
3176 scan(): SyntaxKind;
3177 getText(): string;
3178 setText(text: string | undefined, start?: number, length?: number): void;
3179 setOnError(onError: ErrorCallback | undefined): void;
3180 setScriptTarget(scriptTarget: ScriptTarget): void;
3181 setLanguageVariant(variant: LanguageVariant): void;
3182 setTextPos(textPos: number): void;
3183 lookAhead<T>(callback: () => T): T;
3184 scanRange<T>(start: number, length: number, callback: () => T): T;
3185 tryScan<T>(callback: () => T): T;
3186 }
3187 function tokenToString(t: SyntaxKind): string | undefined;
3188 function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
3189 function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
3190 function isWhiteSpaceLike(ch: number): boolean;
3191 /** Does not include line breaks. For that, see isWhiteSpaceLike. */
3192 function isWhiteSpaceSingleLine(ch: number): boolean;
3193 function isLineBreak(ch: number): boolean;
3194 function couldStartTrivia(text: string, pos: number): boolean;
3195 function forEachLeadingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
3196 function forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
3197 function forEachTrailingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
3198 function forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
3199 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;
3200 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;
3201 function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
3202 function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
3203 /** Optionally, get the shebang */
3204 function getShebang(text: string): string | undefined;
3205 function isIdentifierStart(ch: number, languageVersion: ScriptTarget | undefined): boolean;
3206 function isIdentifierPart(ch: number, languageVersion: ScriptTarget | undefined): boolean;
3207 function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, textInitial?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
3208}
3209declare namespace ts {
3210 function isExternalModuleNameRelative(moduleName: string): boolean;
3211 function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics: ReadonlyArray<T>): SortedReadonlyArray<T>;
3212}
3213declare namespace ts {
3214 function getDefaultLibFileName(options: CompilerOptions): string;
3215 function textSpanEnd(span: TextSpan): number;
3216 function textSpanIsEmpty(span: TextSpan): boolean;
3217 function textSpanContainsPosition(span: TextSpan, position: number): boolean;
3218 function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
3219 function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
3220 function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan | undefined;
3221 function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
3222 function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
3223 function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
3224 function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
3225 function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan | undefined;
3226 function createTextSpan(start: number, length: number): TextSpan;
3227 function createTextSpanFromBounds(start: number, end: number): TextSpan;
3228 function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
3229 function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
3230 function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
3231 let unchangedTextChangeRange: TextChangeRange;
3232 /**
3233 * Called to merge all the changes that occurred across several versions of a script snapshot
3234 * into a single change. i.e. if a user keeps making successive edits to a script we will
3235 * have a text change from V1 to V2, V2 to V3, ..., Vn.
3236 *
3237 * This function will then merge those changes into a single change range valid between V1 and
3238 * Vn.
3239 */
3240 function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray<TextChangeRange>): TextChangeRange;
3241 function getTypeParameterOwner(d: Declaration): Declaration | undefined;
3242 type ParameterPropertyDeclaration = ParameterDeclaration & {
3243 parent: ConstructorDeclaration;
3244 name: Identifier;
3245 };
3246 function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration;
3247 function isEmptyBindingPattern(node: BindingName): node is BindingPattern;
3248 function isEmptyBindingElement(node: BindingElement): boolean;
3249 function walkUpBindingElementsAndPatterns(binding: BindingElement): VariableDeclaration | ParameterDeclaration;
3250 function getCombinedModifierFlags(node: Declaration): ModifierFlags;
3251 function getCombinedNodeFlags(node: Node): NodeFlags;
3252 /**
3253 * Checks to see if the locale is in the appropriate format,
3254 * and if it is, attempts to set the appropriate language.
3255 */
3256 function validateLocaleAndSetLanguage(locale: string, sys: {
3257 getExecutingFilePath(): string;
3258 resolvePath(path: string): string;
3259 fileExists(fileName: string): boolean;
3260 readFile(fileName: string): string | undefined;
3261 }, errors?: Push<Diagnostic>): void;
3262 function getOriginalNode(node: Node): Node;
3263 function getOriginalNode<T extends Node>(node: Node, nodeTest: (node: Node) => node is T): T;
3264 function getOriginalNode(node: Node | undefined): Node | undefined;
3265 function getOriginalNode<T extends Node>(node: Node | undefined, nodeTest: (node: Node | undefined) => node is T): T | undefined;
3266 /**
3267 * Gets a value indicating whether a node originated in the parse tree.
3268 *
3269 * @param node The node to test.
3270 */
3271 function isParseTreeNode(node: Node): boolean;
3272 /**
3273 * Gets the original parse tree node for a node.
3274 *
3275 * @param node The original node.
3276 * @returns The original parse tree node if found; otherwise, undefined.
3277 */
3278 function getParseTreeNode(node: Node): Node;
3279 /**
3280 * Gets the original parse tree node for a node.
3281 *
3282 * @param node The original node.
3283 * @param nodeTest A callback used to ensure the correct type of parse tree node is returned.
3284 * @returns The original parse tree node if found; otherwise, undefined.
3285 */
3286 function getParseTreeNode<T extends Node>(node: Node | undefined, nodeTest?: (node: Node) => node is T): T | undefined;
3287 /** Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' */
3288 function escapeLeadingUnderscores(identifier: string): __String;
3289 /**
3290 * Remove extra underscore from escaped identifier text content.
3291 *
3292 * @param identifier The escaped identifier text.
3293 * @returns The unescaped identifier text.
3294 */
3295 function unescapeLeadingUnderscores(identifier: __String): string;
3296 function idText(identifier: Identifier): string;
3297 function symbolName(symbol: Symbol): string;
3298 function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | undefined;
3299 function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined;
3300 /**
3301 * Gets the JSDoc parameter tags for the node if present.
3302 *
3303 * @remarks Returns any JSDoc param tag whose name matches the provided
3304 * parameter, whether a param tag on a containing function
3305 * expression, or a param tag on a variable declaration whose
3306 * initializer is the containing function. The tags closest to the
3307 * node are returned first, so in the previous example, the param
3308 * tag on the containing function expression would be first.
3309 *
3310 * For binding patterns, parameter tags are matched by position.
3311 */
3312 function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag>;
3313 /**
3314 * Gets the JSDoc type parameter tags for the node if present.
3315 *
3316 * @remarks Returns any JSDoc template tag whose names match the provided
3317 * parameter, whether a template tag on a containing function
3318 * expression, or a template tag on a variable declaration whose
3319 * initializer is the containing function. The tags closest to the
3320 * node are returned first, so in the previous example, the template
3321 * tag on the containing function expression would be first.
3322 */
3323 function getJSDocTypeParameterTags(param: TypeParameterDeclaration): ReadonlyArray<JSDocTemplateTag>;
3324 /**
3325 * Return true if the node has JSDoc parameter tags.
3326 *
3327 * @remarks Includes parameter tags that are not directly on the node,
3328 * for example on a variable declaration whose initializer is a function expression.
3329 */
3330 function hasJSDocParameterTags(node: FunctionLikeDeclaration | SignatureDeclaration): boolean;
3331 /** Gets the JSDoc augments tag for the node if present */
3332 function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag | undefined;
3333 /** Gets the JSDoc class tag for the node if present */
3334 function getJSDocClassTag(node: Node): JSDocClassTag | undefined;
3335 /** Gets the JSDoc enum tag for the node if present */
3336 function getJSDocEnumTag(node: Node): JSDocEnumTag | undefined;
3337 /** Gets the JSDoc this tag for the node if present */
3338 function getJSDocThisTag(node: Node): JSDocThisTag | undefined;
3339 /** Gets the JSDoc return tag for the node if present */
3340 function getJSDocReturnTag(node: Node): JSDocReturnTag | undefined;
3341 /** Gets the JSDoc template tag for the node if present */
3342 function getJSDocTemplateTag(node: Node): JSDocTemplateTag | undefined;
3343 /** Gets the JSDoc type tag for the node if present and valid */
3344 function getJSDocTypeTag(node: Node): JSDocTypeTag | undefined;
3345 /**
3346 * Gets the type node for the node if provided via JSDoc.
3347 *
3348 * @remarks The search includes any JSDoc param tag that relates
3349 * to the provided parameter, for example a type tag on the
3350 * parameter itself, or a param tag on a containing function
3351 * expression, or a param tag on a variable declaration whose
3352 * initializer is the containing function. The tags closest to the
3353 * node are examined first, so in the previous example, the type
3354 * tag directly on the node would be returned.
3355 */
3356 function getJSDocType(node: Node): TypeNode | undefined;
3357 /**
3358 * Gets the return type node for the node if provided via JSDoc return tag or type tag.
3359 *
3360 * @remarks `getJSDocReturnTag` just gets the whole JSDoc tag. This function
3361 * gets the type from inside the braces, after the fat arrow, etc.
3362 */
3363 function getJSDocReturnType(node: Node): TypeNode | undefined;
3364 /** Get all JSDoc tags related to a node, including those on parent nodes. */
3365 function getJSDocTags(node: Node): ReadonlyArray<JSDocTag>;
3366 /** Gets all JSDoc tags of a specified kind, or undefined if not present. */
3367 function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag>;
3368 /**
3369 * Gets the effective type parameters. If the node was parsed in a
3370 * JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
3371 */
3372 function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray<TypeParameterDeclaration>;
3373 function getEffectiveConstraintOfTypeParameter(node: TypeParameterDeclaration): TypeNode | undefined;
3374}
3375declare namespace ts {
3376 function isNumericLiteral(node: Node): node is NumericLiteral;
3377 function isBigIntLiteral(node: Node): node is BigIntLiteral;
3378 function isStringLiteral(node: Node): node is StringLiteral;
3379 function isJsxText(node: Node): node is JsxText;
3380 function isRegularExpressionLiteral(node: Node): node is RegularExpressionLiteral;
3381 function isNoSubstitutionTemplateLiteral(node: Node): node is NoSubstitutionTemplateLiteral;
3382 function isTemplateHead(node: Node): node is TemplateHead;
3383 function isTemplateMiddle(node: Node): node is TemplateMiddle;
3384 function isTemplateTail(node: Node): node is TemplateTail;
3385 function isIdentifier(node: Node): node is Identifier;
3386 function isQualifiedName(node: Node): node is QualifiedName;
3387 function isComputedPropertyName(node: Node): node is ComputedPropertyName;
3388 function isTypeParameterDeclaration(node: Node): node is TypeParameterDeclaration;
3389 function isParameter(node: Node): node is ParameterDeclaration;
3390 function isDecorator(node: Node): node is Decorator;
3391 function isPropertySignature(node: Node): node is PropertySignature;
3392 function isPropertyDeclaration(node: Node): node is PropertyDeclaration;
3393 function isMethodSignature(node: Node): node is MethodSignature;
3394 function isMethodDeclaration(node: Node): node is MethodDeclaration;
3395 function isConstructorDeclaration(node: Node): node is ConstructorDeclaration;
3396 function isGetAccessorDeclaration(node: Node): node is GetAccessorDeclaration;
3397 function isSetAccessorDeclaration(node: Node): node is SetAccessorDeclaration;
3398 function isCallSignatureDeclaration(node: Node): node is CallSignatureDeclaration;
3399 function isConstructSignatureDeclaration(node: Node): node is ConstructSignatureDeclaration;
3400 function isIndexSignatureDeclaration(node: Node): node is IndexSignatureDeclaration;
3401 function isTypePredicateNode(node: Node): node is TypePredicateNode;
3402 function isTypeReferenceNode(node: Node): node is TypeReferenceNode;
3403 function isFunctionTypeNode(node: Node): node is FunctionTypeNode;
3404 function isConstructorTypeNode(node: Node): node is ConstructorTypeNode;
3405 function isTypeQueryNode(node: Node): node is TypeQueryNode;
3406 function isTypeLiteralNode(node: Node): node is TypeLiteralNode;
3407 function isArrayTypeNode(node: Node): node is ArrayTypeNode;
3408 function isTupleTypeNode(node: Node): node is TupleTypeNode;
3409 function isUnionTypeNode(node: Node): node is UnionTypeNode;
3410 function isIntersectionTypeNode(node: Node): node is IntersectionTypeNode;
3411 function isConditionalTypeNode(node: Node): node is ConditionalTypeNode;
3412 function isInferTypeNode(node: Node): node is InferTypeNode;
3413 function isParenthesizedTypeNode(node: Node): node is ParenthesizedTypeNode;
3414 function isThisTypeNode(node: Node): node is ThisTypeNode;
3415 function isTypeOperatorNode(node: Node): node is TypeOperatorNode;
3416 function isIndexedAccessTypeNode(node: Node): node is IndexedAccessTypeNode;
3417 function isMappedTypeNode(node: Node): node is MappedTypeNode;
3418 function isLiteralTypeNode(node: Node): node is LiteralTypeNode;
3419 function isImportTypeNode(node: Node): node is ImportTypeNode;
3420 function isObjectBindingPattern(node: Node): node is ObjectBindingPattern;
3421 function isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
3422 function isBindingElement(node: Node): node is BindingElement;
3423 function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression;
3424 function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression;
3425 function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression;
3426 function isElementAccessExpression(node: Node): node is ElementAccessExpression;
3427 function isCallExpression(node: Node): node is CallExpression;
3428 function isNewExpression(node: Node): node is NewExpression;
3429 function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
3430 function isTypeAssertion(node: Node): node is TypeAssertion;
3431 function isConstTypeReference(node: Node): boolean;
3432 function isParenthesizedExpression(node: Node): node is ParenthesizedExpression;
3433 function skipPartiallyEmittedExpressions(node: Expression): Expression;
3434 function skipPartiallyEmittedExpressions(node: Node): Node;
3435 function isFunctionExpression(node: Node): node is FunctionExpression;
3436 function isArrowFunction(node: Node): node is ArrowFunction;
3437 function isDeleteExpression(node: Node): node is DeleteExpression;
3438 function isTypeOfExpression(node: Node): node is TypeOfExpression;
3439 function isVoidExpression(node: Node): node is VoidExpression;
3440 function isAwaitExpression(node: Node): node is AwaitExpression;
3441 function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression;
3442 function isPostfixUnaryExpression(node: Node): node is PostfixUnaryExpression;
3443 function isBinaryExpression(node: Node): node is BinaryExpression;
3444 function isConditionalExpression(node: Node): node is ConditionalExpression;
3445 function isTemplateExpression(node: Node): node is TemplateExpression;
3446 function isYieldExpression(node: Node): node is YieldExpression;
3447 function isSpreadElement(node: Node): node is SpreadElement;
3448 function isClassExpression(node: Node): node is ClassExpression;
3449 function isOmittedExpression(node: Node): node is OmittedExpression;
3450 function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments;
3451 function isAsExpression(node: Node): node is AsExpression;
3452 function isNonNullExpression(node: Node): node is NonNullExpression;
3453 function isMetaProperty(node: Node): node is MetaProperty;
3454 function isTemplateSpan(node: Node): node is TemplateSpan;
3455 function isSemicolonClassElement(node: Node): node is SemicolonClassElement;
3456 function isBlock(node: Node): node is Block;
3457 function isVariableStatement(node: Node): node is VariableStatement;
3458 function isEmptyStatement(node: Node): node is EmptyStatement;
3459 function isExpressionStatement(node: Node): node is ExpressionStatement;
3460 function isIfStatement(node: Node): node is IfStatement;
3461 function isDoStatement(node: Node): node is DoStatement;
3462 function isWhileStatement(node: Node): node is WhileStatement;
3463 function isForStatement(node: Node): node is ForStatement;
3464 function isForInStatement(node: Node): node is ForInStatement;
3465 function isForOfStatement(node: Node): node is ForOfStatement;
3466 function isContinueStatement(node: Node): node is ContinueStatement;
3467 function isBreakStatement(node: Node): node is BreakStatement;
3468 function isBreakOrContinueStatement(node: Node): node is BreakOrContinueStatement;
3469 function isReturnStatement(node: Node): node is ReturnStatement;
3470 function isWithStatement(node: Node): node is WithStatement;
3471 function isSwitchStatement(node: Node): node is SwitchStatement;
3472 function isLabeledStatement(node: Node): node is LabeledStatement;
3473 function isThrowStatement(node: Node): node is ThrowStatement;
3474 function isTryStatement(node: Node): node is TryStatement;
3475 function isDebuggerStatement(node: Node): node is DebuggerStatement;
3476 function isVariableDeclaration(node: Node): node is VariableDeclaration;
3477 function isVariableDeclarationList(node: Node): node is VariableDeclarationList;
3478 function isFunctionDeclaration(node: Node): node is FunctionDeclaration;
3479 function isClassDeclaration(node: Node): node is ClassDeclaration;
3480 function isInterfaceDeclaration(node: Node): node is InterfaceDeclaration;
3481 function isTypeAliasDeclaration(node: Node): node is TypeAliasDeclaration;
3482 function isEnumDeclaration(node: Node): node is EnumDeclaration;
3483 function isModuleDeclaration(node: Node): node is ModuleDeclaration;
3484 function isModuleBlock(node: Node): node is ModuleBlock;
3485 function isCaseBlock(node: Node): node is CaseBlock;
3486 function isNamespaceExportDeclaration(node: Node): node is NamespaceExportDeclaration;
3487 function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
3488 function isImportDeclaration(node: Node): node is ImportDeclaration;
3489 function isImportClause(node: Node): node is ImportClause;
3490 function isNamespaceImport(node: Node): node is NamespaceImport;
3491 function isNamedImports(node: Node): node is NamedImports;
3492 function isImportSpecifier(node: Node): node is ImportSpecifier;
3493 function isExportAssignment(node: Node): node is ExportAssignment;
3494 function isExportDeclaration(node: Node): node is ExportDeclaration;
3495 function isNamedExports(node: Node): node is NamedExports;
3496 function isExportSpecifier(node: Node): node is ExportSpecifier;
3497 function isMissingDeclaration(node: Node): node is MissingDeclaration;
3498 function isExternalModuleReference(node: Node): node is ExternalModuleReference;
3499 function isJsxElement(node: Node): node is JsxElement;
3500 function isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement;
3501 function isJsxOpeningElement(node: Node): node is JsxOpeningElement;
3502 function isJsxClosingElement(node: Node): node is JsxClosingElement;
3503 function isJsxFragment(node: Node): node is JsxFragment;
3504 function isJsxOpeningFragment(node: Node): node is JsxOpeningFragment;
3505 function isJsxClosingFragment(node: Node): node is JsxClosingFragment;
3506 function isJsxAttribute(node: Node): node is JsxAttribute;
3507 function isJsxAttributes(node: Node): node is JsxAttributes;
3508 function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute;
3509 function isJsxExpression(node: Node): node is JsxExpression;
3510 function isCaseClause(node: Node): node is CaseClause;
3511 function isDefaultClause(node: Node): node is DefaultClause;
3512 function isHeritageClause(node: Node): node is HeritageClause;
3513 function isCatchClause(node: Node): node is CatchClause;
3514 function isPropertyAssignment(node: Node): node is PropertyAssignment;
3515 function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment;
3516 function isSpreadAssignment(node: Node): node is SpreadAssignment;
3517 function isEnumMember(node: Node): node is EnumMember;
3518 function isSourceFile(node: Node): node is SourceFile;
3519 function isBundle(node: Node): node is Bundle;
3520 function isUnparsedSource(node: Node): node is UnparsedSource;
3521 function isUnparsedPrepend(node: Node): node is UnparsedPrepend;
3522 function isUnparsedTextLike(node: Node): node is UnparsedTextLike;
3523 function isUnparsedNode(node: Node): node is UnparsedNode;
3524 function isJSDocTypeExpression(node: Node): node is JSDocTypeExpression;
3525 function isJSDocAllType(node: JSDocAllType): node is JSDocAllType;
3526 function isJSDocUnknownType(node: Node): node is JSDocUnknownType;
3527 function isJSDocNullableType(node: Node): node is JSDocNullableType;
3528 function isJSDocNonNullableType(node: Node): node is JSDocNonNullableType;
3529 function isJSDocOptionalType(node: Node): node is JSDocOptionalType;
3530 function isJSDocFunctionType(node: Node): node is JSDocFunctionType;
3531 function isJSDocVariadicType(node: Node): node is JSDocVariadicType;
3532 function isJSDoc(node: Node): node is JSDoc;
3533 function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
3534 function isJSDocClassTag(node: Node): node is JSDocClassTag;
3535 function isJSDocEnumTag(node: Node): node is JSDocEnumTag;
3536 function isJSDocThisTag(node: Node): node is JSDocThisTag;
3537 function isJSDocParameterTag(node: Node): node is JSDocParameterTag;
3538 function isJSDocReturnTag(node: Node): node is JSDocReturnTag;
3539 function isJSDocTypeTag(node: Node): node is JSDocTypeTag;
3540 function isJSDocTemplateTag(node: Node): node is JSDocTemplateTag;
3541 function isJSDocTypedefTag(node: Node): node is JSDocTypedefTag;
3542 function isJSDocPropertyTag(node: Node): node is JSDocPropertyTag;
3543 function isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag;
3544 function isJSDocTypeLiteral(node: Node): node is JSDocTypeLiteral;
3545 function isJSDocCallbackTag(node: Node): node is JSDocCallbackTag;
3546 function isJSDocSignature(node: Node): node is JSDocSignature;
3547}
3548declare namespace ts {
3549 /**
3550 * True if node is of some token syntax kind.
3551 * For example, this is true for an IfKeyword but not for an IfStatement.
3552 * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
3553 */
3554 function isToken(n: Node): boolean;
3555 function isLiteralExpression(node: Node): node is LiteralExpression;
3556 type TemplateLiteralToken = NoSubstitutionTemplateLiteral | TemplateHead | TemplateMiddle | TemplateTail;
3557 function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken;
3558 function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
3559 function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
3560 function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
3561 function isModifier(node: Node): node is Modifier;
3562 function isEntityName(node: Node): node is EntityName;
3563 function isPropertyName(node: Node): node is PropertyName;
3564 function isBindingName(node: Node): node is BindingName;
3565 function isFunctionLike(node: Node): node is SignatureDeclaration;
3566 function isClassElement(node: Node): node is ClassElement;
3567 function isClassLike(node: Node): node is ClassLikeDeclaration;
3568 function isAccessor(node: Node): node is AccessorDeclaration;
3569 function isTypeElement(node: Node): node is TypeElement;
3570 function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
3571 function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
3572 /**
3573 * Node test that determines whether a node is a valid type node.
3574 * This differs from the `isPartOfTypeNode` function which determines whether a node is *part*
3575 * of a TypeNode.
3576 */
3577 function isTypeNode(node: Node): node is TypeNode;
3578 function isFunctionOrConstructorTypeNode(node: Node): node is FunctionTypeNode | ConstructorTypeNode;
3579 function isPropertyAccessOrQualifiedName(node: Node): node is PropertyAccessExpression | QualifiedName;
3580 function isCallLikeExpression(node: Node): node is CallLikeExpression;
3581 function isCallOrNewExpression(node: Node): node is CallExpression | NewExpression;
3582 function isTemplateLiteral(node: Node): node is TemplateLiteral;
3583 function isAssertionExpression(node: Node): node is AssertionExpression;
3584 function isIterationStatement(node: Node, lookInLabeledStatements: false): node is IterationStatement;
3585 function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement | LabeledStatement;
3586 function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement;
3587 function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause;
3588 /** True if node is of a kind that may contain comment text. */
3589 function isJSDocCommentContainingNode(node: Node): boolean;
3590 function isSetAccessor(node: Node): node is SetAccessorDeclaration;
3591 function isGetAccessor(node: Node): node is GetAccessorDeclaration;
3592 function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
3593 function isStringLiteralLike(node: Node): node is StringLiteralLike;
3594}
3595declare namespace ts {
3596 function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
3597 /**
3598 * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
3599 * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
3600 * embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns
3601 * a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.
3602 *
3603 * @param node a given node to visit its children
3604 * @param cbNode a callback to be invoked for all child nodes
3605 * @param cbNodes a callback to be invoked for embedded array
3606 *
3607 * @remarks `forEachChild` must visit the children of a node in the order
3608 * that they appear in the source code. The language service depends on this property to locate nodes by position.
3609 */
3610 function forEachChild<T>(node: Node, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
3611 function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
3612 function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName | undefined;
3613 /**
3614 * Parse json text into SyntaxTree and return node and parse errors if any
3615 * @param fileName
3616 * @param sourceText
3617 */
3618 function parseJsonText(fileName: string, sourceText: string): JsonSourceFile;
3619 function isExternalModule(file: SourceFile): boolean;
3620 function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
3621}
3622declare namespace ts {
3623 function parseCommandLine(commandLine: ReadonlyArray<string>, readFile?: (path: string) => string | undefined): ParsedCommandLine;
3624 type DiagnosticReporter = (diagnostic: Diagnostic) => void;
3625 /**
3626 * Reports config file diagnostics
3627 */
3628 interface ConfigFileDiagnosticsReporter {
3629 /**
3630 * Reports unrecoverable error when parsing config file
3631 */
3632 onUnRecoverableConfigFileDiagnostic: DiagnosticReporter;
3633 }
3634 /**
3635 * Interface extending ParseConfigHost to support ParseConfigFile that reads config file and reports errors
3636 */
3637 interface ParseConfigFileHost extends ParseConfigHost, ConfigFileDiagnosticsReporter {
3638 getCurrentDirectory(): string;
3639 }
3640 /**
3641 * Reads the config file, reports errors if any and exits if the config file cannot be found
3642 */
3643 function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine | undefined;
3644 /**
3645 * Read tsconfig.json file
3646 * @param fileName The path to the config file
3647 */
3648 function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): {
3649 config?: any;
3650 error?: Diagnostic;
3651 };
3652 /**
3653 * Parse the text of the tsconfig.json file
3654 * @param fileName The path to the config file
3655 * @param jsonText The text of the config file
3656 */
3657 function parseConfigFileTextToJson(fileName: string, jsonText: string): {
3658 config?: any;
3659 error?: Diagnostic;
3660 };
3661 /**
3662 * Read tsconfig.json file
3663 * @param fileName The path to the config file
3664 */
3665 function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): TsConfigSourceFile;
3666 /**
3667 * Convert the json syntax tree into the json value
3668 */
3669 function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any;
3670 /**
3671 * Parse the contents of a config file (tsconfig.json).
3672 * @param json The contents of the config file to parse
3673 * @param host Instance of ParseConfigHost used to enumerate files in folder.
3674 * @param basePath A root directory to resolve relative path entries in the config
3675 * file to. e.g. outDir
3676 */
3677 function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
3678 /**
3679 * Parse the contents of a config file (tsconfig.json).
3680 * @param jsonNode The contents of the config file to parse
3681 * @param host Instance of ParseConfigHost used to enumerate files in folder.
3682 * @param basePath A root directory to resolve relative path entries in the config
3683 * file to. e.g. outDir
3684 */
3685 function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
3686 interface ParsedTsconfig {
3687 raw: any;
3688 options?: CompilerOptions;
3689 typeAcquisition?: TypeAcquisition;
3690 /**
3691 * Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
3692 */
3693 extendedConfigPath?: string;
3694 }
3695 interface ExtendedConfigCacheEntry {
3696 extendedResult: TsConfigSourceFile;
3697 extendedConfig: ParsedTsconfig | undefined;
3698 }
3699 function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
3700 options: CompilerOptions;
3701 errors: Diagnostic[];
3702 };
3703 function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
3704 options: TypeAcquisition;
3705 errors: Diagnostic[];
3706 };
3707}
3708declare namespace ts {
3709 function getEffectiveTypeRoots(options: CompilerOptions, host: GetEffectiveTypeRootsHost): string[] | undefined;
3710 /**
3711 * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.
3712 * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
3713 * is assumed to be the same as root directory of the project.
3714 */
3715 function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
3716 /**
3717 * Given a set of options, returns the set of type directive names
3718 * that should be included for this program automatically.
3719 * This list could either come from the config file,
3720 * or from enumerating the types root + initial secondary types lookup location.
3721 * More type directives might appear in the program later as a result of loading actual source files;
3722 * this list is only the set of defaults that are implicitly included.
3723 */
3724 function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
3725 /**
3726 * Cached module resolutions per containing directory.
3727 * This assumes that any module id will have the same resolution for sibling files located in the same folder.
3728 */
3729 interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
3730 getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<ResolvedModuleWithFailedLookupLocations>;
3731 }
3732 /**
3733 * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
3734 * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
3735 */
3736 interface NonRelativeModuleNameResolutionCache {
3737 getOrCreateCacheForModuleName(nonRelativeModuleName: string, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
3738 }
3739 interface PerModuleNameCache {
3740 get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
3741 set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
3742 }
3743 function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
3744 function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
3745 function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
3746 function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
3747 function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
3748}
3749declare namespace ts {
3750 function createNodeArray<T extends Node>(elements?: ReadonlyArray<T>, hasTrailingComma?: boolean): NodeArray<T>;
3751 /** If a node is passed, creates a string literal whose source text is read from a source node during emit. */
3752 function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral;
3753 function createLiteral(value: number | PseudoBigInt): NumericLiteral;
3754 function createLiteral(value: boolean): BooleanLiteral;
3755 function createLiteral(value: string | number | PseudoBigInt | boolean): PrimaryExpression;
3756 function createNumericLiteral(value: string, numericLiteralFlags?: TokenFlags): NumericLiteral;
3757 function createBigIntLiteral(value: string): BigIntLiteral;
3758 function createStringLiteral(text: string): StringLiteral;
3759 function createRegularExpressionLiteral(text: string): RegularExpressionLiteral;
3760 function createIdentifier(text: string): Identifier;
3761 function updateIdentifier(node: Identifier): Identifier;
3762 /** Create a unique temporary variable. */
3763 function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier;
3764 /** Create a unique temporary variable for use in a loop. */
3765 function createLoopVariable(): Identifier;
3766 /** Create a unique name based on the supplied text. */
3767 function createUniqueName(text: string): Identifier;
3768 /** Create a unique name based on the supplied text. */
3769 function createOptimisticUniqueName(text: string): Identifier;
3770 /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */
3771 function createFileLevelUniqueName(text: string): Identifier;
3772 /** Create a unique name generated for a node. */
3773 function getGeneratedNameForNode(node: Node | undefined): Identifier;
3774 function createToken<TKind extends SyntaxKind>(token: TKind): Token<TKind>;
3775 function createSuper(): SuperExpression;
3776 function createThis(): ThisExpression & Token<SyntaxKind.ThisKeyword>;
3777 function createNull(): NullLiteral & Token<SyntaxKind.NullKeyword>;
3778 function createTrue(): BooleanLiteral & Token<SyntaxKind.TrueKeyword>;
3779 function createFalse(): BooleanLiteral & Token<SyntaxKind.FalseKeyword>;
3780 function createModifier<T extends Modifier["kind"]>(kind: T): Token<T>;
3781 function createModifiersFromModifierFlags(flags: ModifierFlags): Modifier[];
3782 function createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName;
3783 function updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName;
3784 function createComputedPropertyName(expression: Expression): ComputedPropertyName;
3785 function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName;
3786 function createTypeParameterDeclaration(name: string | Identifier, constraint?: TypeNode, defaultType?: TypeNode): TypeParameterDeclaration;
3787 function updateTypeParameterDeclaration(node: TypeParameterDeclaration, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration;
3788 function createParameter(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration;
3789 function updateParameter(node: ParameterDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration;
3790 function createDecorator(expression: Expression): Decorator;
3791 function updateDecorator(node: Decorator, expression: Expression): Decorator;
3792 function createPropertySignature(modifiers: ReadonlyArray<Modifier> | undefined, name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature;
3793 function updatePropertySignature(node: PropertySignature, modifiers: ReadonlyArray<Modifier> | undefined, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature;
3794 function createProperty(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration;
3795 function updateProperty(node: PropertyDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration;
3796 function createMethodSignature(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined): MethodSignature;
3797 function updateMethodSignature(node: MethodSignature, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined, name: PropertyName, questionToken: QuestionToken | undefined): MethodSignature;
3798 function createMethod(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block | undefined): MethodDeclaration;
3799 function updateMethod(node: MethodDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block | undefined): MethodDeclaration;
3800 function createConstructor(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, body: Block | undefined): ConstructorDeclaration;
3801 function updateConstructor(node: ConstructorDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, body: Block | undefined): ConstructorDeclaration;
3802 function createGetAccessor(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | PropertyName, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration;
3803 function updateGetAccessor(node: GetAccessorDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: PropertyName, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration;
3804 function createSetAccessor(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | PropertyName, parameters: ReadonlyArray<ParameterDeclaration>, body: Block | undefined): SetAccessorDeclaration;
3805 function updateSetAccessor(node: SetAccessorDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: PropertyName, parameters: ReadonlyArray<ParameterDeclaration>, body: Block | undefined): SetAccessorDeclaration;
3806 function createCallSignature(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration;
3807 function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration;
3808 function createConstructSignature(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined): ConstructSignatureDeclaration;
3809 function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): ConstructSignatureDeclaration;
3810 function createIndexSignature(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode): IndexSignatureDeclaration;
3811 function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode): IndexSignatureDeclaration;
3812 function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode;
3813 function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode;
3814 function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode;
3815 function createTypeReferenceNode(typeName: string | EntityName, typeArguments: ReadonlyArray<TypeNode> | undefined): TypeReferenceNode;
3816 function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray<TypeNode> | undefined): TypeReferenceNode;
3817 function createFunctionTypeNode(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined): FunctionTypeNode;
3818 function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): FunctionTypeNode;
3819 function createConstructorTypeNode(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined): ConstructorTypeNode;
3820 function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): ConstructorTypeNode;
3821 function createTypeQueryNode(exprName: EntityName): TypeQueryNode;
3822 function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode;
3823 function createTypeLiteralNode(members: ReadonlyArray<TypeElement> | undefined): TypeLiteralNode;
3824 function updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray<TypeElement>): TypeLiteralNode;
3825 function createArrayTypeNode(elementType: TypeNode): ArrayTypeNode;
3826 function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode;
3827 function createTupleTypeNode(elementTypes: ReadonlyArray<TypeNode>): TupleTypeNode;
3828 function updateTupleTypeNode(node: TupleTypeNode, elementTypes: ReadonlyArray<TypeNode>): TupleTypeNode;
3829 function createOptionalTypeNode(type: TypeNode): OptionalTypeNode;
3830 function updateOptionalTypeNode(node: OptionalTypeNode, type: TypeNode): OptionalTypeNode;
3831 function createRestTypeNode(type: TypeNode): RestTypeNode;
3832 function updateRestTypeNode(node: RestTypeNode, type: TypeNode): RestTypeNode;
3833 function createUnionTypeNode(types: ReadonlyArray<TypeNode>): UnionTypeNode;
3834 function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray<TypeNode>): UnionTypeNode;
3835 function createIntersectionTypeNode(types: ReadonlyArray<TypeNode>): IntersectionTypeNode;
3836 function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray<TypeNode>): IntersectionTypeNode;
3837 function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: ReadonlyArray<TypeNode>): UnionOrIntersectionTypeNode;
3838 function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode;
3839 function updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode;
3840 function createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode;
3841 function updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode;
3842 function createImportTypeNode(argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray<TypeNode>, isTypeOf?: boolean): ImportTypeNode;
3843 function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, qualifier?: EntityName, typeArguments?: ReadonlyArray<TypeNode>, isTypeOf?: boolean): ImportTypeNode;
3844 function createParenthesizedType(type: TypeNode): ParenthesizedTypeNode;
3845 function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode;
3846 function createThisTypeNode(): ThisTypeNode;
3847 function createTypeOperatorNode(type: TypeNode): TypeOperatorNode;
3848 function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode;
3849 function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode;
3850 function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
3851 function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
3852 function createMappedTypeNode(readonlyToken: ReadonlyToken | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode;
3853 function updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyToken | PlusToken | MinusToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | PlusToken | MinusToken | undefined, type: TypeNode | undefined): MappedTypeNode;
3854 function createLiteralTypeNode(literal: LiteralTypeNode["literal"]): LiteralTypeNode;
3855 function updateLiteralTypeNode(node: LiteralTypeNode, literal: LiteralTypeNode["literal"]): LiteralTypeNode;
3856 function createObjectBindingPattern(elements: ReadonlyArray<BindingElement>): ObjectBindingPattern;
3857 function updateObjectBindingPattern(node: ObjectBindingPattern, elements: ReadonlyArray<BindingElement>): ObjectBindingPattern;
3858 function createArrayBindingPattern(elements: ReadonlyArray<ArrayBindingElement>): ArrayBindingPattern;
3859 function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ReadonlyArray<ArrayBindingElement>): ArrayBindingPattern;
3860 function createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement;
3861 function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement;
3862 function createArrayLiteral(elements?: ReadonlyArray<Expression>, multiLine?: boolean): ArrayLiteralExpression;
3863 function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray<Expression>): ArrayLiteralExpression;
3864 function createObjectLiteral(properties?: ReadonlyArray<ObjectLiteralElementLike>, multiLine?: boolean): ObjectLiteralExpression;
3865 function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray<ObjectLiteralElementLike>): ObjectLiteralExpression;
3866 function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression;
3867 function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression;
3868 function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression;
3869 function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
3870 function createCall(expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): CallExpression;
3871 function updateCall(node: CallExpression, expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression>): CallExpression;
3872 function createNew(expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): NewExpression;
3873 function updateNew(node: NewExpression, expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): NewExpression;
3874 /** @deprecated */ function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
3875 function createTaggedTemplate(tag: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, template: TemplateLiteral): TaggedTemplateExpression;
3876 /** @deprecated */ function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
3877 function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, template: TemplateLiteral): TaggedTemplateExpression;
3878 function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion;
3879 function updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion;
3880 function createParen(expression: Expression): ParenthesizedExpression;
3881 function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression;
3882 function createFunctionExpression(modifiers: ReadonlyArray<Modifier> | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration> | undefined, type: TypeNode | undefined, body: Block): FunctionExpression;
3883 function updateFunctionExpression(node: FunctionExpression, modifiers: ReadonlyArray<Modifier> | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block): FunctionExpression;
3884 function createArrowFunction(modifiers: ReadonlyArray<Modifier> | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction;
3885 function updateArrowFunction(node: ArrowFunction, modifiers: ReadonlyArray<Modifier> | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, equalsGreaterThanToken: Token<SyntaxKind.EqualsGreaterThanToken>, body: ConciseBody): ArrowFunction;
3886 function createDelete(expression: Expression): DeleteExpression;
3887 function updateDelete(node: DeleteExpression, expression: Expression): DeleteExpression;
3888 function createTypeOf(expression: Expression): TypeOfExpression;
3889 function updateTypeOf(node: TypeOfExpression, expression: Expression): TypeOfExpression;
3890 function createVoid(expression: Expression): VoidExpression;
3891 function updateVoid(node: VoidExpression, expression: Expression): VoidExpression;
3892 function createAwait(expression: Expression): AwaitExpression;
3893 function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression;
3894 function createPrefix(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression;
3895 function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression;
3896 function createPostfix(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression;
3897 function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression;
3898 function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression;
3899 function updateBinary(node: BinaryExpression, left: Expression, right: Expression, operator?: BinaryOperator | BinaryOperatorToken): BinaryExpression;
3900 /** @deprecated */ function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression;
3901 function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression;
3902 function updateConditional(node: ConditionalExpression, condition: Expression, questionToken: Token<SyntaxKind.QuestionToken>, whenTrue: Expression, colonToken: Token<SyntaxKind.ColonToken>, whenFalse: Expression): ConditionalExpression;
3903 function createTemplateExpression(head: TemplateHead, templateSpans: ReadonlyArray<TemplateSpan>): TemplateExpression;
3904 function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: ReadonlyArray<TemplateSpan>): TemplateExpression;
3905 function createTemplateHead(text: string): TemplateHead;
3906 function createTemplateMiddle(text: string): TemplateMiddle;
3907 function createTemplateTail(text: string): TemplateTail;
3908 function createNoSubstitutionTemplateLiteral(text: string): NoSubstitutionTemplateLiteral;
3909 function createYield(expression?: Expression): YieldExpression;
3910 function createYield(asteriskToken: AsteriskToken | undefined, expression: Expression): YieldExpression;
3911 function updateYield(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression): YieldExpression;
3912 function createSpread(expression: Expression): SpreadElement;
3913 function updateSpread(node: SpreadElement, expression: Expression): SpreadElement;
3914 function createClassExpression(modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, heritageClauses: ReadonlyArray<HeritageClause> | undefined, members: ReadonlyArray<ClassElement>): ClassExpression;
3915 function updateClassExpression(node: ClassExpression, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, heritageClauses: ReadonlyArray<HeritageClause> | undefined, members: ReadonlyArray<ClassElement>): ClassExpression;
3916 function createOmittedExpression(): OmittedExpression;
3917 function createExpressionWithTypeArguments(typeArguments: ReadonlyArray<TypeNode> | undefined, expression: Expression): ExpressionWithTypeArguments;
3918 function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: ReadonlyArray<TypeNode> | undefined, expression: Expression): ExpressionWithTypeArguments;
3919 function createAsExpression(expression: Expression, type: TypeNode): AsExpression;
3920 function updateAsExpression(node: AsExpression, expression: Expression, type: TypeNode): AsExpression;
3921 function createNonNullExpression(expression: Expression): NonNullExpression;
3922 function updateNonNullExpression(node: NonNullExpression, expression: Expression): NonNullExpression;
3923 function createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty;
3924 function updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty;
3925 function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan;
3926 function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan;
3927 function createSemicolonClassElement(): SemicolonClassElement;
3928 function createBlock(statements: ReadonlyArray<Statement>, multiLine?: boolean): Block;
3929 function updateBlock(node: Block, statements: ReadonlyArray<Statement>): Block;
3930 function createVariableStatement(modifiers: ReadonlyArray<Modifier> | undefined, declarationList: VariableDeclarationList | ReadonlyArray<VariableDeclaration>): VariableStatement;
3931 function updateVariableStatement(node: VariableStatement, modifiers: ReadonlyArray<Modifier> | undefined, declarationList: VariableDeclarationList): VariableStatement;
3932 function createEmptyStatement(): EmptyStatement;
3933 function createExpressionStatement(expression: Expression): ExpressionStatement;
3934 function updateExpressionStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement;
3935 /** @deprecated Use `createExpressionStatement` instead. */
3936 const createStatement: typeof createExpressionStatement;
3937 /** @deprecated Use `updateExpressionStatement` instead. */
3938 const updateStatement: typeof updateExpressionStatement;
3939 function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement;
3940 function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined): IfStatement;
3941 function createDo(statement: Statement, expression: Expression): DoStatement;
3942 function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement;
3943 function createWhile(expression: Expression, statement: Statement): WhileStatement;
3944 function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement;
3945 function createFor(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement;
3946 function updateFor(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement;
3947 function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement;
3948 function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement;
3949 function createForOf(awaitModifier: AwaitKeywordToken | undefined, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement;
3950 function updateForOf(node: ForOfStatement, awaitModifier: AwaitKeywordToken | undefined, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement;
3951 function createContinue(label?: string | Identifier): ContinueStatement;
3952 function updateContinue(node: ContinueStatement, label: Identifier | undefined): ContinueStatement;
3953 function createBreak(label?: string | Identifier): BreakStatement;
3954 function updateBreak(node: BreakStatement, label: Identifier | undefined): BreakStatement;
3955 function createReturn(expression?: Expression): ReturnStatement;
3956 function updateReturn(node: ReturnStatement, expression: Expression | undefined): ReturnStatement;
3957 function createWith(expression: Expression, statement: Statement): WithStatement;
3958 function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement;
3959 function createSwitch(expression: Expression, caseBlock: CaseBlock): SwitchStatement;
3960 function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement;
3961 function createLabel(label: string | Identifier, statement: Statement): LabeledStatement;
3962 function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement;
3963 function createThrow(expression: Expression): ThrowStatement;
3964 function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement;
3965 function createTry(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement;
3966 function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement;
3967 function createDebuggerStatement(): DebuggerStatement;
3968 function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression): VariableDeclaration;
3969 function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration;
3970 function createVariableDeclarationList(declarations: ReadonlyArray<VariableDeclaration>, flags?: NodeFlags): VariableDeclarationList;
3971 function updateVariableDeclarationList(node: VariableDeclarationList, declarations: ReadonlyArray<VariableDeclaration>): VariableDeclarationList;
3972 function createFunctionDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration;
3973 function updateFunctionDeclaration(node: FunctionDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration;
3974 function createClassDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, heritageClauses: ReadonlyArray<HeritageClause> | undefined, members: ReadonlyArray<ClassElement>): ClassDeclaration;
3975 function updateClassDeclaration(node: ClassDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier | undefined, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, heritageClauses: ReadonlyArray<HeritageClause> | undefined, members: ReadonlyArray<ClassElement>): ClassDeclaration;
3976 function createInterfaceDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, heritageClauses: ReadonlyArray<HeritageClause> | undefined, members: ReadonlyArray<TypeElement>): InterfaceDeclaration;
3977 function updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, heritageClauses: ReadonlyArray<HeritageClause> | undefined, members: ReadonlyArray<TypeElement>): InterfaceDeclaration;
3978 function createTypeAliasDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, type: TypeNode): TypeAliasDeclaration;
3979 function updateTypeAliasDeclaration(node: TypeAliasDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, type: TypeNode): TypeAliasDeclaration;
3980 function createEnumDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier, members: ReadonlyArray<EnumMember>): EnumDeclaration;
3981 function updateEnumDeclaration(node: EnumDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier, members: ReadonlyArray<EnumMember>): EnumDeclaration;
3982 function createModuleDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration;
3983 function updateModuleDeclaration(node: ModuleDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration;
3984 function createModuleBlock(statements: ReadonlyArray<Statement>): ModuleBlock;
3985 function updateModuleBlock(node: ModuleBlock, statements: ReadonlyArray<Statement>): ModuleBlock;
3986 function createCaseBlock(clauses: ReadonlyArray<CaseOrDefaultClause>): CaseBlock;
3987 function updateCaseBlock(node: CaseBlock, clauses: ReadonlyArray<CaseOrDefaultClause>): CaseBlock;
3988 function createNamespaceExportDeclaration(name: string | Identifier): NamespaceExportDeclaration;
3989 function updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
3990 function createImportEqualsDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
3991 function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
3992 function createImportDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
3993 function updateImportDeclaration(node: ImportDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
3994 function createImportClause(name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3995 function updateImportClause(node: ImportClause, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
3996 function createNamespaceImport(name: Identifier): NamespaceImport;
3997 function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
3998 function createNamedImports(elements: ReadonlyArray<ImportSpecifier>): NamedImports;
3999 function updateNamedImports(node: NamedImports, elements: ReadonlyArray<ImportSpecifier>): NamedImports;
4000 function createImportSpecifier(propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
4001 function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
4002 function createExportAssignment(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
4003 function updateExportAssignment(node: ExportAssignment, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, expression: Expression): ExportAssignment;
4004 function createExportDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, exportClause: NamedExports | undefined, moduleSpecifier?: Expression): ExportDeclaration;
4005 function updateExportDeclaration(node: ExportDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, exportClause: NamedExports | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration;
4006 function createNamedExports(elements: ReadonlyArray<ExportSpecifier>): NamedExports;
4007 function updateNamedExports(node: NamedExports, elements: ReadonlyArray<ExportSpecifier>): NamedExports;
4008 function createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
4009 function updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier;
4010 function createExternalModuleReference(expression: Expression): ExternalModuleReference;
4011 function updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference;
4012 function createJsxElement(openingElement: JsxOpeningElement, children: ReadonlyArray<JsxChild>, closingElement: JsxClosingElement): JsxElement;
4013 function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: ReadonlyArray<JsxChild>, closingElement: JsxClosingElement): JsxElement;
4014 function createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
4015 function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
4016 function createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxOpeningElement;
4017 function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxOpeningElement;
4018 function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement;
4019 function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement;
4020 function createJsxFragment(openingFragment: JsxOpeningFragment, children: ReadonlyArray<JsxChild>, closingFragment: JsxClosingFragment): JsxFragment;
4021 function createJsxText(text: string, containsOnlyTriviaWhiteSpaces?: boolean): JsxText;
4022 function updateJsxText(node: JsxText, text: string, containsOnlyTriviaWhiteSpaces?: boolean): JsxText;
4023 function createJsxOpeningFragment(): JsxOpeningFragment;
4024 function createJsxJsxClosingFragment(): JsxClosingFragment;
4025 function updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: ReadonlyArray<JsxChild>, closingFragment: JsxClosingFragment): JsxFragment;
4026 function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute;
4027 function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute;
4028 function createJsxAttributes(properties: ReadonlyArray<JsxAttributeLike>): JsxAttributes;
4029 function updateJsxAttributes(node: JsxAttributes, properties: ReadonlyArray<JsxAttributeLike>): JsxAttributes;
4030 function createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute;
4031 function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute;
4032 function createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined): JsxExpression;
4033 function updateJsxExpression(node: JsxExpression, expression: Expression | undefined): JsxExpression;
4034 function createCaseClause(expression: Expression, statements: ReadonlyArray<Statement>): CaseClause;
4035 function updateCaseClause(node: CaseClause, expression: Expression, statements: ReadonlyArray<Statement>): CaseClause;
4036 function createDefaultClause(statements: ReadonlyArray<Statement>): DefaultClause;
4037 function updateDefaultClause(node: DefaultClause, statements: ReadonlyArray<Statement>): DefaultClause;
4038 function createHeritageClause(token: HeritageClause["token"], types: ReadonlyArray<ExpressionWithTypeArguments>): HeritageClause;
4039 function updateHeritageClause(node: HeritageClause, types: ReadonlyArray<ExpressionWithTypeArguments>): HeritageClause;
4040 function createCatchClause(variableDeclaration: string | VariableDeclaration | undefined, block: Block): CatchClause;
4041 function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration | undefined, block: Block): CatchClause;
4042 function createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment;
4043 function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment;
4044 function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression): ShorthandPropertyAssignment;
4045 function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined): ShorthandPropertyAssignment;
4046 function createSpreadAssignment(expression: Expression): SpreadAssignment;
4047 function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment;
4048 function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember;
4049 function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember;
4050 function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean, libReferences?: SourceFile["libReferenceDirectives"]): SourceFile;
4051 /**
4052 * Creates a shallow, memberwise clone of a node for mutation.
4053 */
4054 function getMutableClone<T extends Node>(node: T): T;
4055 /**
4056 * Creates a synthetic statement to act as a placeholder for a not-emitted statement in
4057 * order to preserve comments.
4058 *
4059 * @param original The original statement.
4060 */
4061 function createNotEmittedStatement(original: Node): NotEmittedStatement;
4062 /**
4063 * Creates a synthetic expression to act as a placeholder for a not-emitted expression in
4064 * order to preserve comments or sourcemap positions.
4065 *
4066 * @param expression The inner expression to emit.
4067 * @param original The original outer expression.
4068 * @param location The location for the expression. Defaults to the positions from "original" if provided.
4069 */
4070 function createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression;
4071 function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression;
4072 function createCommaList(elements: ReadonlyArray<Expression>): CommaListExpression;
4073 function updateCommaList(node: CommaListExpression, elements: ReadonlyArray<Expression>): CommaListExpression;
4074 function createBundle(sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
4075 function createUnparsedSourceFile(text: string): UnparsedSource;
4076 function createUnparsedSourceFile(inputFile: InputFiles, type: "js" | "dts", stripInternal?: boolean): UnparsedSource;
4077 function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
4078 function createInputFiles(javascriptText: string, declarationText: string): InputFiles;
4079 function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles;
4080 function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
4081 function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
4082 function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
4083 function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
4084 function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>): CallExpression;
4085 function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
4086 function createComma(left: Expression, right: Expression): Expression;
4087 function createLessThan(left: Expression, right: Expression): Expression;
4088 function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment;
4089 function createAssignment(left: Expression, right: Expression): BinaryExpression;
4090 function createStrictEquality(left: Expression, right: Expression): BinaryExpression;
4091 function createStrictInequality(left: Expression, right: Expression): BinaryExpression;
4092 function createAdd(left: Expression, right: Expression): BinaryExpression;
4093 function createSubtract(left: Expression, right: Expression): BinaryExpression;
4094 function createPostfixIncrement(operand: Expression): PostfixUnaryExpression;
4095 function createLogicalAnd(left: Expression, right: Expression): BinaryExpression;
4096 function createLogicalOr(left: Expression, right: Expression): BinaryExpression;
4097 function createLogicalNot(operand: Expression): PrefixUnaryExpression;
4098 function createVoidZero(): VoidExpression;
4099 function createExportDefault(expression: Expression): ExportAssignment;
4100 function createExternalModuleExport(exportName: Identifier): ExportDeclaration;
4101 /**
4102 * Clears any EmitNode entries from parse-tree nodes.
4103 * @param sourceFile A source file.
4104 */
4105 function disposeEmitNodes(sourceFile: SourceFile): void;
4106 function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T;
4107 /**
4108 * Sets flags that control emit behavior of a node.
4109 */
4110 function setEmitFlags<T extends Node>(node: T, emitFlags: EmitFlags): T;
4111 /**
4112 * Gets a custom text range to use when emitting source maps.
4113 */
4114 function getSourceMapRange(node: Node): SourceMapRange;
4115 /**
4116 * Sets a custom text range to use when emitting source maps.
4117 */
4118 function setSourceMapRange<T extends Node>(node: T, range: SourceMapRange | undefined): T;
4119 /**
4120 * Create an external source map source file reference
4121 */
4122 function createSourceMapSource(fileName: string, text: string, skipTrivia?: (pos: number) => number): SourceMapSource;
4123 /**
4124 * Gets the TextRange to use for source maps for a token of a node.
4125 */
4126 function getTokenSourceMapRange(node: Node, token: SyntaxKind): SourceMapRange | undefined;
4127 /**
4128 * Sets the TextRange to use for source maps for a token of a node.
4129 */
4130 function setTokenSourceMapRange<T extends Node>(node: T, token: SyntaxKind, range: SourceMapRange | undefined): T;
4131 /**
4132 * Gets a custom text range to use when emitting comments.
4133 */
4134 function getCommentRange(node: Node): TextRange;
4135 /**
4136 * Sets a custom text range to use when emitting comments.
4137 */
4138 function setCommentRange<T extends Node>(node: T, range: TextRange): T;
4139 function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined;
4140 function setSyntheticLeadingComments<T extends Node>(node: T, comments: SynthesizedComment[] | undefined): T;
4141 function addSyntheticLeadingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
4142 function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined;
4143 function setSyntheticTrailingComments<T extends Node>(node: T, comments: SynthesizedComment[] | undefined): T;
4144 function addSyntheticTrailingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
4145 function moveSyntheticComments<T extends Node>(node: T, original: Node): T;
4146 /**
4147 * Gets the constant value to emit for an expression.
4148 */
4149 function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): string | number | undefined;
4150 /**
4151 * Sets the constant value to emit for an expression.
4152 */
4153 function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: string | number): PropertyAccessExpression | ElementAccessExpression;
4154 /**
4155 * Adds an EmitHelper to a node.
4156 */
4157 function addEmitHelper<T extends Node>(node: T, helper: EmitHelper): T;
4158 /**
4159 * Add EmitHelpers to a node.
4160 */
4161 function addEmitHelpers<T extends Node>(node: T, helpers: EmitHelper[] | undefined): T;
4162 /**
4163 * Removes an EmitHelper from a node.
4164 */
4165 function removeEmitHelper(node: Node, helper: EmitHelper): boolean;
4166 /**
4167 * Gets the EmitHelpers of a node.
4168 */
4169 function getEmitHelpers(node: Node): EmitHelper[] | undefined;
4170 /**
4171 * Moves matching emit helpers from a source node to a target node.
4172 */
4173 function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void;
4174 function setOriginalNode<T extends Node>(node: T, original: Node | undefined): T;
4175}
4176declare namespace ts {
4177 /**
4178 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
4179 *
4180 * @param node The Node to visit.
4181 * @param visitor The callback used to visit the Node.
4182 * @param test A callback to execute to verify the Node is valid.
4183 * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
4184 */
4185 function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray<Node>) => T): T;
4186 /**
4187 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
4188 *
4189 * @param node The Node to visit.
4190 * @param visitor The callback used to visit the Node.
4191 * @param test A callback to execute to verify the Node is valid.
4192 * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
4193 */
4194 function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray<Node>) => T): T | undefined;
4195 /**
4196 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
4197 *
4198 * @param nodes The NodeArray to visit.
4199 * @param visitor The callback used to visit a Node.
4200 * @param test A node test to execute for each node.
4201 * @param start An optional value indicating the starting offset at which to start visiting.
4202 * @param count An optional value indicating the maximum number of nodes to visit.
4203 */
4204 function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
4205 /**
4206 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
4207 *
4208 * @param nodes The NodeArray to visit.
4209 * @param visitor The callback used to visit a Node.
4210 * @param test A node test to execute for each node.
4211 * @param start An optional value indicating the starting offset at which to start visiting.
4212 * @param count An optional value indicating the maximum number of nodes to visit.
4213 */
4214 function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
4215 /**
4216 * Starts a new lexical environment and visits a statement list, ending the lexical environment
4217 * and merging hoisted declarations upon completion.
4218 */
4219 function visitLexicalEnvironment(statements: NodeArray<Statement>, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray<Statement>;
4220 /**
4221 * Starts a new lexical environment and visits a parameter list, suspending the lexical
4222 * environment upon completion.
4223 */
4224 function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray<ParameterDeclaration>;
4225 /**
4226 * Resumes a suspended lexical environment and visits a function body, ending the lexical
4227 * environment and merging hoisted declarations upon completion.
4228 */
4229 function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody;
4230 /**
4231 * Resumes a suspended lexical environment and visits a function body, ending the lexical
4232 * environment and merging hoisted declarations upon completion.
4233 */
4234 function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined;
4235 /**
4236 * Resumes a suspended lexical environment and visits a concise body, ending the lexical
4237 * environment and merging hoisted declarations upon completion.
4238 */
4239 function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody;
4240 /**
4241 * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
4242 *
4243 * @param node The Node whose children will be visited.
4244 * @param visitor The callback used to visit each child.
4245 * @param context A lexical environment context for the visitor.
4246 */
4247 function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext): T;
4248 /**
4249 * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
4250 *
4251 * @param node The Node whose children will be visited.
4252 * @param visitor The callback used to visit each child.
4253 * @param context A lexical environment context for the visitor.
4254 */
4255 function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
4256}
4257declare namespace ts {
4258 function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer;
4259}
4260declare namespace ts {
4261 function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined;
4262 function resolveTripleslashReference(moduleName: string, containingFile: string): string;
4263 function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
4264 function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
4265 interface FormatDiagnosticsHost {
4266 getCurrentDirectory(): string;
4267 getCanonicalFileName(fileName: string): string;
4268 getNewLine(): string;
4269 }
4270 function formatDiagnostics(diagnostics: ReadonlyArray<Diagnostic>, host: FormatDiagnosticsHost): string;
4271 function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string;
4272 function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray<Diagnostic>, host: FormatDiagnosticsHost): string;
4273 function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string;
4274 function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray<Diagnostic>;
4275 /**
4276 * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
4277 * that represent a compilation unit.
4278 *
4279 * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and
4280 * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
4281 *
4282 * @param createProgramOptions - The options for creating a program.
4283 * @returns A 'Program' object.
4284 */
4285 function createProgram(createProgramOptions: CreateProgramOptions): Program;
4286 /**
4287 * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
4288 * that represent a compilation unit.
4289 *
4290 * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and
4291 * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
4292 *
4293 * @param rootNames - A set of root files.
4294 * @param options - The compiler options which should be used.
4295 * @param host - The host interacts with the underlying file system.
4296 * @param oldProgram - Reuses an old program structure.
4297 * @param configFileParsingDiagnostics - error during config file parsing
4298 * @returns A 'Program' object.
4299 */
4300 function createProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): Program;
4301 /** @deprecated */ interface ResolveProjectReferencePathHost {
4302 fileExists(fileName: string): boolean;
4303 }
4304 /**
4305 * Returns the target config filename of a project reference.
4306 * Note: The file might not exist.
4307 */
4308 function resolveProjectReferencePath(ref: ProjectReference): ResolvedConfigFileName;
4309 /** @deprecated */ function resolveProjectReferencePath(host: ResolveProjectReferencePathHost, ref: ProjectReference): ResolvedConfigFileName;
4310}
4311declare namespace ts {
4312 interface EmitOutput {
4313 outputFiles: OutputFile[];
4314 emitSkipped: boolean;
4315 }
4316 interface OutputFile {
4317 name: string;
4318 writeByteOrderMark: boolean;
4319 text: string;
4320 }
4321}
4322declare namespace ts {
4323 type AffectedFileResult<T> = {
4324 result: T;
4325 affected: SourceFile | Program;
4326 } | undefined;
4327 interface BuilderProgramHost {
4328 /**
4329 * return true if file names are treated with case sensitivity
4330 */
4331 useCaseSensitiveFileNames(): boolean;
4332 /**
4333 * If provided this would be used this hash instead of actual file shape text for detecting changes
4334 */
4335 createHash?: (data: string) => string;
4336 /**
4337 * When emit or emitNextAffectedFile are called without writeFile,
4338 * this callback if present would be used to write files
4339 */
4340 writeFile?: WriteFileCallback;
4341 }
4342 /**
4343 * Builder to manage the program state changes
4344 */
4345 interface BuilderProgram {
4346 /**
4347 * Returns current program
4348 */
4349 getProgram(): Program;
4350 /**
4351 * Get compiler options of the program
4352 */
4353 getCompilerOptions(): CompilerOptions;
4354 /**
4355 * Get the source file in the program with file name
4356 */
4357 getSourceFile(fileName: string): SourceFile | undefined;
4358 /**
4359 * Get a list of files in the program
4360 */
4361 getSourceFiles(): ReadonlyArray<SourceFile>;
4362 /**
4363 * Get the diagnostics for compiler options
4364 */
4365 getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
4366 /**
4367 * Get the diagnostics that dont belong to any file
4368 */
4369 getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
4370 /**
4371 * Get the diagnostics from config file parsing
4372 */
4373 getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
4374 /**
4375 * Get the syntax diagnostics, for all source files if source file is not supplied
4376 */
4377 getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
4378 /**
4379 * Get the declaration diagnostics, for all source files if source file is not supplied
4380 */
4381 getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
4382 /**
4383 * Get all the dependencies of the file
4384 */
4385 getAllDependencies(sourceFile: SourceFile): ReadonlyArray<string>;
4386 /**
4387 * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program
4388 * The semantic diagnostics are cached and managed here
4389 * Note that it is assumed that when asked about semantic diagnostics through this API,
4390 * the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics
4391 * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided,
4392 * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics
4393 */
4394 getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
4395 /**
4396 * Emits the JavaScript and declaration files.
4397 * When targetSource file is specified, emits the files corresponding to that source file,
4398 * otherwise for the whole program.
4399 * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified,
4400 * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified,
4401 * it will only emit all the affected files instead of whole program
4402 *
4403 * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
4404 * in that order would be used to write the files
4405 */
4406 emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
4407 /**
4408 * Get the current directory of the program
4409 */
4410 getCurrentDirectory(): string;
4411 }
4412 /**
4413 * The builder that caches the semantic diagnostics for the program and handles the changed files and affected files
4414 */
4415 interface SemanticDiagnosticsBuilderProgram extends BuilderProgram {
4416 /**
4417 * Gets the semantic diagnostics from the program for the next affected file and caches it
4418 * Returns undefined if the iteration is complete
4419 */
4420 getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult<ReadonlyArray<Diagnostic>>;
4421 }
4422 /**
4423 * The builder that can handle the changes in program and iterate through changed file to emit the files
4424 * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files
4425 */
4426 interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram {
4427 /**
4428 * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete
4429 * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
4430 * in that order would be used to write the files
4431 */
4432 emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult<EmitResult>;
4433 }
4434 /**
4435 * Create the builder to manage semantic diagnostics and cache them
4436 */
4437 function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): SemanticDiagnosticsBuilderProgram;
4438 function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray<string> | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>, projectReferences?: ReadonlyArray<ProjectReference>): SemanticDiagnosticsBuilderProgram;
4439 /**
4440 * Create the builder that can handle the changes in program and iterate through changed files
4441 * to emit the those files and manage semantic diagnostics cache as well
4442 */
4443 function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): EmitAndSemanticDiagnosticsBuilderProgram;
4444 function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray<string> | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>, projectReferences?: ReadonlyArray<ProjectReference>): EmitAndSemanticDiagnosticsBuilderProgram;
4445 /**
4446 * Creates a builder thats just abstraction over program and can be used with watch
4447 */
4448 function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): BuilderProgram;
4449 function createAbstractBuilder(rootNames: ReadonlyArray<string> | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>, projectReferences?: ReadonlyArray<ProjectReference>): BuilderProgram;
4450}
4451declare namespace ts {
4452 type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void;
4453 /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */
4454 type CreateProgram<T extends BuilderProgram> = (rootNames: ReadonlyArray<string> | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>, projectReferences?: ReadonlyArray<ProjectReference> | undefined) => T;
4455 /** Host that has watch functionality used in --watch mode */
4456 interface WatchHost {
4457 /** If provided, called with Diagnostic message that informs about change in watch status */
4458 onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions): void;
4459 /** Used to watch changes in source files, missing files needed to update the program or config file */
4460 watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
4461 /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */
4462 watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
4463 /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */
4464 setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
4465 /** If provided, will be used to reset existing delayed compilation */
4466 clearTimeout?(timeoutId: any): void;
4467 }
4468 interface ProgramHost<T extends BuilderProgram> {
4469 /**
4470 * Used to create the program when need for program creation or recreation detected
4471 */
4472 createProgram: CreateProgram<T>;
4473 useCaseSensitiveFileNames(): boolean;
4474 getNewLine(): string;
4475 getCurrentDirectory(): string;
4476 getDefaultLibFileName(options: CompilerOptions): string;
4477 getDefaultLibLocation?(): string;
4478 createHash?(data: string): string;
4479 /**
4480 * Use to check file presence for source files and
4481 * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well
4482 */
4483 fileExists(path: string): boolean;
4484 /**
4485 * Use to read file text for source files and
4486 * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well
4487 */
4488 readFile(path: string, encoding?: string): string | undefined;
4489 /** If provided, used for module resolution as well as to handle directory structure */
4490 directoryExists?(path: string): boolean;
4491 /** If provided, used in resolutions as well as handling directory structure */
4492 getDirectories?(path: string): string[];
4493 /** If provided, used to cache and handle directory structure modifications */
4494 readDirectory?(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
4495 /** Symbol links resolution */
4496 realpath?(path: string): string;
4497 /** If provided would be used to write log about compilation */
4498 trace?(s: string): void;
4499 /** If provided is used to get the environment variable */
4500 getEnvironmentVariable?(name: string): string | undefined;
4501 /** If provided, used to resolve the module names, otherwise typescript's default module resolution */
4502 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
4503 /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
4504 resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
4505 }
4506 interface WatchCompilerHost<T extends BuilderProgram> extends ProgramHost<T>, WatchHost {
4507 /** If provided, callback to invoke after every new program creation */
4508 afterProgramCreate?(program: T): void;
4509 }
4510 /**
4511 * Host to create watch with root files and options
4512 */
4513 interface WatchCompilerHostOfFilesAndCompilerOptions<T extends BuilderProgram> extends WatchCompilerHost<T> {
4514 /** root files to use to generate program */
4515 rootFiles: string[];
4516 /** Compiler options */
4517 options: CompilerOptions;
4518 /** Project References */
4519 projectReferences?: ReadonlyArray<ProjectReference>;
4520 }
4521 /**
4522 * Host to create watch with config file
4523 */
4524 interface WatchCompilerHostOfConfigFile<T extends BuilderProgram> extends WatchCompilerHost<T>, ConfigFileDiagnosticsReporter {
4525 /** Name of the config file to compile */
4526 configFileName: string;
4527 /** Options to extend */
4528 optionsToExtend?: CompilerOptions;
4529 /**
4530 * Used to generate source file names from the config file and its include, exclude, files rules
4531 * and also to cache the directory stucture
4532 */
4533 readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
4534 }
4535 interface Watch<T> {
4536 /** Synchronize with host and get updated program */
4537 getProgram(): T;
4538 }
4539 /**
4540 * Creates the watch what generates program using the config file
4541 */
4542 interface WatchOfConfigFile<T> extends Watch<T> {
4543 }
4544 /**
4545 * Creates the watch that generates program using the root files and compiler options
4546 */
4547 interface WatchOfFilesAndCompilerOptions<T> extends Watch<T> {
4548 /** Updates the root files in the program, only if this is not config file compilation */
4549 updateRootFileNames(fileNames: string[]): void;
4550 }
4551 /**
4552 * Create the watch compiler host for either configFile or fileNames and its options
4553 */
4554 function createWatchCompilerHost<T extends BuilderProgram>(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfConfigFile<T>;
4555 function createWatchCompilerHost<T extends BuilderProgram>(rootFiles: string[], options: CompilerOptions, system: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter, projectReferences?: ReadonlyArray<ProjectReference>): WatchCompilerHostOfFilesAndCompilerOptions<T>;
4556 /**
4557 * Creates the watch from the host for root files and compiler options
4558 */
4559 function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfFilesAndCompilerOptions<T>): WatchOfFilesAndCompilerOptions<T>;
4560 /**
4561 * Creates the watch from the host for config file
4562 */
4563 function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfConfigFile<T>): WatchOfConfigFile<T>;
4564}
4565declare namespace ts.server {
4566 type ActionSet = "action::set";
4567 type ActionInvalidate = "action::invalidate";
4568 type ActionPackageInstalled = "action::packageInstalled";
4569 type EventTypesRegistry = "event::typesRegistry";
4570 type EventBeginInstallTypes = "event::beginInstallTypes";
4571 type EventEndInstallTypes = "event::endInstallTypes";
4572 type EventInitializationFailed = "event::initializationFailed";
4573 interface TypingInstallerResponse {
4574 readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
4575 }
4576 interface TypingInstallerRequestWithProjectName {
4577 readonly projectName: string;
4578 }
4579 interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
4580 readonly fileNames: string[];
4581 readonly projectRootPath: Path;
4582 readonly compilerOptions: CompilerOptions;
4583 readonly typeAcquisition: TypeAcquisition;
4584 readonly unresolvedImports: SortedReadonlyArray<string>;
4585 readonly cachePath?: string;
4586 readonly kind: "discover";
4587 }
4588 interface CloseProject extends TypingInstallerRequestWithProjectName {
4589 readonly kind: "closeProject";
4590 }
4591 interface TypesRegistryRequest {
4592 readonly kind: "typesRegistry";
4593 }
4594 interface InstallPackageRequest extends TypingInstallerRequestWithProjectName {
4595 readonly kind: "installPackage";
4596 readonly fileName: Path;
4597 readonly packageName: string;
4598 readonly projectRootPath: Path;
4599 }
4600 interface PackageInstalledResponse extends ProjectResponse {
4601 readonly kind: ActionPackageInstalled;
4602 readonly success: boolean;
4603 readonly message: string;
4604 }
4605 interface InitializationFailedResponse extends TypingInstallerResponse {
4606 readonly kind: EventInitializationFailed;
4607 readonly message: string;
4608 }
4609 interface ProjectResponse extends TypingInstallerResponse {
4610 readonly projectName: string;
4611 }
4612 interface InvalidateCachedTypings extends ProjectResponse {
4613 readonly kind: ActionInvalidate;
4614 }
4615 interface InstallTypes extends ProjectResponse {
4616 readonly kind: EventBeginInstallTypes | EventEndInstallTypes;
4617 readonly eventId: number;
4618 readonly typingsInstallerVersion: string;
4619 readonly packagesToInstall: ReadonlyArray<string>;
4620 }
4621 interface BeginInstallTypes extends InstallTypes {
4622 readonly kind: EventBeginInstallTypes;
4623 }
4624 interface EndInstallTypes extends InstallTypes {
4625 readonly kind: EventEndInstallTypes;
4626 readonly installSuccess: boolean;
4627 }
4628 interface SetTypings extends ProjectResponse {
4629 readonly typeAcquisition: TypeAcquisition;
4630 readonly compilerOptions: CompilerOptions;
4631 readonly typings: string[];
4632 readonly unresolvedImports: SortedReadonlyArray<string>;
4633 readonly kind: ActionSet;
4634 }
4635}
4636declare namespace ts {
4637 interface Node {
4638 getSourceFile(): SourceFile;
4639 getChildCount(sourceFile?: SourceFile): number;
4640 getChildAt(index: number, sourceFile?: SourceFile): Node;
4641 getChildren(sourceFile?: SourceFile): Node[];
4642 getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
4643 getFullStart(): number;
4644 getEnd(): number;
4645 getWidth(sourceFile?: SourceFileLike): number;
4646 getFullWidth(): number;
4647 getLeadingTriviaWidth(sourceFile?: SourceFile): number;
4648 getFullText(sourceFile?: SourceFile): string;
4649 getText(sourceFile?: SourceFile): string;
4650 getFirstToken(sourceFile?: SourceFile): Node | undefined;
4651 getLastToken(sourceFile?: SourceFile): Node | undefined;
4652 forEachChild<T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
4653 }
4654 interface Identifier {
4655 readonly text: string;
4656 }
4657 interface Symbol {
4658 readonly name: string;
4659 getFlags(): SymbolFlags;
4660 getEscapedName(): __String;
4661 getName(): string;
4662 getDeclarations(): Declaration[] | undefined;
4663 getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
4664 getJsDocTags(): JSDocTagInfo[];
4665 }
4666 interface Type {
4667 getFlags(): TypeFlags;
4668 getSymbol(): Symbol | undefined;
4669 getProperties(): Symbol[];
4670 getProperty(propertyName: string): Symbol | undefined;
4671 getApparentProperties(): Symbol[];
4672 getCallSignatures(): ReadonlyArray<Signature>;
4673 getConstructSignatures(): ReadonlyArray<Signature>;
4674 getStringIndexType(): Type | undefined;
4675 getNumberIndexType(): Type | undefined;
4676 getBaseTypes(): BaseType[] | undefined;
4677 getNonNullableType(): Type;
4678 getConstraint(): Type | undefined;
4679 getDefault(): Type | undefined;
4680 isUnion(): this is UnionType;
4681 isIntersection(): this is IntersectionType;
4682 isUnionOrIntersection(): this is UnionOrIntersectionType;
4683 isLiteral(): this is LiteralType;
4684 isStringLiteral(): this is StringLiteralType;
4685 isNumberLiteral(): this is NumberLiteralType;
4686 isTypeParameter(): this is TypeParameter;
4687 isClassOrInterface(): this is InterfaceType;
4688 isClass(): this is InterfaceType;
4689 }
4690 interface Signature {
4691 getDeclaration(): SignatureDeclaration;
4692 getTypeParameters(): TypeParameter[] | undefined;
4693 getParameters(): Symbol[];
4694 getReturnType(): Type;
4695 getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
4696 getJsDocTags(): JSDocTagInfo[];
4697 }
4698 interface SourceFile {
4699 getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
4700 getLineEndOfPosition(pos: number): number;
4701 getLineStarts(): ReadonlyArray<number>;
4702 getPositionOfLineAndCharacter(line: number, character: number): number;
4703 update(newText: string, textChangeRange: TextChangeRange): SourceFile;
4704 }
4705 interface SourceFileLike {
4706 getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
4707 }
4708 interface SourceMapSource {
4709 getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
4710 }
4711 /**
4712 * Represents an immutable snapshot of a script at a specified time.Once acquired, the
4713 * snapshot is observably immutable. i.e. the same calls with the same parameters will return
4714 * the same values.
4715 */
4716 interface IScriptSnapshot {
4717 /** Gets a portion of the script snapshot specified by [start, end). */
4718 getText(start: number, end: number): string;
4719 /** Gets the length of this script snapshot. */
4720 getLength(): number;
4721 /**
4722 * Gets the TextChangeRange that describe how the text changed between this text and
4723 * an older version. This information is used by the incremental parser to determine
4724 * what sections of the script need to be re-parsed. 'undefined' can be returned if the
4725 * change range cannot be determined. However, in that case, incremental parsing will
4726 * not happen and the entire document will be re - parsed.
4727 */
4728 getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
4729 /** Releases all resources held by this script snapshot */
4730 dispose?(): void;
4731 }
4732 namespace ScriptSnapshot {
4733 function fromString(text: string): IScriptSnapshot;
4734 }
4735 interface PreProcessedFileInfo {
4736 referencedFiles: FileReference[];
4737 typeReferenceDirectives: FileReference[];
4738 libReferenceDirectives: FileReference[];
4739 importedFiles: FileReference[];
4740 ambientExternalModules?: string[];
4741 isLibFile: boolean;
4742 }
4743 interface HostCancellationToken {
4744 isCancellationRequested(): boolean;
4745 }
4746 interface InstallPackageOptions {
4747 fileName: Path;
4748 packageName: string;
4749 }
4750 interface LanguageServiceHost extends GetEffectiveTypeRootsHost {
4751 getCompilationSettings(): CompilerOptions;
4752 getNewLine?(): string;
4753 getProjectVersion?(): string;
4754 getScriptFileNames(): string[];
4755 getScriptKind?(fileName: string): ScriptKind;
4756 getScriptVersion(fileName: string): string;
4757 getScriptSnapshot(fileName: string): IScriptSnapshot | undefined;
4758 getProjectReferences?(): ReadonlyArray<ProjectReference> | undefined;
4759 getLocalizedDiagnosticMessages?(): any;
4760 getCancellationToken?(): HostCancellationToken;
4761 getCurrentDirectory(): string;
4762 getDefaultLibFileName(options: CompilerOptions): string;
4763 log?(s: string): void;
4764 trace?(s: string): void;
4765 error?(s: string): void;
4766 useCaseSensitiveFileNames?(): boolean;
4767 readDirectory?(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
4768 readFile?(path: string, encoding?: string): string | undefined;
4769 realpath?(path: string): string;
4770 fileExists?(path: string): boolean;
4771 getTypeRootsVersion?(): number;
4772 resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
4773 getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
4774 resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
4775 getDirectories?(directoryName: string): string[];
4776 /**
4777 * Gets a set of custom transformers to use during emit.
4778 */
4779 getCustomTransformers?(): CustomTransformers | undefined;
4780 isKnownTypesPackageName?(name: string): boolean;
4781 installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
4782 writeFile?(fileName: string, content: string): void;
4783 }
4784 type WithMetadata<T> = T & {
4785 metadata?: unknown;
4786 };
4787 interface LanguageService {
4788 cleanupSemanticCache(): void;
4789 getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[];
4790 /** The first time this is called, it will return global diagnostics (no location). */
4791 getSemanticDiagnostics(fileName: string): Diagnostic[];
4792 getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[];
4793 getCompilerOptionsDiagnostics(): Diagnostic[];
4794 /**
4795 * @deprecated Use getEncodedSyntacticClassifications instead.
4796 */
4797 getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
4798 /**
4799 * @deprecated Use getEncodedSemanticClassifications instead.
4800 */
4801 getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
4802 getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
4803 getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
4804 getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): WithMetadata<CompletionInfo> | undefined;
4805 getCompletionEntryDetails(fileName: string, position: number, name: string, formatOptions: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined, preferences: UserPreferences | undefined): CompletionEntryDetails | undefined;
4806 getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol | undefined;
4807 getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined;
4808 getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan | undefined;
4809 getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan | undefined;
4810 getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
4811 getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
4812 findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray<RenameLocation> | undefined;
4813 getSmartSelectionRange(fileName: string, position: number): SelectionRange;
4814 getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
4815 getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
4816 getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
4817 getImplementationAtPosition(fileName: string, position: number): ReadonlyArray<ImplementationLocation> | undefined;
4818 getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] | undefined;
4819 findReferences(fileName: string, position: number): ReferencedSymbol[] | undefined;
4820 getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[] | undefined;
4821 /** @deprecated */
4822 getOccurrencesAtPosition(fileName: string, position: number): ReadonlyArray<ReferenceEntry> | undefined;
4823 getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[];
4824 getNavigationBarItems(fileName: string): NavigationBarItem[];
4825 getNavigationTree(fileName: string): NavigationTree;
4826 getOutliningSpans(fileName: string): OutliningSpan[];
4827 getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
4828 getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
4829 getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number;
4830 getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
4831 getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
4832 getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
4833 getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion | undefined;
4834 isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
4835 /**
4836 * 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.
4837 * Editors should call this after `>` is typed.
4838 */
4839 getJsxClosingTagAtPosition(fileName: string, position: number): JsxClosingTagInfo | undefined;
4840 getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan | undefined;
4841 toLineColumnOffset?(fileName: string, position: number): LineAndCharacter;
4842 getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions: FormatCodeSettings, preferences: UserPreferences): ReadonlyArray<CodeFixAction>;
4843 getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions;
4844 applyCodeActionCommand(action: CodeActionCommand, formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult>;
4845 applyCodeActionCommand(action: CodeActionCommand[], formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult[]>;
4846 applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[], formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
4847 /** @deprecated `fileName` will be ignored */
4848 applyCodeActionCommand(fileName: string, action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
4849 /** @deprecated `fileName` will be ignored */
4850 applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
4851 /** @deprecated `fileName` will be ignored */
4852 applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
4853 getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
4854 getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
4855 organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
4856 getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
4857 getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
4858 getProgram(): Program | undefined;
4859 dispose(): void;
4860 }
4861 interface JsxClosingTagInfo {
4862 readonly newText: string;
4863 }
4864 interface CombinedCodeFixScope {
4865 type: "file";
4866 fileName: string;
4867 }
4868 type OrganizeImportsScope = CombinedCodeFixScope;
4869 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<";
4870 interface GetCompletionsAtPositionOptions extends UserPreferences {
4871 /**
4872 * If the editor is asking for completions because a certain character was typed
4873 * (as opposed to when the user explicitly requested them) this should be set.
4874 */
4875 triggerCharacter?: CompletionsTriggerCharacter;
4876 /** @deprecated Use includeCompletionsForModuleExports */
4877 includeExternalModuleExports?: boolean;
4878 /** @deprecated Use includeCompletionsWithInsertText */
4879 includeInsertTextCompletions?: boolean;
4880 }
4881 type SignatureHelpTriggerCharacter = "," | "(" | "<";
4882 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
4883 interface SignatureHelpItemsOptions {
4884 triggerReason?: SignatureHelpTriggerReason;
4885 }
4886 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
4887 /**
4888 * Signals that the user manually requested signature help.
4889 * The language service will unconditionally attempt to provide a result.
4890 */
4891 interface SignatureHelpInvokedReason {
4892 kind: "invoked";
4893 triggerCharacter?: undefined;
4894 }
4895 /**
4896 * Signals that the signature help request came from a user typing a character.
4897 * Depending on the character and the syntactic context, the request may or may not be served a result.
4898 */
4899 interface SignatureHelpCharacterTypedReason {
4900 kind: "characterTyped";
4901 /**
4902 * Character that was responsible for triggering signature help.
4903 */
4904 triggerCharacter: SignatureHelpTriggerCharacter;
4905 }
4906 /**
4907 * Signals that this signature help request came from typing a character or moving the cursor.
4908 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
4909 * The language service will unconditionally attempt to provide a result.
4910 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
4911 */
4912 interface SignatureHelpRetriggeredReason {
4913 kind: "retrigger";
4914 /**
4915 * Character that was responsible for triggering signature help.
4916 */
4917 triggerCharacter?: SignatureHelpRetriggerCharacter;
4918 }
4919 interface ApplyCodeActionCommandResult {
4920 successMessage: string;
4921 }
4922 interface Classifications {
4923 spans: number[];
4924 endOfLineState: EndOfLineState;
4925 }
4926 interface ClassifiedSpan {
4927 textSpan: TextSpan;
4928 classificationType: ClassificationTypeNames;
4929 }
4930 /**
4931 * Navigation bar interface designed for visual studio's dual-column layout.
4932 * This does not form a proper tree.
4933 * The navbar is returned as a list of top-level items, each of which has a list of child items.
4934 * Child items always have an empty array for their `childItems`.
4935 */
4936 interface NavigationBarItem {
4937 text: string;
4938 kind: ScriptElementKind;
4939 kindModifiers: string;
4940 spans: TextSpan[];
4941 childItems: NavigationBarItem[];
4942 indent: number;
4943 bolded: boolean;
4944 grayed: boolean;
4945 }
4946 /**
4947 * Node in a tree of nested declarations in a file.
4948 * The top node is always a script or module node.
4949 */
4950 interface NavigationTree {
4951 /** Name of the declaration, or a short description, e.g. "<class>". */
4952 text: string;
4953 kind: ScriptElementKind;
4954 /** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
4955 kindModifiers: string;
4956 /**
4957 * Spans of the nodes that generated this declaration.
4958 * There will be more than one if this is the result of merging.
4959 */
4960 spans: TextSpan[];
4961 nameSpan: TextSpan | undefined;
4962 /** Present if non-empty */
4963 childItems?: NavigationTree[];
4964 }
4965 interface TodoCommentDescriptor {
4966 text: string;
4967 priority: number;
4968 }
4969 interface TodoComment {
4970 descriptor: TodoCommentDescriptor;
4971 message: string;
4972 position: number;
4973 }
4974 interface TextChange {
4975 span: TextSpan;
4976 newText: string;
4977 }
4978 interface FileTextChanges {
4979 fileName: string;
4980 textChanges: TextChange[];
4981 isNewFile?: boolean;
4982 }
4983 interface CodeAction {
4984 /** Description of the code action to display in the UI of the editor */
4985 description: string;
4986 /** Text changes to apply to each file as part of the code action */
4987 changes: FileTextChanges[];
4988 /**
4989 * If the user accepts the code fix, the editor should send the action back in a `applyAction` request.
4990 * This allows the language service to have side effects (e.g. installing dependencies) upon a code fix.
4991 */
4992 commands?: CodeActionCommand[];
4993 }
4994 interface CodeFixAction extends CodeAction {
4995 /** Short name to identify the fix, for use by telemetry. */
4996 fixName: string;
4997 /**
4998 * If present, one may call 'getCombinedCodeFix' with this fixId.
4999 * This may be omitted to indicate that the code fix can't be applied in a group.
5000 */
5001 fixId?: {};
5002 fixAllDescription?: string;
5003 }
5004 interface CombinedCodeActions {
5005 changes: ReadonlyArray<FileTextChanges>;
5006 commands?: ReadonlyArray<CodeActionCommand>;
5007 }
5008 type CodeActionCommand = InstallPackageAction;
5009 interface InstallPackageAction {
5010 }
5011 /**
5012 * A set of one or more available refactoring actions, grouped under a parent refactoring.
5013 */
5014 interface ApplicableRefactorInfo {
5015 /**
5016 * The programmatic name of the refactoring
5017 */
5018 name: string;
5019 /**
5020 * A description of this refactoring category to show to the user.
5021 * If the refactoring gets inlined (see below), this text will not be visible.
5022 */
5023 description: string;
5024 /**
5025 * Inlineable refactorings can have their actions hoisted out to the top level
5026 * of a context menu. Non-inlineanable refactorings should always be shown inside
5027 * their parent grouping.
5028 *
5029 * If not specified, this value is assumed to be 'true'
5030 */
5031 inlineable?: boolean;
5032 actions: RefactorActionInfo[];
5033 }
5034 /**
5035 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
5036 * offer several actions, each corresponding to a surround class or closure to extract into.
5037 */
5038 interface RefactorActionInfo {
5039 /**
5040 * The programmatic name of the refactoring action
5041 */
5042 name: string;
5043 /**
5044 * A description of this refactoring action to show to the user.
5045 * If the parent refactoring is inlined away, this will be the only text shown,
5046 * so this description should make sense by itself if the parent is inlineable=true
5047 */
5048 description: string;
5049 }
5050 /**
5051 * A set of edits to make in response to a refactor action, plus an optional
5052 * location where renaming should be invoked from
5053 */
5054 interface RefactorEditInfo {
5055 edits: FileTextChanges[];
5056 renameFilename?: string;
5057 renameLocation?: number;
5058 commands?: CodeActionCommand[];
5059 }
5060 interface TextInsertion {
5061 newText: string;
5062 /** The position in newText the caret should point to after the insertion. */
5063 caretOffset: number;
5064 }
5065 interface DocumentSpan {
5066 textSpan: TextSpan;
5067 fileName: string;
5068 /**
5069 * If the span represents a location that was remapped (e.g. via a .d.ts.map file),
5070 * then the original filename and span will be specified here
5071 */
5072 originalTextSpan?: TextSpan;
5073 originalFileName?: string;
5074 }
5075 interface RenameLocation extends DocumentSpan {
5076 readonly prefixText?: string;
5077 readonly suffixText?: string;
5078 }
5079 interface ReferenceEntry extends DocumentSpan {
5080 isWriteAccess: boolean;
5081 isDefinition: boolean;
5082 isInString?: true;
5083 }
5084 interface ImplementationLocation extends DocumentSpan {
5085 kind: ScriptElementKind;
5086 displayParts: SymbolDisplayPart[];
5087 }
5088 interface DocumentHighlights {
5089 fileName: string;
5090 highlightSpans: HighlightSpan[];
5091 }
5092 enum HighlightSpanKind {
5093 none = "none",
5094 definition = "definition",
5095 reference = "reference",
5096 writtenReference = "writtenReference"
5097 }
5098 interface HighlightSpan {
5099 fileName?: string;
5100 isInString?: true;
5101 textSpan: TextSpan;
5102 kind: HighlightSpanKind;
5103 }
5104 interface NavigateToItem {
5105 name: string;
5106 kind: ScriptElementKind;
5107 kindModifiers: string;
5108 matchKind: "exact" | "prefix" | "substring" | "camelCase";
5109 isCaseSensitive: boolean;
5110 fileName: string;
5111 textSpan: TextSpan;
5112 containerName: string;
5113 containerKind: ScriptElementKind;
5114 }
5115 enum IndentStyle {
5116 None = 0,
5117 Block = 1,
5118 Smart = 2
5119 }
5120 interface EditorOptions {
5121 BaseIndentSize?: number;
5122 IndentSize: number;
5123 TabSize: number;
5124 NewLineCharacter: string;
5125 ConvertTabsToSpaces: boolean;
5126 IndentStyle: IndentStyle;
5127 }
5128 interface EditorSettings {
5129 baseIndentSize?: number;
5130 indentSize?: number;
5131 tabSize?: number;
5132 newLineCharacter?: string;
5133 convertTabsToSpaces?: boolean;
5134 indentStyle?: IndentStyle;
5135 }
5136 interface FormatCodeOptions extends EditorOptions {
5137 InsertSpaceAfterCommaDelimiter: boolean;
5138 InsertSpaceAfterSemicolonInForStatements: boolean;
5139 InsertSpaceBeforeAndAfterBinaryOperators: boolean;
5140 InsertSpaceAfterConstructor?: boolean;
5141 InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
5142 InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
5143 InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
5144 InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
5145 InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
5146 InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
5147 InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
5148 InsertSpaceAfterTypeAssertion?: boolean;
5149 InsertSpaceBeforeFunctionParenthesis?: boolean;
5150 PlaceOpenBraceOnNewLineForFunctions: boolean;
5151 PlaceOpenBraceOnNewLineForControlBlocks: boolean;
5152 insertSpaceBeforeTypeAnnotation?: boolean;
5153 }
5154 interface FormatCodeSettings extends EditorSettings {
5155 readonly insertSpaceAfterCommaDelimiter?: boolean;
5156 readonly insertSpaceAfterSemicolonInForStatements?: boolean;
5157 readonly insertSpaceBeforeAndAfterBinaryOperators?: boolean;
5158 readonly insertSpaceAfterConstructor?: boolean;
5159 readonly insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
5160 readonly insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
5161 readonly insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
5162 readonly insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
5163 readonly insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
5164 readonly insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
5165 readonly insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
5166 readonly insertSpaceAfterTypeAssertion?: boolean;
5167 readonly insertSpaceBeforeFunctionParenthesis?: boolean;
5168 readonly placeOpenBraceOnNewLineForFunctions?: boolean;
5169 readonly placeOpenBraceOnNewLineForControlBlocks?: boolean;
5170 readonly insertSpaceBeforeTypeAnnotation?: boolean;
5171 readonly indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
5172 }
5173 function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings;
5174 interface DefinitionInfo extends DocumentSpan {
5175 kind: ScriptElementKind;
5176 name: string;
5177 containerKind: ScriptElementKind;
5178 containerName: string;
5179 }
5180 interface DefinitionInfoAndBoundSpan {
5181 definitions?: ReadonlyArray<DefinitionInfo>;
5182 textSpan: TextSpan;
5183 }
5184 interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
5185 displayParts: SymbolDisplayPart[];
5186 }
5187 interface ReferencedSymbol {
5188 definition: ReferencedSymbolDefinitionInfo;
5189 references: ReferenceEntry[];
5190 }
5191 enum SymbolDisplayPartKind {
5192 aliasName = 0,
5193 className = 1,
5194 enumName = 2,
5195 fieldName = 3,
5196 interfaceName = 4,
5197 keyword = 5,
5198 lineBreak = 6,
5199 numericLiteral = 7,
5200 stringLiteral = 8,
5201 localName = 9,
5202 methodName = 10,
5203 moduleName = 11,
5204 operator = 12,
5205 parameterName = 13,
5206 propertyName = 14,
5207 punctuation = 15,
5208 space = 16,
5209 text = 17,
5210 typeParameterName = 18,
5211 enumMemberName = 19,
5212 functionName = 20,
5213 regularExpressionLiteral = 21
5214 }
5215 interface SymbolDisplayPart {
5216 text: string;
5217 kind: string;
5218 }
5219 interface JSDocTagInfo {
5220 name: string;
5221 text?: string;
5222 }
5223 interface QuickInfo {
5224 kind: ScriptElementKind;
5225 kindModifiers: string;
5226 textSpan: TextSpan;
5227 displayParts?: SymbolDisplayPart[];
5228 documentation?: SymbolDisplayPart[];
5229 tags?: JSDocTagInfo[];
5230 }
5231 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
5232 interface RenameInfoSuccess {
5233 canRename: true;
5234 /**
5235 * File or directory to rename.
5236 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
5237 */
5238 fileToRename?: string;
5239 displayName: string;
5240 fullDisplayName: string;
5241 kind: ScriptElementKind;
5242 kindModifiers: string;
5243 triggerSpan: TextSpan;
5244 }
5245 interface RenameInfoFailure {
5246 canRename: false;
5247 localizedErrorMessage: string;
5248 }
5249 interface RenameInfoOptions {
5250 readonly allowRenameOfImportPath?: boolean;
5251 }
5252 interface SignatureHelpParameter {
5253 name: string;
5254 documentation: SymbolDisplayPart[];
5255 displayParts: SymbolDisplayPart[];
5256 isOptional: boolean;
5257 }
5258 interface SelectionRange {
5259 textSpan: TextSpan;
5260 parent?: SelectionRange;
5261 }
5262 /**
5263 * Represents a single signature to show in signature help.
5264 * The id is used for subsequent calls into the language service to ask questions about the
5265 * signature help item in the context of any documents that have been updated. i.e. after
5266 * an edit has happened, while signature help is still active, the host can ask important
5267 * questions like 'what parameter is the user currently contained within?'.
5268 */
5269 interface SignatureHelpItem {
5270 isVariadic: boolean;
5271 prefixDisplayParts: SymbolDisplayPart[];
5272 suffixDisplayParts: SymbolDisplayPart[];
5273 separatorDisplayParts: SymbolDisplayPart[];
5274 parameters: SignatureHelpParameter[];
5275 documentation: SymbolDisplayPart[];
5276 tags: JSDocTagInfo[];
5277 }
5278 /**
5279 * Represents a set of signature help items, and the preferred item that should be selected.
5280 */
5281 interface SignatureHelpItems {
5282 items: SignatureHelpItem[];
5283 applicableSpan: TextSpan;
5284 selectedItemIndex: number;
5285 argumentIndex: number;
5286 argumentCount: number;
5287 }
5288 interface CompletionInfo {
5289 /** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */
5290 isGlobalCompletion: boolean;
5291 isMemberCompletion: boolean;
5292 /**
5293 * true when the current location also allows for a new identifier
5294 */
5295 isNewIdentifierLocation: boolean;
5296 entries: CompletionEntry[];
5297 }
5298 interface CompletionEntry {
5299 name: string;
5300 kind: ScriptElementKind;
5301 kindModifiers?: string;
5302 sortText: string;
5303 insertText?: string;
5304 /**
5305 * An optional span that indicates the text to be replaced by this completion item.
5306 * If present, this span should be used instead of the default one.
5307 * It will be set if the required span differs from the one generated by the default replacement behavior.
5308 */
5309 replacementSpan?: TextSpan;
5310 hasAction?: true;
5311 source?: string;
5312 isRecommended?: true;
5313 }
5314 interface CompletionEntryDetails {
5315 name: string;
5316 kind: ScriptElementKind;
5317 kindModifiers: string;
5318 displayParts: SymbolDisplayPart[];
5319 documentation?: SymbolDisplayPart[];
5320 tags?: JSDocTagInfo[];
5321 codeActions?: CodeAction[];
5322 source?: SymbolDisplayPart[];
5323 }
5324 interface OutliningSpan {
5325 /** The span of the document to actually collapse. */
5326 textSpan: TextSpan;
5327 /** The span of the document to display when the user hovers over the collapsed span. */
5328 hintSpan: TextSpan;
5329 /** The text to display in the editor for the collapsed region. */
5330 bannerText: string;
5331 /**
5332 * Whether or not this region should be automatically collapsed when
5333 * the 'Collapse to Definitions' command is invoked.
5334 */
5335 autoCollapse: boolean;
5336 /**
5337 * Classification of the contents of the span
5338 */
5339 kind: OutliningSpanKind;
5340 }
5341 enum OutliningSpanKind {
5342 /** Single or multi-line comments */
5343 Comment = "comment",
5344 /** Sections marked by '// #region' and '// #endregion' comments */
5345 Region = "region",
5346 /** Declarations and expressions */
5347 Code = "code",
5348 /** Contiguous blocks of import declarations */
5349 Imports = "imports"
5350 }
5351 enum OutputFileType {
5352 JavaScript = 0,
5353 SourceMap = 1,
5354 Declaration = 2
5355 }
5356 enum EndOfLineState {
5357 None = 0,
5358 InMultiLineCommentTrivia = 1,
5359 InSingleQuoteStringLiteral = 2,
5360 InDoubleQuoteStringLiteral = 3,
5361 InTemplateHeadOrNoSubstitutionTemplate = 4,
5362 InTemplateMiddleOrTail = 5,
5363 InTemplateSubstitutionPosition = 6
5364 }
5365 enum TokenClass {
5366 Punctuation = 0,
5367 Keyword = 1,
5368 Operator = 2,
5369 Comment = 3,
5370 Whitespace = 4,
5371 Identifier = 5,
5372 NumberLiteral = 6,
5373 BigIntLiteral = 7,
5374 StringLiteral = 8,
5375 RegExpLiteral = 9
5376 }
5377 interface ClassificationResult {
5378 finalLexState: EndOfLineState;
5379 entries: ClassificationInfo[];
5380 }
5381 interface ClassificationInfo {
5382 length: number;
5383 classification: TokenClass;
5384 }
5385 interface Classifier {
5386 /**
5387 * Gives lexical classifications of tokens on a line without any syntactic context.
5388 * For instance, a token consisting of the text 'string' can be either an identifier
5389 * named 'string' or the keyword 'string', however, because this classifier is not aware,
5390 * it relies on certain heuristics to give acceptable results. For classifications where
5391 * speed trumps accuracy, this function is preferable; however, for true accuracy, the
5392 * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
5393 * lexical, syntactic, and semantic classifiers may issue the best user experience.
5394 *
5395 * @param text The text of a line to classify.
5396 * @param lexState The state of the lexical classifier at the end of the previous line.
5397 * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
5398 * If there is no syntactic classifier (syntacticClassifierAbsent=true),
5399 * certain heuristics may be used in its place; however, if there is a
5400 * syntactic classifier (syntacticClassifierAbsent=false), certain
5401 * classifications which may be incorrectly categorized will be given
5402 * back as Identifiers in order to allow the syntactic classifier to
5403 * subsume the classification.
5404 * @deprecated Use getLexicalClassifications instead.
5405 */
5406 getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
5407 getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
5408 }
5409 enum ScriptElementKind {
5410 unknown = "",
5411 warning = "warning",
5412 /** predefined type (void) or keyword (class) */
5413 keyword = "keyword",
5414 /** top level script node */
5415 scriptElement = "script",
5416 /** module foo {} */
5417 moduleElement = "module",
5418 /** class X {} */
5419 classElement = "class",
5420 /** var x = class X {} */
5421 localClassElement = "local class",
5422 /** interface Y {} */
5423 interfaceElement = "interface",
5424 /** type T = ... */
5425 typeElement = "type",
5426 /** enum E */
5427 enumElement = "enum",
5428 enumMemberElement = "enum member",
5429 /**
5430 * Inside module and script only
5431 * const v = ..
5432 */
5433 variableElement = "var",
5434 /** Inside function */
5435 localVariableElement = "local var",
5436 /**
5437 * Inside module and script only
5438 * function f() { }
5439 */
5440 functionElement = "function",
5441 /** Inside function */
5442 localFunctionElement = "local function",
5443 /** class X { [public|private]* foo() {} } */
5444 memberFunctionElement = "method",
5445 /** class X { [public|private]* [get|set] foo:number; } */
5446 memberGetAccessorElement = "getter",
5447 memberSetAccessorElement = "setter",
5448 /**
5449 * class X { [public|private]* foo:number; }
5450 * interface Y { foo:number; }
5451 */
5452 memberVariableElement = "property",
5453 /** class X { constructor() { } } */
5454 constructorImplementationElement = "constructor",
5455 /** interface Y { ():number; } */
5456 callSignatureElement = "call",
5457 /** interface Y { []:number; } */
5458 indexSignatureElement = "index",
5459 /** interface Y { new():Y; } */
5460 constructSignatureElement = "construct",
5461 /** function foo(*Y*: string) */
5462 parameterElement = "parameter",
5463 typeParameterElement = "type parameter",
5464 primitiveType = "primitive type",
5465 label = "label",
5466 alias = "alias",
5467 constElement = "const",
5468 letElement = "let",
5469 directory = "directory",
5470 externalModuleName = "external module name",
5471 /**
5472 * <JsxTagName attribute1 attribute2={0} />
5473 */
5474 jsxAttribute = "JSX attribute",
5475 /** String literal */
5476 string = "string"
5477 }
5478 enum ScriptElementKindModifier {
5479 none = "",
5480 publicMemberModifier = "public",
5481 privateMemberModifier = "private",
5482 protectedMemberModifier = "protected",
5483 exportedModifier = "export",
5484 ambientModifier = "declare",
5485 staticModifier = "static",
5486 abstractModifier = "abstract",
5487 optionalModifier = "optional",
5488 dtsModifier = ".d.ts",
5489 tsModifier = ".ts",
5490 tsxModifier = ".tsx",
5491 jsModifier = ".js",
5492 jsxModifier = ".jsx",
5493 jsonModifier = ".json"
5494 }
5495 enum ClassificationTypeNames {
5496 comment = "comment",
5497 identifier = "identifier",
5498 keyword = "keyword",
5499 numericLiteral = "number",
5500 bigintLiteral = "bigint",
5501 operator = "operator",
5502 stringLiteral = "string",
5503 whiteSpace = "whitespace",
5504 text = "text",
5505 punctuation = "punctuation",
5506 className = "class name",
5507 enumName = "enum name",
5508 interfaceName = "interface name",
5509 moduleName = "module name",
5510 typeParameterName = "type parameter name",
5511 typeAliasName = "type alias name",
5512 parameterName = "parameter name",
5513 docCommentTagName = "doc comment tag name",
5514 jsxOpenTagName = "jsx open tag name",
5515 jsxCloseTagName = "jsx close tag name",
5516 jsxSelfClosingTagName = "jsx self closing tag name",
5517 jsxAttribute = "jsx attribute",
5518 jsxText = "jsx text",
5519 jsxAttributeStringLiteralValue = "jsx attribute string literal value"
5520 }
5521 enum ClassificationType {
5522 comment = 1,
5523 identifier = 2,
5524 keyword = 3,
5525 numericLiteral = 4,
5526 operator = 5,
5527 stringLiteral = 6,
5528 regularExpressionLiteral = 7,
5529 whiteSpace = 8,
5530 text = 9,
5531 punctuation = 10,
5532 className = 11,
5533 enumName = 12,
5534 interfaceName = 13,
5535 moduleName = 14,
5536 typeParameterName = 15,
5537 typeAliasName = 16,
5538 parameterName = 17,
5539 docCommentTagName = 18,
5540 jsxOpenTagName = 19,
5541 jsxCloseTagName = 20,
5542 jsxSelfClosingTagName = 21,
5543 jsxAttribute = 22,
5544 jsxText = 23,
5545 jsxAttributeStringLiteralValue = 24,
5546 bigintLiteral = 25
5547 }
5548}
5549declare namespace ts {
5550 function createClassifier(): Classifier;
5551}
5552declare namespace ts {
5553 /**
5554 * The document registry represents a store of SourceFile objects that can be shared between
5555 * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)
5556 * of files in the context.
5557 * SourceFile objects account for most of the memory usage by the language service. Sharing
5558 * the same DocumentRegistry instance between different instances of LanguageService allow
5559 * for more efficient memory utilization since all projects will share at least the library
5560 * file (lib.d.ts).
5561 *
5562 * A more advanced use of the document registry is to serialize sourceFile objects to disk
5563 * and re-hydrate them when needed.
5564 *
5565 * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
5566 * to all subsequent createLanguageService calls.
5567 */
5568 interface DocumentRegistry {
5569 /**
5570 * Request a stored SourceFile with a given fileName and compilationSettings.
5571 * The first call to acquire will call createLanguageServiceSourceFile to generate
5572 * the SourceFile if was not found in the registry.
5573 *
5574 * @param fileName The name of the file requested
5575 * @param compilationSettings Some compilation settings like target affects the
5576 * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
5577 * multiple copies of the same file for different compilation settings.
5578 * @param scriptSnapshot Text of the file. Only used if the file was not found
5579 * in the registry and a new one was created.
5580 * @param version Current version of the file. Only used if the file was not found
5581 * in the registry and a new one was created.
5582 */
5583 acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
5584 acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
5585 /**
5586 * Request an updated version of an already existing SourceFile with a given fileName
5587 * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
5588 * to get an updated SourceFile.
5589 *
5590 * @param fileName The name of the file requested
5591 * @param compilationSettings Some compilation settings like target affects the
5592 * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
5593 * multiple copies of the same file for different compilation settings.
5594 * @param scriptSnapshot Text of the file.
5595 * @param version Current version of the file.
5596 */
5597 updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
5598 updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
5599 getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey;
5600 /**
5601 * Informs the DocumentRegistry that a file is not needed any longer.
5602 *
5603 * Note: It is not allowed to call release on a SourceFile that was not acquired from
5604 * this registry originally.
5605 *
5606 * @param fileName The name of the file to be released
5607 * @param compilationSettings The compilation settings used to acquire the file
5608 */
5609 releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
5610 releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void;
5611 reportStats(): string;
5612 }
5613 type DocumentRegistryBucketKey = string & {
5614 __bucketKey: any;
5615 };
5616 function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
5617}
5618declare namespace ts {
5619 function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
5620}
5621declare namespace ts {
5622 interface TranspileOptions {
5623 compilerOptions?: CompilerOptions;
5624 fileName?: string;
5625 reportDiagnostics?: boolean;
5626 moduleName?: string;
5627 renamedDependencies?: MapLike<string>;
5628 transformers?: CustomTransformers;
5629 }
5630 interface TranspileOutput {
5631 outputText: string;
5632 diagnostics?: Diagnostic[];
5633 sourceMapText?: string;
5634 }
5635 function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
5636 function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
5637}
5638declare namespace ts {
5639 /** The version of the language service API */
5640 const servicesVersion = "0.8";
5641 function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
5642 function displayPartsToString(displayParts: SymbolDisplayPart[] | undefined): string;
5643 function getDefaultCompilerOptions(): CompilerOptions;
5644 function getSupportedCodeFixes(): string[];
5645 function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
5646 let disableIncrementalParsing: boolean;
5647 function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange | undefined, aggressiveChecks?: boolean): SourceFile;
5648 function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService;
5649 /**
5650 * Get the path of the default library files (lib.d.ts) as distributed with the typescript
5651 * node package.
5652 * The functionality is not supported if the ts module is consumed outside of a node module.
5653 */
5654 function getDefaultLibFilePath(options: CompilerOptions): string;
5655}
5656declare namespace ts {
5657 /**
5658 * Transform one or more nodes using the supplied transformers.
5659 * @param source A single `Node` or an array of `Node` objects.
5660 * @param transformers An array of `TransformerFactory` callbacks used to process the transformation.
5661 * @param compilerOptions Optional compiler options.
5662 */
5663 function transform<T extends Node>(source: T | T[], transformers: TransformerFactory<T>[], compilerOptions?: CompilerOptions): TransformationResult<T>;
5664}
5665declare namespace ts.server {
5666 interface CompressedData {
5667 length: number;
5668 compressionKind: string;
5669 data: any;
5670 }
5671 type RequireResult = {
5672 module: {};
5673 error: undefined;
5674 } | {
5675 module: undefined;
5676 error: {
5677 stack?: string;
5678 message?: string;
5679 };
5680 };
5681 interface ServerHost extends System {
5682 watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
5683 watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
5684 setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
5685 clearTimeout(timeoutId: any): void;
5686 setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
5687 clearImmediate(timeoutId: any): void;
5688 gc?(): void;
5689 trace?(s: string): void;
5690 require?(initialPath: string, moduleName: string): RequireResult;
5691 }
5692}
5693declare namespace ts.server {
5694 enum LogLevel {
5695 terse = 0,
5696 normal = 1,
5697 requestTime = 2,
5698 verbose = 3
5699 }
5700 const emptyArray: SortedReadonlyArray<never>;
5701 interface Logger {
5702 close(): void;
5703 hasLevel(level: LogLevel): boolean;
5704 loggingEnabled(): boolean;
5705 perftrc(s: string): void;
5706 info(s: string): void;
5707 startGroup(): void;
5708 endGroup(): void;
5709 msg(s: string, type?: Msg): void;
5710 getLogFileName(): string | undefined;
5711 }
5712 enum Msg {
5713 Err = "Err",
5714 Info = "Info",
5715 Perf = "Perf"
5716 }
5717 namespace Msg {
5718 /** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */
5719 type Types = Msg;
5720 }
5721 function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
5722 namespace Errors {
5723 function ThrowNoProject(): never;
5724 function ThrowProjectLanguageServiceDisabled(): never;
5725 function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never;
5726 }
5727 type NormalizedPath = string & {
5728 __normalizedPathTag: any;
5729 };
5730 function toNormalizedPath(fileName: string): NormalizedPath;
5731 function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path;
5732 function asNormalizedPath(fileName: string): NormalizedPath;
5733 interface NormalizedPathMap<T> {
5734 get(path: NormalizedPath): T | undefined;
5735 set(path: NormalizedPath, value: T): void;
5736 contains(path: NormalizedPath): boolean;
5737 remove(path: NormalizedPath): void;
5738 }
5739 function createNormalizedPathMap<T>(): NormalizedPathMap<T>;
5740 function isInferredProjectName(name: string): boolean;
5741 function makeInferredProjectName(counter: number): string;
5742 function createSortedArray<T>(): SortedArray<T>;
5743}
5744/**
5745 * Declaration module describing the TypeScript Server protocol
5746 */
5747declare namespace ts.server.protocol {
5748 enum CommandTypes {
5749 JsxClosingTag = "jsxClosingTag",
5750 Brace = "brace",
5751 BraceCompletion = "braceCompletion",
5752 GetSpanOfEnclosingComment = "getSpanOfEnclosingComment",
5753 Change = "change",
5754 Close = "close",
5755 /** @deprecated Prefer CompletionInfo -- see comment on CompletionsResponse */
5756 Completions = "completions",
5757 CompletionInfo = "completionInfo",
5758 CompletionDetails = "completionEntryDetails",
5759 CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
5760 CompileOnSaveEmitFile = "compileOnSaveEmitFile",
5761 Configure = "configure",
5762 Definition = "definition",
5763 DefinitionAndBoundSpan = "definitionAndBoundSpan",
5764 Implementation = "implementation",
5765 Exit = "exit",
5766 Format = "format",
5767 Formatonkey = "formatonkey",
5768 Geterr = "geterr",
5769 GeterrForProject = "geterrForProject",
5770 SemanticDiagnosticsSync = "semanticDiagnosticsSync",
5771 SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
5772 SuggestionDiagnosticsSync = "suggestionDiagnosticsSync",
5773 NavBar = "navbar",
5774 Navto = "navto",
5775 NavTree = "navtree",
5776 NavTreeFull = "navtree-full",
5777 /** @deprecated */
5778 Occurrences = "occurrences",
5779 DocumentHighlights = "documentHighlights",
5780 Open = "open",
5781 Quickinfo = "quickinfo",
5782 References = "references",
5783 Reload = "reload",
5784 Rename = "rename",
5785 Saveto = "saveto",
5786 SignatureHelp = "signatureHelp",
5787 Status = "status",
5788 TypeDefinition = "typeDefinition",
5789 ProjectInfo = "projectInfo",
5790 ReloadProjects = "reloadProjects",
5791 Unknown = "unknown",
5792 OpenExternalProject = "openExternalProject",
5793 OpenExternalProjects = "openExternalProjects",
5794 CloseExternalProject = "closeExternalProject",
5795 UpdateOpen = "updateOpen",
5796 GetOutliningSpans = "getOutliningSpans",
5797 TodoComments = "todoComments",
5798 Indentation = "indentation",
5799 DocCommentTemplate = "docCommentTemplate",
5800 CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
5801 GetCodeFixes = "getCodeFixes",
5802 GetCombinedCodeFix = "getCombinedCodeFix",
5803 ApplyCodeActionCommand = "applyCodeActionCommand",
5804 GetSupportedCodeFixes = "getSupportedCodeFixes",
5805 GetApplicableRefactors = "getApplicableRefactors",
5806 GetEditsForRefactor = "getEditsForRefactor",
5807 OrganizeImports = "organizeImports",
5808 GetEditsForFileRename = "getEditsForFileRename",
5809 ConfigurePlugin = "configurePlugin",
5810 SelectionRange = "selectionRange",
5811 }
5812 /**
5813 * A TypeScript Server message
5814 */
5815 interface Message {
5816 /**
5817 * Sequence number of the message
5818 */
5819 seq: number;
5820 /**
5821 * One of "request", "response", or "event"
5822 */
5823 type: "request" | "response" | "event";
5824 }
5825 /**
5826 * Client-initiated request message
5827 */
5828 interface Request extends Message {
5829 type: "request";
5830 /**
5831 * The command to execute
5832 */
5833 command: string;
5834 /**
5835 * Object containing arguments for the command
5836 */
5837 arguments?: any;
5838 }
5839 /**
5840 * Request to reload the project structure for all the opened files
5841 */
5842 interface ReloadProjectsRequest extends Message {
5843 command: CommandTypes.ReloadProjects;
5844 }
5845 /**
5846 * Server-initiated event message
5847 */
5848 interface Event extends Message {
5849 type: "event";
5850 /**
5851 * Name of event
5852 */
5853 event: string;
5854 /**
5855 * Event-specific information
5856 */
5857 body?: any;
5858 }
5859 /**
5860 * Response by server to client request message.
5861 */
5862 interface Response extends Message {
5863 type: "response";
5864 /**
5865 * Sequence number of the request message.
5866 */
5867 request_seq: number;
5868 /**
5869 * Outcome of the request.
5870 */
5871 success: boolean;
5872 /**
5873 * The command requested.
5874 */
5875 command: string;
5876 /**
5877 * If success === false, this should always be provided.
5878 * Otherwise, may (or may not) contain a success message.
5879 */
5880 message?: string;
5881 /**
5882 * Contains message body if success === true.
5883 */
5884 body?: any;
5885 /**
5886 * Contains extra information that plugin can include to be passed on
5887 */
5888 metadata?: unknown;
5889 }
5890 /**
5891 * Arguments for FileRequest messages.
5892 */
5893 interface FileRequestArgs {
5894 /**
5895 * The file for the request (absolute pathname required).
5896 */
5897 file: string;
5898 projectFileName?: string;
5899 }
5900 interface StatusRequest extends Request {
5901 command: CommandTypes.Status;
5902 }
5903 interface StatusResponseBody {
5904 /**
5905 * The TypeScript version (`ts.version`).
5906 */
5907 version: string;
5908 }
5909 /**
5910 * Response to StatusRequest
5911 */
5912 interface StatusResponse extends Response {
5913 body: StatusResponseBody;
5914 }
5915 /**
5916 * Requests a JS Doc comment template for a given position
5917 */
5918 interface DocCommentTemplateRequest extends FileLocationRequest {
5919 command: CommandTypes.DocCommentTemplate;
5920 }
5921 /**
5922 * Response to DocCommentTemplateRequest
5923 */
5924 interface DocCommandTemplateResponse extends Response {
5925 body?: TextInsertion;
5926 }
5927 /**
5928 * A request to get TODO comments from the file
5929 */
5930 interface TodoCommentRequest extends FileRequest {
5931 command: CommandTypes.TodoComments;
5932 arguments: TodoCommentRequestArgs;
5933 }
5934 /**
5935 * Arguments for TodoCommentRequest request.
5936 */
5937 interface TodoCommentRequestArgs extends FileRequestArgs {
5938 /**
5939 * Array of target TodoCommentDescriptors that describes TODO comments to be found
5940 */
5941 descriptors: TodoCommentDescriptor[];
5942 }
5943 /**
5944 * Response for TodoCommentRequest request.
5945 */
5946 interface TodoCommentsResponse extends Response {
5947 body?: TodoComment[];
5948 }
5949 /**
5950 * A request to determine if the caret is inside a comment.
5951 */
5952 interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
5953 command: CommandTypes.GetSpanOfEnclosingComment;
5954 arguments: SpanOfEnclosingCommentRequestArgs;
5955 }
5956 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
5957 /**
5958 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
5959 */
5960 onlyMultiLine: boolean;
5961 }
5962 /**
5963 * Request to obtain outlining spans in file.
5964 */
5965 interface OutliningSpansRequest extends FileRequest {
5966 command: CommandTypes.GetOutliningSpans;
5967 }
5968 interface OutliningSpan {
5969 /** The span of the document to actually collapse. */
5970 textSpan: TextSpan;
5971 /** The span of the document to display when the user hovers over the collapsed span. */
5972 hintSpan: TextSpan;
5973 /** The text to display in the editor for the collapsed region. */
5974 bannerText: string;
5975 /**
5976 * Whether or not this region should be automatically collapsed when
5977 * the 'Collapse to Definitions' command is invoked.
5978 */
5979 autoCollapse: boolean;
5980 /**
5981 * Classification of the contents of the span
5982 */
5983 kind: OutliningSpanKind;
5984 }
5985 /**
5986 * Response to OutliningSpansRequest request.
5987 */
5988 interface OutliningSpansResponse extends Response {
5989 body?: OutliningSpan[];
5990 }
5991 /**
5992 * A request to get indentation for a location in file
5993 */
5994 interface IndentationRequest extends FileLocationRequest {
5995 command: CommandTypes.Indentation;
5996 arguments: IndentationRequestArgs;
5997 }
5998 /**
5999 * Response for IndentationRequest request.
6000 */
6001 interface IndentationResponse extends Response {
6002 body?: IndentationResult;
6003 }
6004 /**
6005 * Indentation result representing where indentation should be placed
6006 */
6007 interface IndentationResult {
6008 /**
6009 * The base position in the document that the indent should be relative to
6010 */
6011 position: number;
6012 /**
6013 * The number of columns the indent should be at relative to the position's column.
6014 */
6015 indentation: number;
6016 }
6017 /**
6018 * Arguments for IndentationRequest request.
6019 */
6020 interface IndentationRequestArgs extends FileLocationRequestArgs {
6021 /**
6022 * An optional set of settings to be used when computing indentation.
6023 * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings.
6024 */
6025 options?: EditorSettings;
6026 }
6027 /**
6028 * Arguments for ProjectInfoRequest request.
6029 */
6030 interface ProjectInfoRequestArgs extends FileRequestArgs {
6031 /**
6032 * Indicate if the file name list of the project is needed
6033 */
6034 needFileNameList: boolean;
6035 }
6036 /**
6037 * A request to get the project information of the current file.
6038 */
6039 interface ProjectInfoRequest extends Request {
6040 command: CommandTypes.ProjectInfo;
6041 arguments: ProjectInfoRequestArgs;
6042 }
6043 /**
6044 * A request to retrieve compiler options diagnostics for a project
6045 */
6046 interface CompilerOptionsDiagnosticsRequest extends Request {
6047 arguments: CompilerOptionsDiagnosticsRequestArgs;
6048 }
6049 /**
6050 * Arguments for CompilerOptionsDiagnosticsRequest request.
6051 */
6052 interface CompilerOptionsDiagnosticsRequestArgs {
6053 /**
6054 * Name of the project to retrieve compiler options diagnostics.
6055 */
6056 projectFileName: string;
6057 }
6058 /**
6059 * Response message body for "projectInfo" request
6060 */
6061 interface ProjectInfo {
6062 /**
6063 * For configured project, this is the normalized path of the 'tsconfig.json' file
6064 * For inferred project, this is undefined
6065 */
6066 configFileName: string;
6067 /**
6068 * The list of normalized file name in the project, including 'lib.d.ts'
6069 */
6070 fileNames?: string[];
6071 /**
6072 * Indicates if the project has a active language service instance
6073 */
6074 languageServiceDisabled?: boolean;
6075 }
6076 /**
6077 * Represents diagnostic info that includes location of diagnostic in two forms
6078 * - start position and length of the error span
6079 * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span.
6080 */
6081 interface DiagnosticWithLinePosition {
6082 message: string;
6083 start: number;
6084 length: number;
6085 startLocation: Location;
6086 endLocation: Location;
6087 category: string;
6088 code: number;
6089 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
6090 reportsUnnecessary?: {};
6091 relatedInformation?: DiagnosticRelatedInformation[];
6092 }
6093 /**
6094 * Response message for "projectInfo" request
6095 */
6096 interface ProjectInfoResponse extends Response {
6097 body?: ProjectInfo;
6098 }
6099 /**
6100 * Request whose sole parameter is a file name.
6101 */
6102 interface FileRequest extends Request {
6103 arguments: FileRequestArgs;
6104 }
6105 /**
6106 * Instances of this interface specify a location in a source file:
6107 * (file, line, character offset), where line and character offset are 1-based.
6108 */
6109 interface FileLocationRequestArgs extends FileRequestArgs {
6110 /**
6111 * The line number for the request (1-based).
6112 */
6113 line: number;
6114 /**
6115 * The character offset (on the line) for the request (1-based).
6116 */
6117 offset: number;
6118 }
6119 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
6120 /**
6121 * Request refactorings at a given position or selection area.
6122 */
6123 interface GetApplicableRefactorsRequest extends Request {
6124 command: CommandTypes.GetApplicableRefactors;
6125 arguments: GetApplicableRefactorsRequestArgs;
6126 }
6127 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs;
6128 /**
6129 * Response is a list of available refactorings.
6130 * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
6131 */
6132 interface GetApplicableRefactorsResponse extends Response {
6133 body?: ApplicableRefactorInfo[];
6134 }
6135 /**
6136 * A set of one or more available refactoring actions, grouped under a parent refactoring.
6137 */
6138 interface ApplicableRefactorInfo {
6139 /**
6140 * The programmatic name of the refactoring
6141 */
6142 name: string;
6143 /**
6144 * A description of this refactoring category to show to the user.
6145 * If the refactoring gets inlined (see below), this text will not be visible.
6146 */
6147 description: string;
6148 /**
6149 * Inlineable refactorings can have their actions hoisted out to the top level
6150 * of a context menu. Non-inlineanable refactorings should always be shown inside
6151 * their parent grouping.
6152 *
6153 * If not specified, this value is assumed to be 'true'
6154 */
6155 inlineable?: boolean;
6156 actions: RefactorActionInfo[];
6157 }
6158 /**
6159 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
6160 * offer several actions, each corresponding to a surround class or closure to extract into.
6161 */
6162 interface RefactorActionInfo {
6163 /**
6164 * The programmatic name of the refactoring action
6165 */
6166 name: string;
6167 /**
6168 * A description of this refactoring action to show to the user.
6169 * If the parent refactoring is inlined away, this will be the only text shown,
6170 * so this description should make sense by itself if the parent is inlineable=true
6171 */
6172 description: string;
6173 }
6174 interface GetEditsForRefactorRequest extends Request {
6175 command: CommandTypes.GetEditsForRefactor;
6176 arguments: GetEditsForRefactorRequestArgs;
6177 }
6178 /**
6179 * Request the edits that a particular refactoring action produces.
6180 * Callers must specify the name of the refactor and the name of the action.
6181 */
6182 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
6183 refactor: string;
6184 action: string;
6185 };
6186 interface GetEditsForRefactorResponse extends Response {
6187 body?: RefactorEditInfo;
6188 }
6189 interface RefactorEditInfo {
6190 edits: FileCodeEdits[];
6191 /**
6192 * An optional location where the editor should start a rename operation once
6193 * the refactoring edits have been applied
6194 */
6195 renameLocation?: Location;
6196 renameFilename?: string;
6197 }
6198 /**
6199 * Organize imports by:
6200 * 1) Removing unused imports
6201 * 2) Coalescing imports from the same module
6202 * 3) Sorting imports
6203 */
6204 interface OrganizeImportsRequest extends Request {
6205 command: CommandTypes.OrganizeImports;
6206 arguments: OrganizeImportsRequestArgs;
6207 }
6208 type OrganizeImportsScope = GetCombinedCodeFixScope;
6209 interface OrganizeImportsRequestArgs {
6210 scope: OrganizeImportsScope;
6211 }
6212 interface OrganizeImportsResponse extends Response {
6213 body: ReadonlyArray<FileCodeEdits>;
6214 }
6215 interface GetEditsForFileRenameRequest extends Request {
6216 command: CommandTypes.GetEditsForFileRename;
6217 arguments: GetEditsForFileRenameRequestArgs;
6218 }
6219 /** Note: Paths may also be directories. */
6220 interface GetEditsForFileRenameRequestArgs {
6221 readonly oldFilePath: string;
6222 readonly newFilePath: string;
6223 }
6224 interface GetEditsForFileRenameResponse extends Response {
6225 body: ReadonlyArray<FileCodeEdits>;
6226 }
6227 /**
6228 * Request for the available codefixes at a specific position.
6229 */
6230 interface CodeFixRequest extends Request {
6231 command: CommandTypes.GetCodeFixes;
6232 arguments: CodeFixRequestArgs;
6233 }
6234 interface GetCombinedCodeFixRequest extends Request {
6235 command: CommandTypes.GetCombinedCodeFix;
6236 arguments: GetCombinedCodeFixRequestArgs;
6237 }
6238 interface GetCombinedCodeFixResponse extends Response {
6239 body: CombinedCodeActions;
6240 }
6241 interface ApplyCodeActionCommandRequest extends Request {
6242 command: CommandTypes.ApplyCodeActionCommand;
6243 arguments: ApplyCodeActionCommandRequestArgs;
6244 }
6245 interface ApplyCodeActionCommandResponse extends Response {
6246 }
6247 interface FileRangeRequestArgs extends FileRequestArgs {
6248 /**
6249 * The line number for the request (1-based).
6250 */
6251 startLine: number;
6252 /**
6253 * The character offset (on the line) for the request (1-based).
6254 */
6255 startOffset: number;
6256 /**
6257 * The line number for the request (1-based).
6258 */
6259 endLine: number;
6260 /**
6261 * The character offset (on the line) for the request (1-based).
6262 */
6263 endOffset: number;
6264 }
6265 /**
6266 * Instances of this interface specify errorcodes on a specific location in a sourcefile.
6267 */
6268 interface CodeFixRequestArgs extends FileRangeRequestArgs {
6269 /**
6270 * Errorcodes we want to get the fixes for.
6271 */
6272 errorCodes: ReadonlyArray<number>;
6273 }
6274 interface GetCombinedCodeFixRequestArgs {
6275 scope: GetCombinedCodeFixScope;
6276 fixId: {};
6277 }
6278 interface GetCombinedCodeFixScope {
6279 type: "file";
6280 args: FileRequestArgs;
6281 }
6282 interface ApplyCodeActionCommandRequestArgs {
6283 /** May also be an array of commands. */
6284 command: {};
6285 }
6286 /**
6287 * Response for GetCodeFixes request.
6288 */
6289 interface GetCodeFixesResponse extends Response {
6290 body?: CodeAction[];
6291 }
6292 /**
6293 * A request whose arguments specify a file location (file, line, col).
6294 */
6295 interface FileLocationRequest extends FileRequest {
6296 arguments: FileLocationRequestArgs;
6297 }
6298 /**
6299 * A request to get codes of supported code fixes.
6300 */
6301 interface GetSupportedCodeFixesRequest extends Request {
6302 command: CommandTypes.GetSupportedCodeFixes;
6303 }
6304 /**
6305 * A response for GetSupportedCodeFixesRequest request.
6306 */
6307 interface GetSupportedCodeFixesResponse extends Response {
6308 /**
6309 * List of error codes supported by the server.
6310 */
6311 body?: string[];
6312 }
6313 /**
6314 * Arguments for EncodedSemanticClassificationsRequest request.
6315 */
6316 interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
6317 /**
6318 * Start position of the span.
6319 */
6320 start: number;
6321 /**
6322 * Length of the span.
6323 */
6324 length: number;
6325 }
6326 /**
6327 * Arguments in document highlight request; include: filesToSearch, file,
6328 * line, offset.
6329 */
6330 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
6331 /**
6332 * List of files to search for document highlights.
6333 */
6334 filesToSearch: string[];
6335 }
6336 /**
6337 * Go to definition request; value of command field is
6338 * "definition". Return response giving the file locations that
6339 * define the symbol found in file at location line, col.
6340 */
6341 interface DefinitionRequest extends FileLocationRequest {
6342 command: CommandTypes.Definition;
6343 }
6344 interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
6345 readonly command: CommandTypes.DefinitionAndBoundSpan;
6346 }
6347 interface DefinitionAndBoundSpanResponse extends Response {
6348 readonly body: DefinitionInfoAndBoundSpan;
6349 }
6350 /**
6351 * Go to type request; value of command field is
6352 * "typeDefinition". Return response giving the file locations that
6353 * define the type for the symbol found in file at location line, col.
6354 */
6355 interface TypeDefinitionRequest extends FileLocationRequest {
6356 command: CommandTypes.TypeDefinition;
6357 }
6358 /**
6359 * Go to implementation request; value of command field is
6360 * "implementation". Return response giving the file locations that
6361 * implement the symbol found in file at location line, col.
6362 */
6363 interface ImplementationRequest extends FileLocationRequest {
6364 command: CommandTypes.Implementation;
6365 }
6366 /**
6367 * Location in source code expressed as (one-based) line and (one-based) column offset.
6368 */
6369 interface Location {
6370 line: number;
6371 offset: number;
6372 }
6373 /**
6374 * Object found in response messages defining a span of text in source code.
6375 */
6376 interface TextSpan {
6377 /**
6378 * First character of the definition.
6379 */
6380 start: Location;
6381 /**
6382 * One character past last character of the definition.
6383 */
6384 end: Location;
6385 }
6386 /**
6387 * Object found in response messages defining a span of text in a specific source file.
6388 */
6389 interface FileSpan extends TextSpan {
6390 /**
6391 * File containing text span.
6392 */
6393 file: string;
6394 }
6395 interface DefinitionInfoAndBoundSpan {
6396 definitions: ReadonlyArray<FileSpan>;
6397 textSpan: TextSpan;
6398 }
6399 /**
6400 * Definition response message. Gives text range for definition.
6401 */
6402 interface DefinitionResponse extends Response {
6403 body?: FileSpan[];
6404 }
6405 interface DefinitionInfoAndBoundSpanReponse extends Response {
6406 body?: DefinitionInfoAndBoundSpan;
6407 }
6408 /**
6409 * Definition response message. Gives text range for definition.
6410 */
6411 interface TypeDefinitionResponse extends Response {
6412 body?: FileSpan[];
6413 }
6414 /**
6415 * Implementation response message. Gives text range for implementations.
6416 */
6417 interface ImplementationResponse extends Response {
6418 body?: FileSpan[];
6419 }
6420 /**
6421 * Request to get brace completion for a location in the file.
6422 */
6423 interface BraceCompletionRequest extends FileLocationRequest {
6424 command: CommandTypes.BraceCompletion;
6425 arguments: BraceCompletionRequestArgs;
6426 }
6427 /**
6428 * Argument for BraceCompletionRequest request.
6429 */
6430 interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
6431 /**
6432 * Kind of opening brace
6433 */
6434 openingBrace: string;
6435 }
6436 interface JsxClosingTagRequest extends FileLocationRequest {
6437 readonly command: CommandTypes.JsxClosingTag;
6438 readonly arguments: JsxClosingTagRequestArgs;
6439 }
6440 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {
6441 }
6442 interface JsxClosingTagResponse extends Response {
6443 readonly body: TextInsertion;
6444 }
6445 /**
6446 * @deprecated
6447 * Get occurrences request; value of command field is
6448 * "occurrences". Return response giving spans that are relevant
6449 * in the file at a given line and column.
6450 */
6451 interface OccurrencesRequest extends FileLocationRequest {
6452 command: CommandTypes.Occurrences;
6453 }
6454 /** @deprecated */
6455 interface OccurrencesResponseItem extends FileSpan {
6456 /**
6457 * True if the occurrence is a write location, false otherwise.
6458 */
6459 isWriteAccess: boolean;
6460 /**
6461 * True if the occurrence is in a string, undefined otherwise;
6462 */
6463 isInString?: true;
6464 }
6465 /** @deprecated */
6466 interface OccurrencesResponse extends Response {
6467 body?: OccurrencesResponseItem[];
6468 }
6469 /**
6470 * Get document highlights request; value of command field is
6471 * "documentHighlights". Return response giving spans that are relevant
6472 * in the file at a given line and column.
6473 */
6474 interface DocumentHighlightsRequest extends FileLocationRequest {
6475 command: CommandTypes.DocumentHighlights;
6476 arguments: DocumentHighlightsRequestArgs;
6477 }
6478 /**
6479 * Span augmented with extra information that denotes the kind of the highlighting to be used for span.
6480 */
6481 interface HighlightSpan extends TextSpan {
6482 kind: HighlightSpanKind;
6483 }
6484 /**
6485 * Represents a set of highligh spans for a give name
6486 */
6487 interface DocumentHighlightsItem {
6488 /**
6489 * File containing highlight spans.
6490 */
6491 file: string;
6492 /**
6493 * Spans to highlight in file.
6494 */
6495 highlightSpans: HighlightSpan[];
6496 }
6497 /**
6498 * Response for a DocumentHighlightsRequest request.
6499 */
6500 interface DocumentHighlightsResponse extends Response {
6501 body?: DocumentHighlightsItem[];
6502 }
6503 /**
6504 * Find references request; value of command field is
6505 * "references". Return response giving the file locations that
6506 * reference the symbol found in file at location line, col.
6507 */
6508 interface ReferencesRequest extends FileLocationRequest {
6509 command: CommandTypes.References;
6510 }
6511 interface ReferencesResponseItem extends FileSpan {
6512 /** Text of line containing the reference. Including this
6513 * with the response avoids latency of editor loading files
6514 * to show text of reference line (the server already has
6515 * loaded the referencing files).
6516 */
6517 lineText: string;
6518 /**
6519 * True if reference is a write location, false otherwise.
6520 */
6521 isWriteAccess: boolean;
6522 /**
6523 * True if reference is a definition, false otherwise.
6524 */
6525 isDefinition: boolean;
6526 }
6527 /**
6528 * The body of a "references" response message.
6529 */
6530 interface ReferencesResponseBody {
6531 /**
6532 * The file locations referencing the symbol.
6533 */
6534 refs: ReadonlyArray<ReferencesResponseItem>;
6535 /**
6536 * The name of the symbol.
6537 */
6538 symbolName: string;
6539 /**
6540 * The start character offset of the symbol (on the line provided by the references request).
6541 */
6542 symbolStartOffset: number;
6543 /**
6544 * The full display name of the symbol.
6545 */
6546 symbolDisplayString: string;
6547 }
6548 /**
6549 * Response to "references" request.
6550 */
6551 interface ReferencesResponse extends Response {
6552 body?: ReferencesResponseBody;
6553 }
6554 /**
6555 * Argument for RenameRequest request.
6556 */
6557 interface RenameRequestArgs extends FileLocationRequestArgs {
6558 /**
6559 * Should text at specified location be found/changed in comments?
6560 */
6561 findInComments?: boolean;
6562 /**
6563 * Should text at specified location be found/changed in strings?
6564 */
6565 findInStrings?: boolean;
6566 }
6567 /**
6568 * Rename request; value of command field is "rename". Return
6569 * response giving the file locations that reference the symbol
6570 * found in file at location line, col. Also return full display
6571 * name of the symbol so that client can print it unambiguously.
6572 */
6573 interface RenameRequest extends FileLocationRequest {
6574 command: CommandTypes.Rename;
6575 arguments: RenameRequestArgs;
6576 }
6577 /**
6578 * Information about the item to be renamed.
6579 */
6580 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
6581 interface RenameInfoSuccess {
6582 /**
6583 * True if item can be renamed.
6584 */
6585 canRename: true;
6586 /**
6587 * File or directory to rename.
6588 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
6589 */
6590 fileToRename?: string;
6591 /**
6592 * Display name of the item to be renamed.
6593 */
6594 displayName: string;
6595 /**
6596 * Full display name of item to be renamed.
6597 */
6598 fullDisplayName: string;
6599 /**
6600 * The items's kind (such as 'className' or 'parameterName' or plain 'text').
6601 */
6602 kind: ScriptElementKind;
6603 /**
6604 * Optional modifiers for the kind (such as 'public').
6605 */
6606 kindModifiers: string;
6607 /** Span of text to rename. */
6608 triggerSpan: TextSpan;
6609 }
6610 interface RenameInfoFailure {
6611 canRename: false;
6612 /**
6613 * Error message if item can not be renamed.
6614 */
6615 localizedErrorMessage: string;
6616 }
6617 /**
6618 * A group of text spans, all in 'file'.
6619 */
6620 interface SpanGroup {
6621 /** The file to which the spans apply */
6622 file: string;
6623 /** The text spans in this group */
6624 locs: RenameTextSpan[];
6625 }
6626 interface RenameTextSpan extends TextSpan {
6627 readonly prefixText?: string;
6628 readonly suffixText?: string;
6629 }
6630 interface RenameResponseBody {
6631 /**
6632 * Information about the item to be renamed.
6633 */
6634 info: RenameInfo;
6635 /**
6636 * An array of span groups (one per file) that refer to the item to be renamed.
6637 */
6638 locs: ReadonlyArray<SpanGroup>;
6639 }
6640 /**
6641 * Rename response message.
6642 */
6643 interface RenameResponse extends Response {
6644 body?: RenameResponseBody;
6645 }
6646 /**
6647 * Represents a file in external project.
6648 * External project is project whose set of files, compilation options and open\close state
6649 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio).
6650 * External project will exist even if all files in it are closed and should be closed explicitly.
6651 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will
6652 * create configured project for every config file but will maintain a link that these projects were created
6653 * as a result of opening external project so they should be removed once external project is closed.
6654 */
6655 interface ExternalFile {
6656 /**
6657 * Name of file file
6658 */
6659 fileName: string;
6660 /**
6661 * Script kind of the file
6662 */
6663 scriptKind?: ScriptKindName | ts.ScriptKind;
6664 /**
6665 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
6666 */
6667 hasMixedContent?: boolean;
6668 /**
6669 * Content of the file
6670 */
6671 content?: string;
6672 }
6673 /**
6674 * Represent an external project
6675 */
6676 interface ExternalProject {
6677 /**
6678 * Project name
6679 */
6680 projectFileName: string;
6681 /**
6682 * List of root files in project
6683 */
6684 rootFiles: ExternalFile[];
6685 /**
6686 * Compiler options for the project
6687 */
6688 options: ExternalProjectCompilerOptions;
6689 /**
6690 * @deprecated typingOptions. Use typeAcquisition instead
6691 */
6692 typingOptions?: TypeAcquisition;
6693 /**
6694 * Explicitly specified type acquisition for the project
6695 */
6696 typeAcquisition?: TypeAcquisition;
6697 }
6698 interface CompileOnSaveMixin {
6699 /**
6700 * If compile on save is enabled for the project
6701 */
6702 compileOnSave?: boolean;
6703 }
6704 /**
6705 * For external projects, some of the project settings are sent together with
6706 * compiler settings.
6707 */
6708 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin;
6709 /**
6710 * Represents a set of changes that happen in project
6711 */
6712 interface ProjectChanges {
6713 /**
6714 * List of added files
6715 */
6716 added: string[];
6717 /**
6718 * List of removed files
6719 */
6720 removed: string[];
6721 /**
6722 * List of updated files
6723 */
6724 updated: string[];
6725 }
6726 /**
6727 * Information found in a configure request.
6728 */
6729 interface ConfigureRequestArguments {
6730 /**
6731 * Information about the host, for example 'Emacs 24.4' or
6732 * 'Sublime Text version 3075'
6733 */
6734 hostInfo?: string;
6735 /**
6736 * If present, tab settings apply only to this file.
6737 */
6738 file?: string;
6739 /**
6740 * The format options to use during formatting and other code editing features.
6741 */
6742 formatOptions?: FormatCodeSettings;
6743 preferences?: UserPreferences;
6744 /**
6745 * The host's additional supported .js file extensions
6746 */
6747 extraFileExtensions?: FileExtensionInfo[];
6748 }
6749 /**
6750 * Configure request; value of command field is "configure". Specifies
6751 * host information, such as host type, tab size, and indent size.
6752 */
6753 interface ConfigureRequest extends Request {
6754 command: CommandTypes.Configure;
6755 arguments: ConfigureRequestArguments;
6756 }
6757 /**
6758 * Response to "configure" request. This is just an acknowledgement, so
6759 * no body field is required.
6760 */
6761 interface ConfigureResponse extends Response {
6762 }
6763 interface ConfigurePluginRequestArguments {
6764 pluginName: string;
6765 configuration: any;
6766 }
6767 interface ConfigurePluginRequest extends Request {
6768 command: CommandTypes.ConfigurePlugin;
6769 arguments: ConfigurePluginRequestArguments;
6770 }
6771 interface ConfigurePluginResponse extends Response {
6772 }
6773 interface SelectionRangeRequest extends FileRequest {
6774 command: CommandTypes.SelectionRange;
6775 arguments: SelectionRangeRequestArgs;
6776 }
6777 interface SelectionRangeRequestArgs extends FileRequestArgs {
6778 locations: Location[];
6779 }
6780 interface SelectionRangeResponse extends Response {
6781 body?: SelectionRange[];
6782 }
6783 interface SelectionRange {
6784 textSpan: TextSpan;
6785 parent?: SelectionRange;
6786 }
6787 /**
6788 * Information found in an "open" request.
6789 */
6790 interface OpenRequestArgs extends FileRequestArgs {
6791 /**
6792 * Used when a version of the file content is known to be more up to date than the one on disk.
6793 * Then the known content will be used upon opening instead of the disk copy
6794 */
6795 fileContent?: string;
6796 /**
6797 * Used to specify the script kind of the file explicitly. It could be one of the following:
6798 * "TS", "JS", "TSX", "JSX"
6799 */
6800 scriptKindName?: ScriptKindName;
6801 /**
6802 * Used to limit the searching for project config file. If given the searching will stop at this
6803 * root path; otherwise it will go all the way up to the dist root path.
6804 */
6805 projectRootPath?: string;
6806 }
6807 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
6808 /**
6809 * Open request; value of command field is "open". Notify the
6810 * server that the client has file open. The server will not
6811 * monitor the filesystem for changes in this file and will assume
6812 * that the client is updating the server (using the change and/or
6813 * reload messages) when the file changes. Server does not currently
6814 * send a response to an open request.
6815 */
6816 interface OpenRequest extends Request {
6817 command: CommandTypes.Open;
6818 arguments: OpenRequestArgs;
6819 }
6820 /**
6821 * Request to open or update external project
6822 */
6823 interface OpenExternalProjectRequest extends Request {
6824 command: CommandTypes.OpenExternalProject;
6825 arguments: OpenExternalProjectArgs;
6826 }
6827 /**
6828 * Arguments to OpenExternalProjectRequest request
6829 */
6830 type OpenExternalProjectArgs = ExternalProject;
6831 /**
6832 * Request to open multiple external projects
6833 */
6834 interface OpenExternalProjectsRequest extends Request {
6835 command: CommandTypes.OpenExternalProjects;
6836 arguments: OpenExternalProjectsArgs;
6837 }
6838 /**
6839 * Arguments to OpenExternalProjectsRequest
6840 */
6841 interface OpenExternalProjectsArgs {
6842 /**
6843 * List of external projects to open or update
6844 */
6845 projects: ExternalProject[];
6846 }
6847 /**
6848 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so
6849 * no body field is required.
6850 */
6851 interface OpenExternalProjectResponse extends Response {
6852 }
6853 /**
6854 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so
6855 * no body field is required.
6856 */
6857 interface OpenExternalProjectsResponse extends Response {
6858 }
6859 /**
6860 * Request to close external project.
6861 */
6862 interface CloseExternalProjectRequest extends Request {
6863 command: CommandTypes.CloseExternalProject;
6864 arguments: CloseExternalProjectRequestArgs;
6865 }
6866 /**
6867 * Arguments to CloseExternalProjectRequest request
6868 */
6869 interface CloseExternalProjectRequestArgs {
6870 /**
6871 * Name of the project to close
6872 */
6873 projectFileName: string;
6874 }
6875 /**
6876 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so
6877 * no body field is required.
6878 */
6879 interface CloseExternalProjectResponse extends Response {
6880 }
6881 /**
6882 * Request to synchronize list of open files with the client
6883 */
6884 interface UpdateOpenRequest extends Request {
6885 command: CommandTypes.UpdateOpen;
6886 arguments: UpdateOpenRequestArgs;
6887 }
6888 /**
6889 * Arguments to UpdateOpenRequest
6890 */
6891 interface UpdateOpenRequestArgs {
6892 /**
6893 * List of newly open files
6894 */
6895 openFiles?: OpenRequestArgs[];
6896 /**
6897 * List of open files files that were changes
6898 */
6899 changedFiles?: FileCodeEdits[];
6900 /**
6901 * List of files that were closed
6902 */
6903 closedFiles?: string[];
6904 }
6905 /**
6906 * Request to set compiler options for inferred projects.
6907 * External projects are opened / closed explicitly.
6908 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders.
6909 * This configuration file will be used to obtain a list of files and configuration settings for the project.
6910 * Inferred projects are created when user opens a loose file that is not the part of external project
6911 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false,
6912 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true.
6913 */
6914 interface SetCompilerOptionsForInferredProjectsRequest extends Request {
6915 command: CommandTypes.CompilerOptionsForInferredProjects;
6916 arguments: SetCompilerOptionsForInferredProjectsArgs;
6917 }
6918 /**
6919 * Argument for SetCompilerOptionsForInferredProjectsRequest request.
6920 */
6921 interface SetCompilerOptionsForInferredProjectsArgs {
6922 /**
6923 * Compiler options to be used with inferred projects.
6924 */
6925 options: ExternalProjectCompilerOptions;
6926 /**
6927 * Specifies the project root path used to scope compiler options.
6928 * It is an error to provide this property if the server has not been started with
6929 * `useInferredProjectPerProjectRoot` enabled.
6930 */
6931 projectRootPath?: string;
6932 }
6933 /**
6934 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so
6935 * no body field is required.
6936 */
6937 interface SetCompilerOptionsForInferredProjectsResponse extends Response {
6938 }
6939 /**
6940 * Exit request; value of command field is "exit". Ask the server process
6941 * to exit.
6942 */
6943 interface ExitRequest extends Request {
6944 command: CommandTypes.Exit;
6945 }
6946 /**
6947 * Close request; value of command field is "close". Notify the
6948 * server that the client has closed a previously open file. If
6949 * file is still referenced by open files, the server will resume
6950 * monitoring the filesystem for changes to file. Server does not
6951 * currently send a response to a close request.
6952 */
6953 interface CloseRequest extends FileRequest {
6954 command: CommandTypes.Close;
6955 }
6956 /**
6957 * Request to obtain the list of files that should be regenerated if target file is recompiled.
6958 * NOTE: this us query-only operation and does not generate any output on disk.
6959 */
6960 interface CompileOnSaveAffectedFileListRequest extends FileRequest {
6961 command: CommandTypes.CompileOnSaveAffectedFileList;
6962 }
6963 /**
6964 * Contains a list of files that should be regenerated in a project
6965 */
6966 interface CompileOnSaveAffectedFileListSingleProject {
6967 /**
6968 * Project name
6969 */
6970 projectFileName: string;
6971 /**
6972 * List of files names that should be recompiled
6973 */
6974 fileNames: string[];
6975 /**
6976 * true if project uses outFile or out compiler option
6977 */
6978 projectUsesOutFile: boolean;
6979 }
6980 /**
6981 * Response for CompileOnSaveAffectedFileListRequest request;
6982 */
6983 interface CompileOnSaveAffectedFileListResponse extends Response {
6984 body: CompileOnSaveAffectedFileListSingleProject[];
6985 }
6986 /**
6987 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk.
6988 */
6989 interface CompileOnSaveEmitFileRequest extends FileRequest {
6990 command: CommandTypes.CompileOnSaveEmitFile;
6991 arguments: CompileOnSaveEmitFileRequestArgs;
6992 }
6993 /**
6994 * Arguments for CompileOnSaveEmitFileRequest
6995 */
6996 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
6997 /**
6998 * if true - then file should be recompiled even if it does not have any changes.
6999 */
7000 forced?: boolean;
7001 }
7002 /**
7003 * Quickinfo request; value of command field is
7004 * "quickinfo". Return response giving a quick type and
7005 * documentation string for the symbol found in file at location
7006 * line, col.
7007 */
7008 interface QuickInfoRequest extends FileLocationRequest {
7009 command: CommandTypes.Quickinfo;
7010 }
7011 /**
7012 * Body of QuickInfoResponse.
7013 */
7014 interface QuickInfoResponseBody {
7015 /**
7016 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
7017 */
7018 kind: ScriptElementKind;
7019 /**
7020 * Optional modifiers for the kind (such as 'public').
7021 */
7022 kindModifiers: string;
7023 /**
7024 * Starting file location of symbol.
7025 */
7026 start: Location;
7027 /**
7028 * One past last character of symbol.
7029 */
7030 end: Location;
7031 /**
7032 * Type and kind of symbol.
7033 */
7034 displayString: string;
7035 /**
7036 * Documentation associated with symbol.
7037 */
7038 documentation: string;
7039 /**
7040 * JSDoc tags associated with symbol.
7041 */
7042 tags: JSDocTagInfo[];
7043 }
7044 /**
7045 * Quickinfo response message.
7046 */
7047 interface QuickInfoResponse extends Response {
7048 body?: QuickInfoResponseBody;
7049 }
7050 /**
7051 * Arguments for format messages.
7052 */
7053 interface FormatRequestArgs extends FileLocationRequestArgs {
7054 /**
7055 * Last line of range for which to format text in file.
7056 */
7057 endLine: number;
7058 /**
7059 * Character offset on last line of range for which to format text in file.
7060 */
7061 endOffset: number;
7062 /**
7063 * Format options to be used.
7064 */
7065 options?: FormatCodeSettings;
7066 }
7067 /**
7068 * Format request; value of command field is "format". Return
7069 * response giving zero or more edit instructions. The edit
7070 * instructions will be sorted in file order. Applying the edit
7071 * instructions in reverse to file will result in correctly
7072 * reformatted text.
7073 */
7074 interface FormatRequest extends FileLocationRequest {
7075 command: CommandTypes.Format;
7076 arguments: FormatRequestArgs;
7077 }
7078 /**
7079 * Object found in response messages defining an editing
7080 * instruction for a span of text in source code. The effect of
7081 * this instruction is to replace the text starting at start and
7082 * ending one character before end with newText. For an insertion,
7083 * the text span is empty. For a deletion, newText is empty.
7084 */
7085 interface CodeEdit {
7086 /**
7087 * First character of the text span to edit.
7088 */
7089 start: Location;
7090 /**
7091 * One character past last character of the text span to edit.
7092 */
7093 end: Location;
7094 /**
7095 * Replace the span defined above with this string (may be
7096 * the empty string).
7097 */
7098 newText: string;
7099 }
7100 interface FileCodeEdits {
7101 fileName: string;
7102 textChanges: CodeEdit[];
7103 }
7104 interface CodeFixResponse extends Response {
7105 /** The code actions that are available */
7106 body?: CodeFixAction[];
7107 }
7108 interface CodeAction {
7109 /** Description of the code action to display in the UI of the editor */
7110 description: string;
7111 /** Text changes to apply to each file as part of the code action */
7112 changes: FileCodeEdits[];
7113 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
7114 commands?: {}[];
7115 }
7116 interface CombinedCodeActions {
7117 changes: ReadonlyArray<FileCodeEdits>;
7118 commands?: ReadonlyArray<{}>;
7119 }
7120 interface CodeFixAction extends CodeAction {
7121 /** Short name to identify the fix, for use by telemetry. */
7122 fixName: string;
7123 /**
7124 * If present, one may call 'getCombinedCodeFix' with this fixId.
7125 * This may be omitted to indicate that the code fix can't be applied in a group.
7126 */
7127 fixId?: {};
7128 /** Should be present if and only if 'fixId' is. */
7129 fixAllDescription?: string;
7130 }
7131 /**
7132 * Format and format on key response message.
7133 */
7134 interface FormatResponse extends Response {
7135 body?: CodeEdit[];
7136 }
7137 /**
7138 * Arguments for format on key messages.
7139 */
7140 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
7141 /**
7142 * Key pressed (';', '\n', or '}').
7143 */
7144 key: string;
7145 options?: FormatCodeSettings;
7146 }
7147 /**
7148 * Format on key request; value of command field is
7149 * "formatonkey". Given file location and key typed (as string),
7150 * return response giving zero or more edit instructions. The
7151 * edit instructions will be sorted in file order. Applying the
7152 * edit instructions in reverse to file will result in correctly
7153 * reformatted text.
7154 */
7155 interface FormatOnKeyRequest extends FileLocationRequest {
7156 command: CommandTypes.Formatonkey;
7157 arguments: FormatOnKeyRequestArgs;
7158 }
7159 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<";
7160 /**
7161 * Arguments for completions messages.
7162 */
7163 interface CompletionsRequestArgs extends FileLocationRequestArgs {
7164 /**
7165 * Optional prefix to apply to possible completions.
7166 */
7167 prefix?: string;
7168 /**
7169 * Character that was responsible for triggering completion.
7170 * Should be `undefined` if a user manually requested completion.
7171 */
7172 triggerCharacter?: CompletionsTriggerCharacter;
7173 /**
7174 * @deprecated Use UserPreferences.includeCompletionsForModuleExports
7175 */
7176 includeExternalModuleExports?: boolean;
7177 /**
7178 * @deprecated Use UserPreferences.includeCompletionsWithInsertText
7179 */
7180 includeInsertTextCompletions?: boolean;
7181 }
7182 /**
7183 * Completions request; value of command field is "completions".
7184 * Given a file location (file, line, col) and a prefix (which may
7185 * be the empty string), return the possible completions that
7186 * begin with prefix.
7187 */
7188 interface CompletionsRequest extends FileLocationRequest {
7189 command: CommandTypes.Completions | CommandTypes.CompletionInfo;
7190 arguments: CompletionsRequestArgs;
7191 }
7192 /**
7193 * Arguments for completion details request.
7194 */
7195 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
7196 /**
7197 * Names of one or more entries for which to obtain details.
7198 */
7199 entryNames: (string | CompletionEntryIdentifier)[];
7200 }
7201 interface CompletionEntryIdentifier {
7202 name: string;
7203 source?: string;
7204 }
7205 /**
7206 * Completion entry details request; value of command field is
7207 * "completionEntryDetails". Given a file location (file, line,
7208 * col) and an array of completion entry names return more
7209 * detailed information for each completion entry.
7210 */
7211 interface CompletionDetailsRequest extends FileLocationRequest {
7212 command: CommandTypes.CompletionDetails;
7213 arguments: CompletionDetailsRequestArgs;
7214 }
7215 /**
7216 * Part of a symbol description.
7217 */
7218 interface SymbolDisplayPart {
7219 /**
7220 * Text of an item describing the symbol.
7221 */
7222 text: string;
7223 /**
7224 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
7225 */
7226 kind: string;
7227 }
7228 /**
7229 * An item found in a completion response.
7230 */
7231 interface CompletionEntry {
7232 /**
7233 * The symbol's name.
7234 */
7235 name: string;
7236 /**
7237 * The symbol's kind (such as 'className' or 'parameterName').
7238 */
7239 kind: ScriptElementKind;
7240 /**
7241 * Optional modifiers for the kind (such as 'public').
7242 */
7243 kindModifiers?: string;
7244 /**
7245 * A string that is used for comparing completion items so that they can be ordered. This
7246 * is often the same as the name but may be different in certain circumstances.
7247 */
7248 sortText: string;
7249 /**
7250 * Text to insert instead of `name`.
7251 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`,
7252 * coupled with `replacementSpan` to replace a dotted access with a bracket access.
7253 */
7254 insertText?: string;
7255 /**
7256 * An optional span that indicates the text to be replaced by this completion item.
7257 * If present, this span should be used instead of the default one.
7258 * It will be set if the required span differs from the one generated by the default replacement behavior.
7259 */
7260 replacementSpan?: TextSpan;
7261 /**
7262 * Indicates whether commiting this completion entry will require additional code actions to be
7263 * made to avoid errors. The CompletionEntryDetails will have these actions.
7264 */
7265 hasAction?: true;
7266 /**
7267 * Identifier (not necessarily human-readable) identifying where this completion came from.
7268 */
7269 source?: string;
7270 /**
7271 * If true, this completion should be highlighted as recommended. There will only be one of these.
7272 * 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.
7273 * Then either that enum/class or a namespace containing it will be the recommended symbol.
7274 */
7275 isRecommended?: true;
7276 }
7277 /**
7278 * Additional completion entry details, available on demand
7279 */
7280 interface CompletionEntryDetails {
7281 /**
7282 * The symbol's name.
7283 */
7284 name: string;
7285 /**
7286 * The symbol's kind (such as 'className' or 'parameterName').
7287 */
7288 kind: ScriptElementKind;
7289 /**
7290 * Optional modifiers for the kind (such as 'public').
7291 */
7292 kindModifiers: string;
7293 /**
7294 * Display parts of the symbol (similar to quick info).
7295 */
7296 displayParts: SymbolDisplayPart[];
7297 /**
7298 * Documentation strings for the symbol.
7299 */
7300 documentation?: SymbolDisplayPart[];
7301 /**
7302 * JSDoc tags for the symbol.
7303 */
7304 tags?: JSDocTagInfo[];
7305 /**
7306 * The associated code actions for this entry
7307 */
7308 codeActions?: CodeAction[];
7309 /**
7310 * Human-readable description of the `source` from the CompletionEntry.
7311 */
7312 source?: SymbolDisplayPart[];
7313 }
7314 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
7315 interface CompletionsResponse extends Response {
7316 body?: CompletionEntry[];
7317 }
7318 interface CompletionInfoResponse extends Response {
7319 body?: CompletionInfo;
7320 }
7321 interface CompletionInfo {
7322 readonly isGlobalCompletion: boolean;
7323 readonly isMemberCompletion: boolean;
7324 readonly isNewIdentifierLocation: boolean;
7325 readonly entries: ReadonlyArray<CompletionEntry>;
7326 }
7327 interface CompletionDetailsResponse extends Response {
7328 body?: CompletionEntryDetails[];
7329 }
7330 /**
7331 * Signature help information for a single parameter
7332 */
7333 interface SignatureHelpParameter {
7334 /**
7335 * The parameter's name
7336 */
7337 name: string;
7338 /**
7339 * Documentation of the parameter.
7340 */
7341 documentation: SymbolDisplayPart[];
7342 /**
7343 * Display parts of the parameter.
7344 */
7345 displayParts: SymbolDisplayPart[];
7346 /**
7347 * Whether the parameter is optional or not.
7348 */
7349 isOptional: boolean;
7350 }
7351 /**
7352 * Represents a single signature to show in signature help.
7353 */
7354 interface SignatureHelpItem {
7355 /**
7356 * Whether the signature accepts a variable number of arguments.
7357 */
7358 isVariadic: boolean;
7359 /**
7360 * The prefix display parts.
7361 */
7362 prefixDisplayParts: SymbolDisplayPart[];
7363 /**
7364 * The suffix display parts.
7365 */
7366 suffixDisplayParts: SymbolDisplayPart[];
7367 /**
7368 * The separator display parts.
7369 */
7370 separatorDisplayParts: SymbolDisplayPart[];
7371 /**
7372 * The signature helps items for the parameters.
7373 */
7374 parameters: SignatureHelpParameter[];
7375 /**
7376 * The signature's documentation
7377 */
7378 documentation: SymbolDisplayPart[];
7379 /**
7380 * The signature's JSDoc tags
7381 */
7382 tags: JSDocTagInfo[];
7383 }
7384 /**
7385 * Signature help items found in the response of a signature help request.
7386 */
7387 interface SignatureHelpItems {
7388 /**
7389 * The signature help items.
7390 */
7391 items: SignatureHelpItem[];
7392 /**
7393 * The span for which signature help should appear on a signature
7394 */
7395 applicableSpan: TextSpan;
7396 /**
7397 * The item selected in the set of available help items.
7398 */
7399 selectedItemIndex: number;
7400 /**
7401 * The argument selected in the set of parameters.
7402 */
7403 argumentIndex: number;
7404 /**
7405 * The argument count
7406 */
7407 argumentCount: number;
7408 }
7409 type SignatureHelpTriggerCharacter = "," | "(" | "<";
7410 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
7411 /**
7412 * Arguments of a signature help request.
7413 */
7414 interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
7415 /**
7416 * Reason why signature help was invoked.
7417 * See each individual possible
7418 */
7419 triggerReason?: SignatureHelpTriggerReason;
7420 }
7421 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
7422 /**
7423 * Signals that the user manually requested signature help.
7424 * The language service will unconditionally attempt to provide a result.
7425 */
7426 interface SignatureHelpInvokedReason {
7427 kind: "invoked";
7428 triggerCharacter?: undefined;
7429 }
7430 /**
7431 * Signals that the signature help request came from a user typing a character.
7432 * Depending on the character and the syntactic context, the request may or may not be served a result.
7433 */
7434 interface SignatureHelpCharacterTypedReason {
7435 kind: "characterTyped";
7436 /**
7437 * Character that was responsible for triggering signature help.
7438 */
7439 triggerCharacter: SignatureHelpTriggerCharacter;
7440 }
7441 /**
7442 * Signals that this signature help request came from typing a character or moving the cursor.
7443 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
7444 * The language service will unconditionally attempt to provide a result.
7445 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
7446 */
7447 interface SignatureHelpRetriggeredReason {
7448 kind: "retrigger";
7449 /**
7450 * Character that was responsible for triggering signature help.
7451 */
7452 triggerCharacter?: SignatureHelpRetriggerCharacter;
7453 }
7454 /**
7455 * Signature help request; value of command field is "signatureHelp".
7456 * Given a file location (file, line, col), return the signature
7457 * help.
7458 */
7459 interface SignatureHelpRequest extends FileLocationRequest {
7460 command: CommandTypes.SignatureHelp;
7461 arguments: SignatureHelpRequestArgs;
7462 }
7463 /**
7464 * Response object for a SignatureHelpRequest.
7465 */
7466 interface SignatureHelpResponse extends Response {
7467 body?: SignatureHelpItems;
7468 }
7469 /**
7470 * Synchronous request for semantic diagnostics of one file.
7471 */
7472 interface SemanticDiagnosticsSyncRequest extends FileRequest {
7473 command: CommandTypes.SemanticDiagnosticsSync;
7474 arguments: SemanticDiagnosticsSyncRequestArgs;
7475 }
7476 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
7477 includeLinePosition?: boolean;
7478 }
7479 /**
7480 * Response object for synchronous sematic diagnostics request.
7481 */
7482 interface SemanticDiagnosticsSyncResponse extends Response {
7483 body?: Diagnostic[] | DiagnosticWithLinePosition[];
7484 }
7485 interface SuggestionDiagnosticsSyncRequest extends FileRequest {
7486 command: CommandTypes.SuggestionDiagnosticsSync;
7487 arguments: SuggestionDiagnosticsSyncRequestArgs;
7488 }
7489 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
7490 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
7491 /**
7492 * Synchronous request for syntactic diagnostics of one file.
7493 */
7494 interface SyntacticDiagnosticsSyncRequest extends FileRequest {
7495 command: CommandTypes.SyntacticDiagnosticsSync;
7496 arguments: SyntacticDiagnosticsSyncRequestArgs;
7497 }
7498 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
7499 includeLinePosition?: boolean;
7500 }
7501 /**
7502 * Response object for synchronous syntactic diagnostics request.
7503 */
7504 interface SyntacticDiagnosticsSyncResponse extends Response {
7505 body?: Diagnostic[] | DiagnosticWithLinePosition[];
7506 }
7507 /**
7508 * Arguments for GeterrForProject request.
7509 */
7510 interface GeterrForProjectRequestArgs {
7511 /**
7512 * the file requesting project error list
7513 */
7514 file: string;
7515 /**
7516 * Delay in milliseconds to wait before starting to compute
7517 * errors for the files in the file list
7518 */
7519 delay: number;
7520 }
7521 /**
7522 * GeterrForProjectRequest request; value of command field is
7523 * "geterrForProject". It works similarly with 'Geterr', only
7524 * it request for every file in this project.
7525 */
7526 interface GeterrForProjectRequest extends Request {
7527 command: CommandTypes.GeterrForProject;
7528 arguments: GeterrForProjectRequestArgs;
7529 }
7530 /**
7531 * Arguments for geterr messages.
7532 */
7533 interface GeterrRequestArgs {
7534 /**
7535 * List of file names for which to compute compiler errors.
7536 * The files will be checked in list order.
7537 */
7538 files: string[];
7539 /**
7540 * Delay in milliseconds to wait before starting to compute
7541 * errors for the files in the file list
7542 */
7543 delay: number;
7544 }
7545 /**
7546 * Geterr request; value of command field is "geterr". Wait for
7547 * delay milliseconds and then, if during the wait no change or
7548 * reload messages have arrived for the first file in the files
7549 * list, get the syntactic errors for the file, field requests,
7550 * and then get the semantic errors for the file. Repeat with a
7551 * smaller delay for each subsequent file on the files list. Best
7552 * practice for an editor is to send a file list containing each
7553 * file that is currently visible, in most-recently-used order.
7554 */
7555 interface GeterrRequest extends Request {
7556 command: CommandTypes.Geterr;
7557 arguments: GeterrRequestArgs;
7558 }
7559 type RequestCompletedEventName = "requestCompleted";
7560 /**
7561 * Event that is sent when server have finished processing request with specified id.
7562 */
7563 interface RequestCompletedEvent extends Event {
7564 event: RequestCompletedEventName;
7565 body: RequestCompletedEventBody;
7566 }
7567 interface RequestCompletedEventBody {
7568 request_seq: number;
7569 }
7570 /**
7571 * Item of diagnostic information found in a DiagnosticEvent message.
7572 */
7573 interface Diagnostic {
7574 /**
7575 * Starting file location at which text applies.
7576 */
7577 start: Location;
7578 /**
7579 * The last file location at which the text applies.
7580 */
7581 end: Location;
7582 /**
7583 * Text of diagnostic message.
7584 */
7585 text: string;
7586 /**
7587 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
7588 */
7589 category: string;
7590 reportsUnnecessary?: {};
7591 /**
7592 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
7593 */
7594 relatedInformation?: DiagnosticRelatedInformation[];
7595 /**
7596 * The error code of the diagnostic message.
7597 */
7598 code?: number;
7599 /**
7600 * The name of the plugin reporting the message.
7601 */
7602 source?: string;
7603 }
7604 interface DiagnosticWithFileName extends Diagnostic {
7605 /**
7606 * Name of the file the diagnostic is in
7607 */
7608 fileName: string;
7609 }
7610 /**
7611 * Represents additional spans returned with a diagnostic which are relevant to it
7612 */
7613 interface DiagnosticRelatedInformation {
7614 /**
7615 * The category of the related information message, e.g. "error", "warning", or "suggestion".
7616 */
7617 category: string;
7618 /**
7619 * The code used ot identify the related information
7620 */
7621 code: number;
7622 /**
7623 * Text of related or additional information.
7624 */
7625 message: string;
7626 /**
7627 * Associated location
7628 */
7629 span?: FileSpan;
7630 }
7631 interface DiagnosticEventBody {
7632 /**
7633 * The file for which diagnostic information is reported.
7634 */
7635 file: string;
7636 /**
7637 * An array of diagnostic information items.
7638 */
7639 diagnostics: Diagnostic[];
7640 }
7641 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
7642 /**
7643 * Event message for DiagnosticEventKind event types.
7644 * These events provide syntactic and semantic errors for a file.
7645 */
7646 interface DiagnosticEvent extends Event {
7647 body?: DiagnosticEventBody;
7648 event: DiagnosticEventKind;
7649 }
7650 interface ConfigFileDiagnosticEventBody {
7651 /**
7652 * The file which trigged the searching and error-checking of the config file
7653 */
7654 triggerFile: string;
7655 /**
7656 * The name of the found config file.
7657 */
7658 configFile: string;
7659 /**
7660 * An arry of diagnostic information items for the found config file.
7661 */
7662 diagnostics: DiagnosticWithFileName[];
7663 }
7664 /**
7665 * Event message for "configFileDiag" event type.
7666 * This event provides errors for a found config file.
7667 */
7668 interface ConfigFileDiagnosticEvent extends Event {
7669 body?: ConfigFileDiagnosticEventBody;
7670 event: "configFileDiag";
7671 }
7672 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
7673 interface ProjectLanguageServiceStateEvent extends Event {
7674 event: ProjectLanguageServiceStateEventName;
7675 body?: ProjectLanguageServiceStateEventBody;
7676 }
7677 interface ProjectLanguageServiceStateEventBody {
7678 /**
7679 * Project name that has changes in the state of language service.
7680 * For configured projects this will be the config file path.
7681 * For external projects this will be the name of the projects specified when project was open.
7682 * For inferred projects this event is not raised.
7683 */
7684 projectName: string;
7685 /**
7686 * True if language service state switched from disabled to enabled
7687 * and false otherwise.
7688 */
7689 languageServiceEnabled: boolean;
7690 }
7691 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground";
7692 interface ProjectsUpdatedInBackgroundEvent extends Event {
7693 event: ProjectsUpdatedInBackgroundEventName;
7694 body: ProjectsUpdatedInBackgroundEventBody;
7695 }
7696 interface ProjectsUpdatedInBackgroundEventBody {
7697 /**
7698 * Current set of open files
7699 */
7700 openFiles: string[];
7701 }
7702 type ProjectLoadingStartEventName = "projectLoadingStart";
7703 interface ProjectLoadingStartEvent extends Event {
7704 event: ProjectLoadingStartEventName;
7705 body: ProjectLoadingStartEventBody;
7706 }
7707 interface ProjectLoadingStartEventBody {
7708 /** name of the project */
7709 projectName: string;
7710 /** reason for loading */
7711 reason: string;
7712 }
7713 type ProjectLoadingFinishEventName = "projectLoadingFinish";
7714 interface ProjectLoadingFinishEvent extends Event {
7715 event: ProjectLoadingFinishEventName;
7716 body: ProjectLoadingFinishEventBody;
7717 }
7718 interface ProjectLoadingFinishEventBody {
7719 /** name of the project */
7720 projectName: string;
7721 }
7722 type SurveyReadyEventName = "surveyReady";
7723 interface SurveyReadyEvent extends Event {
7724 event: SurveyReadyEventName;
7725 body: SurveyReadyEventBody;
7726 }
7727 interface SurveyReadyEventBody {
7728 /** Name of the survey. This is an internal machine- and programmer-friendly name */
7729 surveyId: string;
7730 }
7731 type LargeFileReferencedEventName = "largeFileReferenced";
7732 interface LargeFileReferencedEvent extends Event {
7733 event: LargeFileReferencedEventName;
7734 body: LargeFileReferencedEventBody;
7735 }
7736 interface LargeFileReferencedEventBody {
7737 /**
7738 * name of the large file being loaded
7739 */
7740 file: string;
7741 /**
7742 * size of the file
7743 */
7744 fileSize: number;
7745 /**
7746 * max file size allowed on the server
7747 */
7748 maxFileSize: number;
7749 }
7750 /**
7751 * Arguments for reload request.
7752 */
7753 interface ReloadRequestArgs extends FileRequestArgs {
7754 /**
7755 * Name of temporary file from which to reload file
7756 * contents. May be same as file.
7757 */
7758 tmpfile: string;
7759 }
7760 /**
7761 * Reload request message; value of command field is "reload".
7762 * Reload contents of file with name given by the 'file' argument
7763 * from temporary file with name given by the 'tmpfile' argument.
7764 * The two names can be identical.
7765 */
7766 interface ReloadRequest extends FileRequest {
7767 command: CommandTypes.Reload;
7768 arguments: ReloadRequestArgs;
7769 }
7770 /**
7771 * Response to "reload" request. This is just an acknowledgement, so
7772 * no body field is required.
7773 */
7774 interface ReloadResponse extends Response {
7775 }
7776 /**
7777 * Arguments for saveto request.
7778 */
7779 interface SavetoRequestArgs extends FileRequestArgs {
7780 /**
7781 * Name of temporary file into which to save server's view of
7782 * file contents.
7783 */
7784 tmpfile: string;
7785 }
7786 /**
7787 * Saveto request message; value of command field is "saveto".
7788 * For debugging purposes, save to a temporaryfile (named by
7789 * argument 'tmpfile') the contents of file named by argument
7790 * 'file'. The server does not currently send a response to a
7791 * "saveto" request.
7792 */
7793 interface SavetoRequest extends FileRequest {
7794 command: CommandTypes.Saveto;
7795 arguments: SavetoRequestArgs;
7796 }
7797 /**
7798 * Arguments for navto request message.
7799 */
7800 interface NavtoRequestArgs extends FileRequestArgs {
7801 /**
7802 * Search term to navigate to from current location; term can
7803 * be '.*' or an identifier prefix.
7804 */
7805 searchValue: string;
7806 /**
7807 * Optional limit on the number of items to return.
7808 */
7809 maxResultCount?: number;
7810 /**
7811 * Optional flag to indicate we want results for just the current file
7812 * or the entire project.
7813 */
7814 currentFileOnly?: boolean;
7815 projectFileName?: string;
7816 }
7817 /**
7818 * Navto request message; value of command field is "navto".
7819 * Return list of objects giving file locations and symbols that
7820 * match the search term given in argument 'searchTerm'. The
7821 * context for the search is given by the named file.
7822 */
7823 interface NavtoRequest extends FileRequest {
7824 command: CommandTypes.Navto;
7825 arguments: NavtoRequestArgs;
7826 }
7827 /**
7828 * An item found in a navto response.
7829 */
7830 interface NavtoItem extends FileSpan {
7831 /**
7832 * The symbol's name.
7833 */
7834 name: string;
7835 /**
7836 * The symbol's kind (such as 'className' or 'parameterName').
7837 */
7838 kind: ScriptElementKind;
7839 /**
7840 * exact, substring, or prefix.
7841 */
7842 matchKind: string;
7843 /**
7844 * If this was a case sensitive or insensitive match.
7845 */
7846 isCaseSensitive: boolean;
7847 /**
7848 * Optional modifiers for the kind (such as 'public').
7849 */
7850 kindModifiers?: string;
7851 /**
7852 * Name of symbol's container symbol (if any); for example,
7853 * the class name if symbol is a class member.
7854 */
7855 containerName?: string;
7856 /**
7857 * Kind of symbol's container symbol (if any).
7858 */
7859 containerKind?: ScriptElementKind;
7860 }
7861 /**
7862 * Navto response message. Body is an array of navto items. Each
7863 * item gives a symbol that matched the search term.
7864 */
7865 interface NavtoResponse extends Response {
7866 body?: NavtoItem[];
7867 }
7868 /**
7869 * Arguments for change request message.
7870 */
7871 interface ChangeRequestArgs extends FormatRequestArgs {
7872 /**
7873 * Optional string to insert at location (file, line, offset).
7874 */
7875 insertString?: string;
7876 }
7877 /**
7878 * Change request message; value of command field is "change".
7879 * Update the server's view of the file named by argument 'file'.
7880 * Server does not currently send a response to a change request.
7881 */
7882 interface ChangeRequest extends FileLocationRequest {
7883 command: CommandTypes.Change;
7884 arguments: ChangeRequestArgs;
7885 }
7886 /**
7887 * Response to "brace" request.
7888 */
7889 interface BraceResponse extends Response {
7890 body?: TextSpan[];
7891 }
7892 /**
7893 * Brace matching request; value of command field is "brace".
7894 * Return response giving the file locations of matching braces
7895 * found in file at location line, offset.
7896 */
7897 interface BraceRequest extends FileLocationRequest {
7898 command: CommandTypes.Brace;
7899 }
7900 /**
7901 * NavBar items request; value of command field is "navbar".
7902 * Return response giving the list of navigation bar entries
7903 * extracted from the requested file.
7904 */
7905 interface NavBarRequest extends FileRequest {
7906 command: CommandTypes.NavBar;
7907 }
7908 /**
7909 * NavTree request; value of command field is "navtree".
7910 * Return response giving the navigation tree of the requested file.
7911 */
7912 interface NavTreeRequest extends FileRequest {
7913 command: CommandTypes.NavTree;
7914 }
7915 interface NavigationBarItem {
7916 /**
7917 * The item's display text.
7918 */
7919 text: string;
7920 /**
7921 * The symbol's kind (such as 'className' or 'parameterName').
7922 */
7923 kind: ScriptElementKind;
7924 /**
7925 * Optional modifiers for the kind (such as 'public').
7926 */
7927 kindModifiers?: string;
7928 /**
7929 * The definition locations of the item.
7930 */
7931 spans: TextSpan[];
7932 /**
7933 * Optional children.
7934 */
7935 childItems?: NavigationBarItem[];
7936 /**
7937 * Number of levels deep this item should appear.
7938 */
7939 indent: number;
7940 }
7941 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
7942 interface NavigationTree {
7943 text: string;
7944 kind: ScriptElementKind;
7945 kindModifiers: string;
7946 spans: TextSpan[];
7947 nameSpan: TextSpan | undefined;
7948 childItems?: NavigationTree[];
7949 }
7950 type TelemetryEventName = "telemetry";
7951 interface TelemetryEvent extends Event {
7952 event: TelemetryEventName;
7953 body: TelemetryEventBody;
7954 }
7955 interface TelemetryEventBody {
7956 telemetryEventName: string;
7957 payload: any;
7958 }
7959 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed";
7960 interface TypesInstallerInitializationFailedEvent extends Event {
7961 event: TypesInstallerInitializationFailedEventName;
7962 body: TypesInstallerInitializationFailedEventBody;
7963 }
7964 interface TypesInstallerInitializationFailedEventBody {
7965 message: string;
7966 }
7967 type TypingsInstalledTelemetryEventName = "typingsInstalled";
7968 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
7969 telemetryEventName: TypingsInstalledTelemetryEventName;
7970 payload: TypingsInstalledTelemetryEventPayload;
7971 }
7972 interface TypingsInstalledTelemetryEventPayload {
7973 /**
7974 * Comma separated list of installed typing packages
7975 */
7976 installedPackages: string;
7977 /**
7978 * true if install request succeeded, otherwise - false
7979 */
7980 installSuccess: boolean;
7981 /**
7982 * version of typings installer
7983 */
7984 typingsInstallerVersion: string;
7985 }
7986 type BeginInstallTypesEventName = "beginInstallTypes";
7987 type EndInstallTypesEventName = "endInstallTypes";
7988 interface BeginInstallTypesEvent extends Event {
7989 event: BeginInstallTypesEventName;
7990 body: BeginInstallTypesEventBody;
7991 }
7992 interface EndInstallTypesEvent extends Event {
7993 event: EndInstallTypesEventName;
7994 body: EndInstallTypesEventBody;
7995 }
7996 interface InstallTypesEventBody {
7997 /**
7998 * correlation id to match begin and end events
7999 */
8000 eventId: number;
8001 /**
8002 * list of packages to install
8003 */
8004 packages: ReadonlyArray<string>;
8005 }
8006 interface BeginInstallTypesEventBody extends InstallTypesEventBody {
8007 }
8008 interface EndInstallTypesEventBody extends InstallTypesEventBody {
8009 /**
8010 * true if installation succeeded, otherwise false
8011 */
8012 success: boolean;
8013 }
8014 interface NavBarResponse extends Response {
8015 body?: NavigationBarItem[];
8016 }
8017 interface NavTreeResponse extends Response {
8018 body?: NavigationTree;
8019 }
8020 enum IndentStyle {
8021 None = "None",
8022 Block = "Block",
8023 Smart = "Smart"
8024 }
8025 interface EditorSettings {
8026 baseIndentSize?: number;
8027 indentSize?: number;
8028 tabSize?: number;
8029 newLineCharacter?: string;
8030 convertTabsToSpaces?: boolean;
8031 indentStyle?: IndentStyle | ts.IndentStyle;
8032 }
8033 interface FormatCodeSettings extends EditorSettings {
8034 insertSpaceAfterCommaDelimiter?: boolean;
8035 insertSpaceAfterSemicolonInForStatements?: boolean;
8036 insertSpaceBeforeAndAfterBinaryOperators?: boolean;
8037 insertSpaceAfterConstructor?: boolean;
8038 insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
8039 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
8040 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
8041 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
8042 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
8043 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
8044 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
8045 insertSpaceAfterTypeAssertion?: boolean;
8046 insertSpaceBeforeFunctionParenthesis?: boolean;
8047 placeOpenBraceOnNewLineForFunctions?: boolean;
8048 placeOpenBraceOnNewLineForControlBlocks?: boolean;
8049 insertSpaceBeforeTypeAnnotation?: boolean;
8050 }
8051 interface UserPreferences {
8052 readonly disableSuggestions?: boolean;
8053 readonly quotePreference?: "auto" | "double" | "single";
8054 /**
8055 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
8056 * This affects lone identifier completions but not completions on the right hand side of `obj.`.
8057 */
8058 readonly includeCompletionsForModuleExports?: boolean;
8059 /**
8060 * If enabled, the completion list will include completions with invalid identifier names.
8061 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
8062 */
8063 readonly includeCompletionsWithInsertText?: boolean;
8064 readonly importModuleSpecifierPreference?: "relative" | "non-relative";
8065 readonly allowTextChangesInNewFiles?: boolean;
8066 readonly lazyConfiguredProjectsFromExternalProject?: boolean;
8067 readonly providePrefixAndSuffixTextForRename?: boolean;
8068 readonly allowRenameOfImportPath?: boolean;
8069 }
8070 interface CompilerOptions {
8071 allowJs?: boolean;
8072 allowSyntheticDefaultImports?: boolean;
8073 allowUnreachableCode?: boolean;
8074 allowUnusedLabels?: boolean;
8075 alwaysStrict?: boolean;
8076 baseUrl?: string;
8077 charset?: string;
8078 checkJs?: boolean;
8079 declaration?: boolean;
8080 declarationDir?: string;
8081 disableSizeLimit?: boolean;
8082 downlevelIteration?: boolean;
8083 emitBOM?: boolean;
8084 emitDecoratorMetadata?: boolean;
8085 experimentalDecorators?: boolean;
8086 forceConsistentCasingInFileNames?: boolean;
8087 importHelpers?: boolean;
8088 inlineSourceMap?: boolean;
8089 inlineSources?: boolean;
8090 isolatedModules?: boolean;
8091 jsx?: JsxEmit | ts.JsxEmit;
8092 lib?: string[];
8093 locale?: string;
8094 mapRoot?: string;
8095 maxNodeModuleJsDepth?: number;
8096 module?: ModuleKind | ts.ModuleKind;
8097 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
8098 newLine?: NewLineKind | ts.NewLineKind;
8099 noEmit?: boolean;
8100 noEmitHelpers?: boolean;
8101 noEmitOnError?: boolean;
8102 noErrorTruncation?: boolean;
8103 noFallthroughCasesInSwitch?: boolean;
8104 noImplicitAny?: boolean;
8105 noImplicitReturns?: boolean;
8106 noImplicitThis?: boolean;
8107 noUnusedLocals?: boolean;
8108 noUnusedParameters?: boolean;
8109 noImplicitUseStrict?: boolean;
8110 noLib?: boolean;
8111 noResolve?: boolean;
8112 out?: string;
8113 outDir?: string;
8114 outFile?: string;
8115 paths?: MapLike<string[]>;
8116 plugins?: PluginImport[];
8117 preserveConstEnums?: boolean;
8118 preserveSymlinks?: boolean;
8119 project?: string;
8120 reactNamespace?: string;
8121 removeComments?: boolean;
8122 references?: ProjectReference[];
8123 rootDir?: string;
8124 rootDirs?: string[];
8125 skipLibCheck?: boolean;
8126 skipDefaultLibCheck?: boolean;
8127 sourceMap?: boolean;
8128 sourceRoot?: string;
8129 strict?: boolean;
8130 strictNullChecks?: boolean;
8131 suppressExcessPropertyErrors?: boolean;
8132 suppressImplicitAnyIndexErrors?: boolean;
8133 target?: ScriptTarget | ts.ScriptTarget;
8134 traceResolution?: boolean;
8135 resolveJsonModule?: boolean;
8136 types?: string[];
8137 /** Paths used to used to compute primary types search locations */
8138 typeRoots?: string[];
8139 [option: string]: CompilerOptionsValue | undefined;
8140 }
8141 enum JsxEmit {
8142 None = "None",
8143 Preserve = "Preserve",
8144 ReactNative = "ReactNative",
8145 React = "React"
8146 }
8147 enum ModuleKind {
8148 None = "None",
8149 CommonJS = "CommonJS",
8150 AMD = "AMD",
8151 UMD = "UMD",
8152 System = "System",
8153 ES6 = "ES6",
8154 ES2015 = "ES2015",
8155 ESNext = "ESNext"
8156 }
8157 enum ModuleResolutionKind {
8158 Classic = "Classic",
8159 Node = "Node"
8160 }
8161 enum NewLineKind {
8162 Crlf = "Crlf",
8163 Lf = "Lf"
8164 }
8165 enum ScriptTarget {
8166 ES3 = "ES3",
8167 ES5 = "ES5",
8168 ES6 = "ES6",
8169 ES2015 = "ES2015",
8170 ES2016 = "ES2016",
8171 ES2017 = "ES2017",
8172 ES2018 = "ES2018",
8173 ES2019 = "ES2019",
8174 ES2020 = "ES2020",
8175 ESNext = "ESNext"
8176 }
8177}
8178declare namespace ts.server {
8179 interface ScriptInfoVersion {
8180 svc: number;
8181 text: number;
8182 }
8183 class ScriptInfo {
8184 private readonly host;
8185 readonly fileName: NormalizedPath;
8186 readonly scriptKind: ScriptKind;
8187 readonly hasMixedContent: boolean;
8188 readonly path: Path;
8189 /**
8190 * All projects that include this file
8191 */
8192 readonly containingProjects: Project[];
8193 private formatSettings;
8194 private preferences;
8195 private textStorage;
8196 constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: ScriptInfoVersion);
8197 isScriptOpen(): boolean;
8198 open(newText: string): void;
8199 close(fileExists?: boolean): void;
8200 getSnapshot(): IScriptSnapshot;
8201 private ensureRealPath;
8202 getFormatCodeSettings(): FormatCodeSettings | undefined;
8203 getPreferences(): protocol.UserPreferences | undefined;
8204 attachToProject(project: Project): boolean;
8205 isAttached(project: Project): boolean;
8206 detachFromProject(project: Project): void;
8207 detachAllProjects(): void;
8208 getDefaultProject(): Project;
8209 registerFileUpdate(): void;
8210 setOptions(formatSettings: FormatCodeSettings, preferences: protocol.UserPreferences | undefined): void;
8211 getLatestVersion(): string;
8212 saveTo(fileName: string): void;
8213 reloadFromFile(tempFileName?: NormalizedPath): boolean;
8214 editContent(start: number, end: number, newText: string): void;
8215 markContainingProjectsAsDirty(): void;
8216 isOrphan(): boolean;
8217 /**
8218 * @param line 1 based index
8219 */
8220 lineToTextSpan(line: number): TextSpan;
8221 /**
8222 * @param line 1 based index
8223 * @param offset 1 based index
8224 */
8225 lineOffsetToPosition(line: number, offset: number): number;
8226 positionToLineOffset(position: number): protocol.Location;
8227 isJavaScript(): boolean;
8228 }
8229}
8230declare namespace ts.server {
8231 interface InstallPackageOptionsWithProject extends InstallPackageOptions {
8232 projectName: string;
8233 projectRootPath: Path;
8234 }
8235 interface ITypingsInstaller {
8236 isKnownTypesPackageName(name: string): boolean;
8237 installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
8238 enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string> | undefined): void;
8239 attach(projectService: ProjectService): void;
8240 onProjectClosed(p: Project): void;
8241 readonly globalTypingsCacheLocation: string | undefined;
8242 }
8243 const nullTypingsInstaller: ITypingsInstaller;
8244}
8245declare namespace ts.server {
8246 enum ProjectKind {
8247 Inferred = 0,
8248 Configured = 1,
8249 External = 2
8250 }
8251 function allRootFilesAreJsOrDts(project: Project): boolean;
8252 function allFilesAreJsOrDts(project: Project): boolean;
8253 interface PluginCreateInfo {
8254 project: Project;
8255 languageService: LanguageService;
8256 languageServiceHost: LanguageServiceHost;
8257 serverHost: ServerHost;
8258 config: any;
8259 }
8260 interface PluginModule {
8261 create(createInfo: PluginCreateInfo): LanguageService;
8262 getExternalFiles?(proj: Project): string[];
8263 onConfigurationChanged?(config: any): void;
8264 }
8265 interface PluginModuleWithName {
8266 name: string;
8267 module: PluginModule;
8268 }
8269 type PluginModuleFactory = (mod: {
8270 typescript: typeof ts;
8271 }) => PluginModule;
8272 /**
8273 * The project root can be script info - if root is present,
8274 * or it could be just normalized path if root wasnt present on the host(only for non inferred project)
8275 */
8276 type ProjectRoot = ScriptInfo | NormalizedPath;
8277 abstract class Project implements LanguageServiceHost, ModuleResolutionHost {
8278 readonly projectName: string;
8279 readonly projectKind: ProjectKind;
8280 readonly projectService: ProjectService;
8281 private documentRegistry;
8282 private compilerOptions;
8283 compileOnSaveEnabled: boolean;
8284 private rootFiles;
8285 private rootFilesMap;
8286 private program;
8287 private externalFiles;
8288 private missingFilesMap;
8289 private plugins;
8290 private lastFileExceededProgramSize;
8291 protected languageService: LanguageService;
8292 languageServiceEnabled: boolean;
8293 readonly trace?: (s: string) => void;
8294 readonly realpath?: (path: string) => string;
8295 private builderState;
8296 /**
8297 * Set of files names that were updated since the last call to getChangesSinceVersion.
8298 */
8299 private updatedFileNames;
8300 /**
8301 * Set of files that was returned from the last call to getChangesSinceVersion.
8302 */
8303 private lastReportedFileNames;
8304 /**
8305 * Last version that was reported.
8306 */
8307 private lastReportedVersion;
8308 /**
8309 * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
8310 * This property is changed in 'updateGraph' based on the set of files in program
8311 */
8312 private projectProgramVersion;
8313 /**
8314 * Current version of the project state. It is changed when:
8315 * - new root file was added/removed
8316 * - edit happen in some file that is currently included in the project.
8317 * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
8318 */
8319 private projectStateVersion;
8320 protected isInitialLoadPending: () => boolean;
8321 private readonly cancellationToken;
8322 isNonTsProject(): boolean;
8323 isJsOnlyProject(): boolean;
8324 static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined;
8325 isKnownTypesPackageName(name: string): boolean;
8326 installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
8327 private readonly typingsCache;
8328 getCompilationSettings(): CompilerOptions;
8329 getCompilerOptions(): CompilerOptions;
8330 getNewLine(): string;
8331 getProjectVersion(): string;
8332 getProjectReferences(): ReadonlyArray<ProjectReference> | undefined;
8333 getScriptFileNames(): string[];
8334 private getOrCreateScriptInfoAndAttachToProject;
8335 getScriptKind(fileName: string): ScriptKind;
8336 getScriptVersion(filename: string): string;
8337 getScriptSnapshot(filename: string): IScriptSnapshot | undefined;
8338 getCancellationToken(): HostCancellationToken;
8339 getCurrentDirectory(): string;
8340 getDefaultLibFileName(): string;
8341 useCaseSensitiveFileNames(): boolean;
8342 readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
8343 readFile(fileName: string): string | undefined;
8344 writeFile(fileName: string, content: string): void;
8345 fileExists(file: string): boolean;
8346 resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModuleFull | undefined)[];
8347 getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
8348 resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
8349 directoryExists(path: string): boolean;
8350 getDirectories(path: string): string[];
8351 log(s: string): void;
8352 error(s: string): void;
8353 private setInternalCompilerOptionsForEmittingJsFiles;
8354 /**
8355 * Get the errors that dont have any file name associated
8356 */
8357 getGlobalProjectErrors(): ReadonlyArray<Diagnostic>;
8358 getAllProjectErrors(): ReadonlyArray<Diagnostic>;
8359 getLanguageService(ensureSynchronized?: boolean): LanguageService;
8360 private shouldEmitFile;
8361 getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[];
8362 /**
8363 * Returns true if emit was conducted
8364 */
8365 emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean;
8366 enableLanguageService(): void;
8367 disableLanguageService(lastFileExceededProgramSize?: string): void;
8368 getProjectName(): string;
8369 abstract getTypeAcquisition(): TypeAcquisition;
8370 protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition;
8371 getExternalFiles(): SortedReadonlyArray<string>;
8372 getSourceFile(path: Path): SourceFile | undefined;
8373 close(): void;
8374 private detachScriptInfoIfNotRoot;
8375 isClosed(): boolean;
8376 hasRoots(): boolean;
8377 getRootFiles(): NormalizedPath[];
8378 getRootScriptInfos(): ScriptInfo[];
8379 getScriptInfos(): ScriptInfo[];
8380 getExcludedFiles(): ReadonlyArray<NormalizedPath>;
8381 getFileNames(excludeFilesFromExternalLibraries?: boolean, excludeConfigFiles?: boolean): NormalizedPath[];
8382 hasConfigFile(configFilePath: NormalizedPath): boolean;
8383 containsScriptInfo(info: ScriptInfo): boolean;
8384 containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean;
8385 isRoot(info: ScriptInfo): boolean;
8386 addRoot(info: ScriptInfo): void;
8387 addMissingFileRoot(fileName: NormalizedPath): void;
8388 removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void;
8389 registerFileUpdate(fileName: string): void;
8390 markAsDirty(): void;
8391 /**
8392 * Updates set of files that contribute to this project
8393 * @returns: true if set of files in the project stays the same and false - otherwise.
8394 */
8395 updateGraph(): boolean;
8396 protected removeExistingTypings(include: string[]): string[];
8397 private updateGraphWorker;
8398 private detachScriptInfoFromProject;
8399 private addMissingFileWatcher;
8400 private isWatchedMissingFile;
8401 getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
8402 getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined;
8403 filesToString(writeProjectFileNames: boolean): string;
8404 setCompilerOptions(compilerOptions: CompilerOptions): void;
8405 protected removeRoot(info: ScriptInfo): void;
8406 protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<any> | undefined): void;
8407 protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<any> | undefined): void;
8408 private enableProxy;
8409 /** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
8410 refreshDiagnostics(): void;
8411 }
8412 /**
8413 * If a file is opened and no tsconfig (or jsconfig) is found,
8414 * the file and its imports/references are put into an InferredProject.
8415 */
8416 class InferredProject extends Project {
8417 private static readonly newName;
8418 private _isJsInferredProject;
8419 toggleJsInferredProject(isJsInferredProject: boolean): void;
8420 setCompilerOptions(options?: CompilerOptions): void;
8421 /** this is canonical project root path */
8422 readonly projectRootPath: string | undefined;
8423 addRoot(info: ScriptInfo): void;
8424 removeRoot(info: ScriptInfo): void;
8425 isProjectWithSingleRoot(): boolean;
8426 close(): void;
8427 getTypeAcquisition(): TypeAcquisition;
8428 }
8429 /**
8430 * If a file is opened, the server will look for a tsconfig (or jsconfig)
8431 * and if successfull create a ConfiguredProject for it.
8432 * Otherwise it will create an InferredProject.
8433 */
8434 class ConfiguredProject extends Project {
8435 private typeAcquisition;
8436 private directoriesWatchedForWildcards;
8437 readonly canonicalConfigFilePath: NormalizedPath;
8438 /** Ref count to the project when opened from external project */
8439 private externalProjectRefCount;
8440 private projectErrors;
8441 private projectReferences;
8442 protected isInitialLoadPending: () => boolean;
8443 /**
8444 * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
8445 * @returns: true if set of files in the project stays the same and false - otherwise.
8446 */
8447 updateGraph(): boolean;
8448 getConfigFilePath(): NormalizedPath;
8449 getProjectReferences(): ReadonlyArray<ProjectReference> | undefined;
8450 updateReferences(refs: ReadonlyArray<ProjectReference> | undefined): void;
8451 /**
8452 * Get the errors that dont have any file name associated
8453 */
8454 getGlobalProjectErrors(): ReadonlyArray<Diagnostic>;
8455 /**
8456 * Get all the project errors
8457 */
8458 getAllProjectErrors(): ReadonlyArray<Diagnostic>;
8459 setProjectErrors(projectErrors: Diagnostic[]): void;
8460 setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void;
8461 getTypeAcquisition(): TypeAcquisition;
8462 close(): void;
8463 getEffectiveTypeRoots(): string[];
8464 }
8465 /**
8466 * Project whose configuration is handled externally, such as in a '.csproj'.
8467 * These are created only if a host explicitly calls `openExternalProject`.
8468 */
8469 class ExternalProject extends Project {
8470 externalProjectName: string;
8471 compileOnSaveEnabled: boolean;
8472 excludedFiles: ReadonlyArray<NormalizedPath>;
8473 private typeAcquisition;
8474 updateGraph(): boolean;
8475 getExcludedFiles(): readonly NormalizedPath[];
8476 getTypeAcquisition(): TypeAcquisition;
8477 setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void;
8478 }
8479}
8480declare namespace ts.server {
8481 const maxProgramSizeForNonTsFiles: number;
8482 const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
8483 const ProjectLoadingStartEvent = "projectLoadingStart";
8484 const ProjectLoadingFinishEvent = "projectLoadingFinish";
8485 const LargeFileReferencedEvent = "largeFileReferenced";
8486 const ConfigFileDiagEvent = "configFileDiag";
8487 const ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
8488 const ProjectInfoTelemetryEvent = "projectInfo";
8489 const OpenFileInfoTelemetryEvent = "openFileInfo";
8490 interface ProjectsUpdatedInBackgroundEvent {
8491 eventName: typeof ProjectsUpdatedInBackgroundEvent;
8492 data: {
8493 openFiles: string[];
8494 };
8495 }
8496 interface ProjectLoadingStartEvent {
8497 eventName: typeof ProjectLoadingStartEvent;
8498 data: {
8499 project: Project;
8500 reason: string;
8501 };
8502 }
8503 interface ProjectLoadingFinishEvent {
8504 eventName: typeof ProjectLoadingFinishEvent;
8505 data: {
8506 project: Project;
8507 };
8508 }
8509 interface LargeFileReferencedEvent {
8510 eventName: typeof LargeFileReferencedEvent;
8511 data: {
8512 file: string;
8513 fileSize: number;
8514 maxFileSize: number;
8515 };
8516 }
8517 interface ConfigFileDiagEvent {
8518 eventName: typeof ConfigFileDiagEvent;
8519 data: {
8520 triggerFile: string;
8521 configFileName: string;
8522 diagnostics: ReadonlyArray<Diagnostic>;
8523 };
8524 }
8525 interface ProjectLanguageServiceStateEvent {
8526 eventName: typeof ProjectLanguageServiceStateEvent;
8527 data: {
8528 project: Project;
8529 languageServiceEnabled: boolean;
8530 };
8531 }
8532 /** This will be converted to the payload of a protocol.TelemetryEvent in session.defaultEventHandler. */
8533 interface ProjectInfoTelemetryEvent {
8534 readonly eventName: typeof ProjectInfoTelemetryEvent;
8535 readonly data: ProjectInfoTelemetryEventData;
8536 }
8537 interface ProjectInfoTelemetryEventData {
8538 /** Cryptographically secure hash of project file location. */
8539 readonly projectId: string;
8540 /** Count of file extensions seen in the project. */
8541 readonly fileStats: FileStats;
8542 /**
8543 * Any compiler options that might contain paths will be taken out.
8544 * Enum compiler options will be converted to strings.
8545 */
8546 readonly compilerOptions: CompilerOptions;
8547 readonly extends: boolean | undefined;
8548 readonly files: boolean | undefined;
8549 readonly include: boolean | undefined;
8550 readonly exclude: boolean | undefined;
8551 readonly compileOnSave: boolean;
8552 readonly typeAcquisition: ProjectInfoTypeAcquisitionData;
8553 readonly configFileName: "tsconfig.json" | "jsconfig.json" | "other";
8554 readonly projectType: "external" | "configured";
8555 readonly languageServiceEnabled: boolean;
8556 /** TypeScript version used by the server. */
8557 readonly version: string;
8558 }
8559 /**
8560 * Info that we may send about a file that was just opened.
8561 * Info about a file will only be sent once per session, even if the file changes in ways that might affect the info.
8562 * Currently this is only sent for '.js' files.
8563 */
8564 interface OpenFileInfoTelemetryEvent {
8565 readonly eventName: typeof OpenFileInfoTelemetryEvent;
8566 readonly data: OpenFileInfoTelemetryEventData;
8567 }
8568 interface OpenFileInfoTelemetryEventData {
8569 readonly info: OpenFileInfo;
8570 }
8571 interface ProjectInfoTypeAcquisitionData {
8572 readonly enable: boolean | undefined;
8573 readonly include: boolean;
8574 readonly exclude: boolean;
8575 }
8576 interface FileStats {
8577 readonly js: number;
8578 readonly jsSize?: number;
8579 readonly jsx: number;
8580 readonly jsxSize?: number;
8581 readonly ts: number;
8582 readonly tsSize?: number;
8583 readonly tsx: number;
8584 readonly tsxSize?: number;
8585 readonly dts: number;
8586 readonly dtsSize?: number;
8587 readonly deferred: number;
8588 readonly deferredSize?: number;
8589 }
8590 interface OpenFileInfo {
8591 readonly checkJs: boolean;
8592 }
8593 type ProjectServiceEvent = LargeFileReferencedEvent | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent;
8594 type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void;
8595 interface SafeList {
8596 [name: string]: {
8597 match: RegExp;
8598 exclude?: (string | number)[][];
8599 types?: string[];
8600 };
8601 }
8602 interface TypesMapFile {
8603 typesMap: SafeList;
8604 simpleMap: {
8605 [libName: string]: string;
8606 };
8607 }
8608 function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings;
8609 function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin;
8610 function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind;
8611 function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind.Unknown | ScriptKind.JS | ScriptKind.JSX | ScriptKind.TS | ScriptKind.TSX;
8612 interface HostConfiguration {
8613 formatCodeOptions: FormatCodeSettings;
8614 preferences: protocol.UserPreferences;
8615 hostInfo: string;
8616 extraFileExtensions?: FileExtensionInfo[];
8617 }
8618 interface OpenConfiguredProjectResult {
8619 configFileName?: NormalizedPath;
8620 configFileErrors?: ReadonlyArray<Diagnostic>;
8621 }
8622 interface ProjectServiceOptions {
8623 host: ServerHost;
8624 logger: Logger;
8625 cancellationToken: HostCancellationToken;
8626 useSingleInferredProject: boolean;
8627 useInferredProjectPerProjectRoot: boolean;
8628 typingsInstaller: ITypingsInstaller;
8629 eventHandler?: ProjectServiceEventHandler;
8630 suppressDiagnosticEvents?: boolean;
8631 throttleWaitMilliseconds?: number;
8632 globalPlugins?: ReadonlyArray<string>;
8633 pluginProbeLocations?: ReadonlyArray<string>;
8634 allowLocalPluginLoads?: boolean;
8635 typesMapLocation?: string;
8636 syntaxOnly?: boolean;
8637 }
8638 class ProjectService {
8639 private readonly scriptInfoInNodeModulesWatchers;
8640 /**
8641 * Contains all the deleted script info's version information so that
8642 * it does not reset when creating script info again
8643 * (and could have potentially collided with version where contents mismatch)
8644 */
8645 private readonly filenameToScriptInfoVersion;
8646 private readonly allJsFilesForOpenFileTelemetry;
8647 /**
8648 * maps external project file name to list of config files that were the part of this project
8649 */
8650 private readonly externalProjectToConfiguredProjectMap;
8651 /**
8652 * external projects (configuration and list of root files is not controlled by tsserver)
8653 */
8654 readonly externalProjects: ExternalProject[];
8655 /**
8656 * projects built from openFileRoots
8657 */
8658 readonly inferredProjects: InferredProject[];
8659 /**
8660 * projects specified by a tsconfig.json file
8661 */
8662 readonly configuredProjects: Map<ConfiguredProject>;
8663 /**
8664 * Open files: with value being project root path, and key being Path of the file that is open
8665 */
8666 readonly openFiles: Map<NormalizedPath | undefined>;
8667 /**
8668 * Map of open files that are opened without complete path but have projectRoot as current directory
8669 */
8670 private readonly openFilesWithNonRootedDiskPath;
8671 private compilerOptionsForInferredProjects;
8672 private compilerOptionsForInferredProjectsPerProjectRoot;
8673 /**
8674 * Project size for configured or external projects
8675 */
8676 private readonly projectToSizeMap;
8677 /**
8678 * This is a map of config file paths existance that doesnt need query to disk
8679 * - The entry can be present because there is inferred project that needs to watch addition of config file to directory
8680 * In this case the exists could be true/false based on config file is present or not
8681 * - Or it is present if we have configured project open with config file at that location
8682 * In this case the exists property is always true
8683 */
8684 private readonly configFileExistenceInfoCache;
8685 private readonly throttledOperations;
8686 private readonly hostConfiguration;
8687 private safelist;
8688 private readonly legacySafelist;
8689 private pendingProjectUpdates;
8690 readonly currentDirectory: NormalizedPath;
8691 readonly toCanonicalFileName: (f: string) => string;
8692 readonly host: ServerHost;
8693 readonly logger: Logger;
8694 readonly cancellationToken: HostCancellationToken;
8695 readonly useSingleInferredProject: boolean;
8696 readonly useInferredProjectPerProjectRoot: boolean;
8697 readonly typingsInstaller: ITypingsInstaller;
8698 private readonly globalCacheLocationDirectoryPath;
8699 readonly throttleWaitMilliseconds?: number;
8700 private readonly eventHandler?;
8701 private readonly suppressDiagnosticEvents?;
8702 readonly globalPlugins: ReadonlyArray<string>;
8703 readonly pluginProbeLocations: ReadonlyArray<string>;
8704 readonly allowLocalPluginLoads: boolean;
8705 private currentPluginConfigOverrides;
8706 readonly typesMapLocation: string | undefined;
8707 readonly syntaxOnly?: boolean;
8708 /** Tracks projects that we have already sent telemetry for. */
8709 private readonly seenProjects;
8710 constructor(opts: ProjectServiceOptions);
8711 toPath(fileName: string): Path;
8712 private loadTypesMap;
8713 updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse): void;
8714 private delayEnsureProjectForOpenFiles;
8715 private delayUpdateProjectGraph;
8716 private delayUpdateProjectGraphs;
8717 setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions, projectRootPath?: string): void;
8718 findProject(projectName: string): Project | undefined;
8719 getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined;
8720 private doEnsureDefaultProjectForFile;
8721 getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined;
8722 /**
8723 * Ensures the project structures are upto date
8724 * This means,
8725 * - we go through all the projects and update them if they are dirty
8726 * - if updates reflect some change in structure or there was pending request to ensure projects for open files
8727 * ensure that each open script info has project
8728 */
8729 private ensureProjectStructuresUptoDate;
8730 getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings;
8731 getPreferences(file: NormalizedPath): protocol.UserPreferences;
8732 getHostFormatCodeOptions(): FormatCodeSettings;
8733 getHostPreferences(): protocol.UserPreferences;
8734 private onSourceFileChanged;
8735 private handleSourceMapProjects;
8736 private delayUpdateSourceInfoProjects;
8737 private delayUpdateProjectsOfScriptInfoPath;
8738 private handleDeletedFile;
8739 private onConfigChangedForConfiguredProject;
8740 /**
8741 * This is the callback function for the config file add/remove/change at any location
8742 * that matters to open script info but doesnt have configured project open
8743 * for the config file
8744 */
8745 private onConfigFileChangeForOpenScriptInfo;
8746 private removeProject;
8747 private assignOrphanScriptInfosToInferredProject;
8748 /**
8749 * Remove this file from the set of open, non-configured files.
8750 * @param info The file that has been closed or newly configured
8751 */
8752 private closeOpenFile;
8753 private deleteScriptInfo;
8754 private configFileExists;
8755 private setConfigFileExistenceByNewConfiguredProject;
8756 /**
8757 * Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project
8758 */
8759 private configFileExistenceImpactsRootOfInferredProject;
8760 private setConfigFileExistenceInfoByClosedConfiguredProject;
8761 private logConfigFileWatchUpdate;
8762 /**
8763 * Create the watcher for the configFileExistenceInfo
8764 */
8765 private createConfigFileWatcherOfConfigFileExistence;
8766 /**
8767 * Close the config file watcher in the cached ConfigFileExistenceInfo
8768 * if there arent any open files that are root of inferred project
8769 */
8770 private closeConfigFileWatcherOfConfigFileExistenceInfo;
8771 /**
8772 * This is called on file close, so that we stop watching the config file for this script info
8773 */
8774 private stopWatchingConfigFilesForClosedScriptInfo;
8775 /**
8776 * This function tries to search for a tsconfig.json for the given file.
8777 * This is different from the method the compiler uses because
8778 * the compiler can assume it will always start searching in the
8779 * current directory (the directory in which tsc was invoked).
8780 * The server must start searching from the directory containing
8781 * the newly opened file.
8782 */
8783 private forEachConfigFileLocation;
8784 /**
8785 * This function tries to search for a tsconfig.json for the given file.
8786 * This is different from the method the compiler uses because
8787 * the compiler can assume it will always start searching in the
8788 * current directory (the directory in which tsc was invoked).
8789 * The server must start searching from the directory containing
8790 * the newly opened file.
8791 * If script info is passed in, it is asserted to be open script info
8792 * otherwise just file name
8793 */
8794 private getConfigFileNameForFile;
8795 private printProjects;
8796 private findConfiguredProjectByProjectName;
8797 private getConfiguredProjectByCanonicalConfigFilePath;
8798 private findExternalProjectByProjectName;
8799 /** Get a filename if the language service exceeds the maximum allowed program size; otherwise returns undefined. */
8800 private getFilenameForExceededTotalSizeLimitForNonTsFiles;
8801 private createExternalProject;
8802 private addFilesToNonInferredProject;
8803 private createConfiguredProject;
8804 private updateNonInferredProjectFiles;
8805 private updateRootAndOptionsOfNonInferredProject;
8806 private sendConfigFileDiagEvent;
8807 private getOrCreateInferredProjectForProjectRootPathIfEnabled;
8808 private getOrCreateSingleInferredProjectIfEnabled;
8809 private getOrCreateSingleInferredWithoutProjectRoot;
8810 private createInferredProject;
8811 getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined;
8812 private watchClosedScriptInfo;
8813 private watchClosedScriptInfoInNodeModules;
8814 private getModifiedTime;
8815 private refreshScriptInfo;
8816 private refreshScriptInfosInDirectory;
8817 private stopWatchingScriptInfo;
8818 private getOrCreateScriptInfoNotOpenedByClientForNormalizedPath;
8819 private getOrCreateScriptInfoOpenedByClientForNormalizedPath;
8820 getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: {
8821 fileExists(path: string): boolean;
8822 }): ScriptInfo | undefined;
8823 private getOrCreateScriptInfoWorker;
8824 /**
8825 * 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
8826 */
8827 getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
8828 getScriptInfoForPath(fileName: Path): ScriptInfo | undefined;
8829 private addSourceInfoToSourceMap;
8830 private addMissingSourceMapFile;
8831 setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
8832 closeLog(): void;
8833 /**
8834 * This function rebuilds the project for every file opened by the client
8835 * This does not reload contents of open files from disk. But we could do that if needed
8836 */
8837 reloadProjects(): void;
8838 private delayReloadConfiguredProjectForFiles;
8839 /**
8840 * This function goes through all the openFiles and tries to file the config file for them.
8841 * If the config file is found and it refers to existing project, it reloads it either immediately
8842 * or schedules it for reload depending on delayReload option
8843 * If the there is no existing project it just opens the configured project for the config file
8844 * reloadForInfo provides a way to filter out files to reload configured project for
8845 */
8846 private reloadConfiguredProjectForFiles;
8847 /**
8848 * Remove the root of inferred project if script info is part of another project
8849 */
8850 private removeRootOfInferredProjectIfNowPartOfOtherProject;
8851 /**
8852 * This function is to update the project structure for every inferred project.
8853 * It is called on the premise that all the configured projects are
8854 * up to date.
8855 * This will go through open files and assign them to inferred project if open file is not part of any other project
8856 * After that all the inferred project graphs are updated
8857 */
8858 private ensureProjectForOpenFiles;
8859 /**
8860 * Open file whose contents is managed by the client
8861 * @param filename is absolute pathname
8862 * @param fileContent is a known version of the file content that is more up to date than the one on disk
8863 */
8864 openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult;
8865 private findExternalProjectContainingOpenScriptInfo;
8866 private getOrCreateOpenScriptInfo;
8867 private assignProjectToOpenedScriptInfo;
8868 private cleanupAfterOpeningFile;
8869 openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
8870 private removeOrphanConfiguredProjects;
8871 private removeOrphanScriptInfos;
8872 private telemetryOnOpenFile;
8873 /**
8874 * Close file whose contents is managed by the client
8875 * @param filename is absolute pathname
8876 */
8877 closeClientFile(uncheckedFileName: string): void;
8878 private collectChanges;
8879 private closeConfiguredProjectReferencedFromExternalProject;
8880 closeExternalProject(uncheckedFileName: string): void;
8881 openExternalProjects(projects: protocol.ExternalProject[]): void;
8882 /** Makes a filename safe to insert in a RegExp */
8883 private static readonly filenameEscapeRegexp;
8884 private static escapeFilenameForRegex;
8885 resetSafeList(): void;
8886 applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
8887 openExternalProject(proj: protocol.ExternalProject): void;
8888 hasDeferredExtension(): boolean;
8889 configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
8890 }
8891}
8892declare namespace ts.server {
8893 interface ServerCancellationToken extends HostCancellationToken {
8894 setRequest(requestId: number): void;
8895 resetRequest(requestId: number): void;
8896 }
8897 const nullCancellationToken: ServerCancellationToken;
8898 interface PendingErrorCheck {
8899 fileName: NormalizedPath;
8900 project: Project;
8901 }
8902 type CommandNames = protocol.CommandTypes;
8903 const CommandNames: any;
8904 function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string;
8905 type Event = <T extends object>(body: T, eventName: string) => void;
8906 interface EventSender {
8907 event: Event;
8908 }
8909 interface SessionOptions {
8910 host: ServerHost;
8911 cancellationToken: ServerCancellationToken;
8912 useSingleInferredProject: boolean;
8913 useInferredProjectPerProjectRoot: boolean;
8914 typingsInstaller: ITypingsInstaller;
8915 byteLength: (buf: string, encoding?: string) => number;
8916 hrtime: (start?: number[]) => number[];
8917 logger: Logger;
8918 /**
8919 * If falsy, all events are suppressed.
8920 */
8921 canUseEvents: boolean;
8922 eventHandler?: ProjectServiceEventHandler;
8923 /** Has no effect if eventHandler is also specified. */
8924 suppressDiagnosticEvents?: boolean;
8925 syntaxOnly?: boolean;
8926 throttleWaitMilliseconds?: number;
8927 noGetErrOnBackgroundUpdate?: boolean;
8928 globalPlugins?: ReadonlyArray<string>;
8929 pluginProbeLocations?: ReadonlyArray<string>;
8930 allowLocalPluginLoads?: boolean;
8931 typesMapLocation?: string;
8932 }
8933 class Session implements EventSender {
8934 private readonly gcTimer;
8935 protected projectService: ProjectService;
8936 private changeSeq;
8937 private currentRequestId;
8938 private errorCheck;
8939 protected host: ServerHost;
8940 private readonly cancellationToken;
8941 protected readonly typingsInstaller: ITypingsInstaller;
8942 protected byteLength: (buf: string, encoding?: string) => number;
8943 private hrtime;
8944 protected logger: Logger;
8945 protected canUseEvents: boolean;
8946 private suppressDiagnosticEvents?;
8947 private eventHandler;
8948 private readonly noGetErrOnBackgroundUpdate?;
8949 constructor(opts: SessionOptions);
8950 private sendRequestCompletedEvent;
8951 private defaultEventHandler;
8952 private projectsUpdatedInBackgroundEvent;
8953 logError(err: Error, cmd: string): void;
8954 private logErrorWorker;
8955 send(msg: protocol.Message): void;
8956 event<T extends object>(body: T, eventName: string): void;
8957 /** @deprecated */
8958 output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void;
8959 private doOutput;
8960 private semanticCheck;
8961 private syntacticCheck;
8962 private suggestionCheck;
8963 private sendDiagnosticsEvent;
8964 /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
8965 private updateErrorCheck;
8966 private cleanProjects;
8967 private cleanup;
8968 private getEncodedSemanticClassifications;
8969 private getProject;
8970 private getConfigFileAndProject;
8971 private getConfigFileDiagnostics;
8972 private convertToDiagnosticsWithLinePositionFromDiagnosticFile;
8973 private getCompilerOptionsDiagnostics;
8974 private convertToDiagnosticsWithLinePosition;
8975 private getDiagnosticsWorker;
8976 private getDefinition;
8977 private mapDefinitionInfoLocations;
8978 private getDefinitionAndBoundSpan;
8979 private getEmitOutput;
8980 private mapDefinitionInfo;
8981 private static mapToOriginalLocation;
8982 private toFileSpan;
8983 private getTypeDefinition;
8984 private mapImplementationLocations;
8985 private getImplementation;
8986 private getOccurrences;
8987 private getSyntacticDiagnosticsSync;
8988 private getSemanticDiagnosticsSync;
8989 private getSuggestionDiagnosticsSync;
8990 private getJsxClosingTag;
8991 private getDocumentHighlights;
8992 private setCompilerOptionsForInferredProjects;
8993 private getProjectInfo;
8994 private getProjectInfoWorker;
8995 private getRenameInfo;
8996 private getProjects;
8997 private getDefaultProject;
8998 private getRenameLocations;
8999 private mapRenameInfo;
9000 private toSpanGroups;
9001 private getReferences;
9002 /**
9003 * @param fileName is the name of the file to be opened
9004 * @param fileContent is a version of the file content that is known to be more up to date than the one on disk
9005 */
9006 private openClientFile;
9007 private getPosition;
9008 private getPositionInFile;
9009 private getFileAndProject;
9010 private getFileAndLanguageServiceForSyntacticOperation;
9011 private getFileAndProjectWorker;
9012 private getOutliningSpans;
9013 private getTodoComments;
9014 private getDocCommentTemplate;
9015 private getSpanOfEnclosingComment;
9016 private getIndentation;
9017 private getBreakpointStatement;
9018 private getNameOrDottedNameSpan;
9019 private isValidBraceCompletion;
9020 private getQuickInfoWorker;
9021 private getFormattingEditsForRange;
9022 private getFormattingEditsForRangeFull;
9023 private getFormattingEditsForDocumentFull;
9024 private getFormattingEditsAfterKeystrokeFull;
9025 private getFormattingEditsAfterKeystroke;
9026 private getCompletions;
9027 private getCompletionEntryDetails;
9028 private getCompileOnSaveAffectedFileList;
9029 private emitFile;
9030 private getSignatureHelpItems;
9031 private createCheckList;
9032 private getDiagnostics;
9033 private change;
9034 private reload;
9035 private saveToTmp;
9036 private closeClientFile;
9037 private mapLocationNavigationBarItems;
9038 private getNavigationBarItems;
9039 private toLocationNavigationTree;
9040 private toLocationTextSpan;
9041 private getNavigationTree;
9042 private getNavigateToItems;
9043 private getFullNavigateToItems;
9044 private getSupportedCodeFixes;
9045 private isLocation;
9046 private extractPositionOrRange;
9047 private getApplicableRefactors;
9048 private getEditsForRefactor;
9049 private organizeImports;
9050 private getEditsForFileRename;
9051 private getCodeFixes;
9052 private getCombinedCodeFix;
9053 private applyCodeActionCommand;
9054 private getStartAndEndPosition;
9055 private mapCodeAction;
9056 private mapCodeFixAction;
9057 private mapTextChangesToCodeEdits;
9058 private mapTextChangeToCodeEdit;
9059 private convertTextChangeToCodeEdit;
9060 private getBraceMatching;
9061 private getDiagnosticsForProject;
9062 private configurePlugin;
9063 private getSmartSelectionRange;
9064 private mapSelectionRange;
9065 getCanonicalFileName(fileName: string): string;
9066 exit(): void;
9067 private notRequired;
9068 private requiredResponse;
9069 private handlers;
9070 addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse): void;
9071 private setCurrentRequest;
9072 private resetCurrentRequest;
9073 executeWithRequestId<T>(requestId: number, f: () => T): T;
9074 executeCommand(request: protocol.Request): HandlerResponse;
9075 onMessage(message: string): void;
9076 private getFormatOptions;
9077 private getPreferences;
9078 private getHostFormatOptions;
9079 private getHostPreferences;
9080 }
9081 interface HandlerResponse {
9082 response?: {};
9083 responseRequired?: boolean;
9084 }
9085}
9086
9087export = ts;
9088export as namespace ts;
\No newline at end of file