tsrc 2.1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE +55 -0
  5. data/README.md +33 -0
  6. data/Rakefile +16 -0
  7. data/lib/tsrc.rb +57 -0
  8. data/lib/tsrc/support/typescript/.mailmap +216 -0
  9. data/lib/tsrc/support/typescript/.npmignore +19 -0
  10. data/lib/tsrc/support/typescript/AUTHORS.md +204 -0
  11. data/lib/tsrc/support/typescript/CONTRIBUTING.md +185 -0
  12. data/lib/tsrc/support/typescript/CopyrightNotice.txt +15 -0
  13. data/lib/tsrc/support/typescript/LICENSE.txt +55 -0
  14. data/lib/tsrc/support/typescript/README.md +98 -0
  15. data/lib/tsrc/support/typescript/ThirdPartyNoticeText.txt +35 -0
  16. data/lib/tsrc/support/typescript/bin/tsc +2 -0
  17. data/lib/tsrc/support/typescript/bin/tsserver +2 -0
  18. data/lib/tsrc/support/typescript/lib/README.md +5 -0
  19. data/lib/tsrc/support/typescript/lib/cancellationToken.js +41 -0
  20. data/lib/tsrc/support/typescript/lib/lib.d.ts +18215 -0
  21. data/lib/tsrc/support/typescript/lib/lib.dom.d.ts +13738 -0
  22. data/lib/tsrc/support/typescript/lib/lib.dom.iterable.d.ts +33 -0
  23. data/lib/tsrc/support/typescript/lib/lib.es2015.collection.d.ts +92 -0
  24. data/lib/tsrc/support/typescript/lib/lib.es2015.core.d.ts +544 -0
  25. data/lib/tsrc/support/typescript/lib/lib.es2015.d.ts +30 -0
  26. data/lib/tsrc/support/typescript/lib/lib.es2015.generator.d.ts +32 -0
  27. data/lib/tsrc/support/typescript/lib/lib.es2015.iterable.d.ts +465 -0
  28. data/lib/tsrc/support/typescript/lib/lib.es2015.promise.d.ts +274 -0
  29. data/lib/tsrc/support/typescript/lib/lib.es2015.proxy.d.ts +42 -0
  30. data/lib/tsrc/support/typescript/lib/lib.es2015.reflect.d.ts +35 -0
  31. data/lib/tsrc/support/typescript/lib/lib.es2015.symbol.d.ts +56 -0
  32. data/lib/tsrc/support/typescript/lib/lib.es2015.symbol.wellknown.d.ts +347 -0
  33. data/lib/tsrc/support/typescript/lib/lib.es2016.array.include.d.ts +118 -0
  34. data/lib/tsrc/support/typescript/lib/lib.es2016.d.ts +22 -0
  35. data/lib/tsrc/support/typescript/lib/lib.es2017.d.ts +24 -0
  36. data/lib/tsrc/support/typescript/lib/lib.es2017.object.d.ts +45 -0
  37. data/lib/tsrc/support/typescript/lib/lib.es2017.sharedmemory.d.ts +47 -0
  38. data/lib/tsrc/support/typescript/lib/lib.es2017.string.d.ts +47 -0
  39. data/lib/tsrc/support/typescript/lib/lib.es5.d.ts +4195 -0
  40. data/lib/tsrc/support/typescript/lib/lib.es6.d.ts +19950 -0
  41. data/lib/tsrc/support/typescript/lib/lib.scripthost.d.ts +311 -0
  42. data/lib/tsrc/support/typescript/lib/lib.webworker.d.ts +1274 -0
  43. data/lib/tsrc/support/typescript/lib/protocol.d.ts +1900 -0
  44. data/lib/tsrc/support/typescript/lib/tsc.js +52470 -0
  45. data/lib/tsrc/support/typescript/lib/tsserver.js +70720 -0
  46. data/lib/tsrc/support/typescript/lib/tsserverlibrary.d.ts +11939 -0
  47. data/lib/tsrc/support/typescript/lib/tsserverlibrary.js +70256 -0
  48. data/lib/tsrc/support/typescript/lib/typescript.d.ts +3166 -0
  49. data/lib/tsrc/support/typescript/lib/typescript.js +81536 -0
  50. data/lib/tsrc/support/typescript/lib/typescriptServices.d.ts +3164 -0
  51. data/lib/tsrc/support/typescript/lib/typescriptServices.js +81536 -0
  52. data/lib/tsrc/support/typescript/lib/typingsInstaller.js +7314 -0
  53. data/lib/tsrc/support/typescript/package.json +129 -0
  54. data/lib/tsrc/support/typescript/test.config +1 -0
  55. data/lib/tsrc/version.rb +5 -0
  56. data/tsrc.gemspec +20 -0
  57. metadata +113 -0
@@ -0,0 +1,3164 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+ declare namespace ts {
17
+ interface MapLike<T> {
18
+ [index: string]: T;
19
+ }
20
+ interface Map<T> extends MapLike<T> {
21
+ __mapBrand: any;
22
+ }
23
+ type Path = string & {
24
+ __pathBrand: any;
25
+ };
26
+ interface FileMap<T> {
27
+ get(fileName: Path): T;
28
+ set(fileName: Path, value: T): void;
29
+ contains(fileName: Path): boolean;
30
+ remove(fileName: Path): void;
31
+ forEachValue(f: (key: Path, v: T) => void): void;
32
+ getKeys(): Path[];
33
+ clear(): void;
34
+ }
35
+ interface TextRange {
36
+ pos: number;
37
+ end: number;
38
+ }
39
+ enum SyntaxKind {
40
+ Unknown = 0,
41
+ EndOfFileToken = 1,
42
+ SingleLineCommentTrivia = 2,
43
+ MultiLineCommentTrivia = 3,
44
+ NewLineTrivia = 4,
45
+ WhitespaceTrivia = 5,
46
+ ShebangTrivia = 6,
47
+ ConflictMarkerTrivia = 7,
48
+ NumericLiteral = 8,
49
+ StringLiteral = 9,
50
+ JsxText = 10,
51
+ RegularExpressionLiteral = 11,
52
+ NoSubstitutionTemplateLiteral = 12,
53
+ TemplateHead = 13,
54
+ TemplateMiddle = 14,
55
+ TemplateTail = 15,
56
+ OpenBraceToken = 16,
57
+ CloseBraceToken = 17,
58
+ OpenParenToken = 18,
59
+ CloseParenToken = 19,
60
+ OpenBracketToken = 20,
61
+ CloseBracketToken = 21,
62
+ DotToken = 22,
63
+ DotDotDotToken = 23,
64
+ SemicolonToken = 24,
65
+ CommaToken = 25,
66
+ LessThanToken = 26,
67
+ LessThanSlashToken = 27,
68
+ GreaterThanToken = 28,
69
+ LessThanEqualsToken = 29,
70
+ GreaterThanEqualsToken = 30,
71
+ EqualsEqualsToken = 31,
72
+ ExclamationEqualsToken = 32,
73
+ EqualsEqualsEqualsToken = 33,
74
+ ExclamationEqualsEqualsToken = 34,
75
+ EqualsGreaterThanToken = 35,
76
+ PlusToken = 36,
77
+ MinusToken = 37,
78
+ AsteriskToken = 38,
79
+ AsteriskAsteriskToken = 39,
80
+ SlashToken = 40,
81
+ PercentToken = 41,
82
+ PlusPlusToken = 42,
83
+ MinusMinusToken = 43,
84
+ LessThanLessThanToken = 44,
85
+ GreaterThanGreaterThanToken = 45,
86
+ GreaterThanGreaterThanGreaterThanToken = 46,
87
+ AmpersandToken = 47,
88
+ BarToken = 48,
89
+ CaretToken = 49,
90
+ ExclamationToken = 50,
91
+ TildeToken = 51,
92
+ AmpersandAmpersandToken = 52,
93
+ BarBarToken = 53,
94
+ QuestionToken = 54,
95
+ ColonToken = 55,
96
+ AtToken = 56,
97
+ EqualsToken = 57,
98
+ PlusEqualsToken = 58,
99
+ MinusEqualsToken = 59,
100
+ AsteriskEqualsToken = 60,
101
+ AsteriskAsteriskEqualsToken = 61,
102
+ SlashEqualsToken = 62,
103
+ PercentEqualsToken = 63,
104
+ LessThanLessThanEqualsToken = 64,
105
+ GreaterThanGreaterThanEqualsToken = 65,
106
+ GreaterThanGreaterThanGreaterThanEqualsToken = 66,
107
+ AmpersandEqualsToken = 67,
108
+ BarEqualsToken = 68,
109
+ CaretEqualsToken = 69,
110
+ Identifier = 70,
111
+ BreakKeyword = 71,
112
+ CaseKeyword = 72,
113
+ CatchKeyword = 73,
114
+ ClassKeyword = 74,
115
+ ConstKeyword = 75,
116
+ ContinueKeyword = 76,
117
+ DebuggerKeyword = 77,
118
+ DefaultKeyword = 78,
119
+ DeleteKeyword = 79,
120
+ DoKeyword = 80,
121
+ ElseKeyword = 81,
122
+ EnumKeyword = 82,
123
+ ExportKeyword = 83,
124
+ ExtendsKeyword = 84,
125
+ FalseKeyword = 85,
126
+ FinallyKeyword = 86,
127
+ ForKeyword = 87,
128
+ FunctionKeyword = 88,
129
+ IfKeyword = 89,
130
+ ImportKeyword = 90,
131
+ InKeyword = 91,
132
+ InstanceOfKeyword = 92,
133
+ NewKeyword = 93,
134
+ NullKeyword = 94,
135
+ ReturnKeyword = 95,
136
+ SuperKeyword = 96,
137
+ SwitchKeyword = 97,
138
+ ThisKeyword = 98,
139
+ ThrowKeyword = 99,
140
+ TrueKeyword = 100,
141
+ TryKeyword = 101,
142
+ TypeOfKeyword = 102,
143
+ VarKeyword = 103,
144
+ VoidKeyword = 104,
145
+ WhileKeyword = 105,
146
+ WithKeyword = 106,
147
+ ImplementsKeyword = 107,
148
+ InterfaceKeyword = 108,
149
+ LetKeyword = 109,
150
+ PackageKeyword = 110,
151
+ PrivateKeyword = 111,
152
+ ProtectedKeyword = 112,
153
+ PublicKeyword = 113,
154
+ StaticKeyword = 114,
155
+ YieldKeyword = 115,
156
+ AbstractKeyword = 116,
157
+ AsKeyword = 117,
158
+ AnyKeyword = 118,
159
+ AsyncKeyword = 119,
160
+ AwaitKeyword = 120,
161
+ BooleanKeyword = 121,
162
+ ConstructorKeyword = 122,
163
+ DeclareKeyword = 123,
164
+ GetKeyword = 124,
165
+ IsKeyword = 125,
166
+ KeyOfKeyword = 126,
167
+ ModuleKeyword = 127,
168
+ NamespaceKeyword = 128,
169
+ NeverKeyword = 129,
170
+ ReadonlyKeyword = 130,
171
+ RequireKeyword = 131,
172
+ NumberKeyword = 132,
173
+ SetKeyword = 133,
174
+ StringKeyword = 134,
175
+ SymbolKeyword = 135,
176
+ TypeKeyword = 136,
177
+ UndefinedKeyword = 137,
178
+ FromKeyword = 138,
179
+ GlobalKeyword = 139,
180
+ OfKeyword = 140,
181
+ QualifiedName = 141,
182
+ ComputedPropertyName = 142,
183
+ TypeParameter = 143,
184
+ Parameter = 144,
185
+ Decorator = 145,
186
+ PropertySignature = 146,
187
+ PropertyDeclaration = 147,
188
+ MethodSignature = 148,
189
+ MethodDeclaration = 149,
190
+ Constructor = 150,
191
+ GetAccessor = 151,
192
+ SetAccessor = 152,
193
+ CallSignature = 153,
194
+ ConstructSignature = 154,
195
+ IndexSignature = 155,
196
+ TypePredicate = 156,
197
+ TypeReference = 157,
198
+ FunctionType = 158,
199
+ ConstructorType = 159,
200
+ TypeQuery = 160,
201
+ TypeLiteral = 161,
202
+ ArrayType = 162,
203
+ TupleType = 163,
204
+ UnionType = 164,
205
+ IntersectionType = 165,
206
+ ParenthesizedType = 166,
207
+ ThisType = 167,
208
+ TypeOperator = 168,
209
+ IndexedAccessType = 169,
210
+ MappedType = 170,
211
+ LiteralType = 171,
212
+ ObjectBindingPattern = 172,
213
+ ArrayBindingPattern = 173,
214
+ BindingElement = 174,
215
+ ArrayLiteralExpression = 175,
216
+ ObjectLiteralExpression = 176,
217
+ PropertyAccessExpression = 177,
218
+ ElementAccessExpression = 178,
219
+ CallExpression = 179,
220
+ NewExpression = 180,
221
+ TaggedTemplateExpression = 181,
222
+ TypeAssertionExpression = 182,
223
+ ParenthesizedExpression = 183,
224
+ FunctionExpression = 184,
225
+ ArrowFunction = 185,
226
+ DeleteExpression = 186,
227
+ TypeOfExpression = 187,
228
+ VoidExpression = 188,
229
+ AwaitExpression = 189,
230
+ PrefixUnaryExpression = 190,
231
+ PostfixUnaryExpression = 191,
232
+ BinaryExpression = 192,
233
+ ConditionalExpression = 193,
234
+ TemplateExpression = 194,
235
+ YieldExpression = 195,
236
+ SpreadElement = 196,
237
+ ClassExpression = 197,
238
+ OmittedExpression = 198,
239
+ ExpressionWithTypeArguments = 199,
240
+ AsExpression = 200,
241
+ NonNullExpression = 201,
242
+ TemplateSpan = 202,
243
+ SemicolonClassElement = 203,
244
+ Block = 204,
245
+ VariableStatement = 205,
246
+ EmptyStatement = 206,
247
+ ExpressionStatement = 207,
248
+ IfStatement = 208,
249
+ DoStatement = 209,
250
+ WhileStatement = 210,
251
+ ForStatement = 211,
252
+ ForInStatement = 212,
253
+ ForOfStatement = 213,
254
+ ContinueStatement = 214,
255
+ BreakStatement = 215,
256
+ ReturnStatement = 216,
257
+ WithStatement = 217,
258
+ SwitchStatement = 218,
259
+ LabeledStatement = 219,
260
+ ThrowStatement = 220,
261
+ TryStatement = 221,
262
+ DebuggerStatement = 222,
263
+ VariableDeclaration = 223,
264
+ VariableDeclarationList = 224,
265
+ FunctionDeclaration = 225,
266
+ ClassDeclaration = 226,
267
+ InterfaceDeclaration = 227,
268
+ TypeAliasDeclaration = 228,
269
+ EnumDeclaration = 229,
270
+ ModuleDeclaration = 230,
271
+ ModuleBlock = 231,
272
+ CaseBlock = 232,
273
+ NamespaceExportDeclaration = 233,
274
+ ImportEqualsDeclaration = 234,
275
+ ImportDeclaration = 235,
276
+ ImportClause = 236,
277
+ NamespaceImport = 237,
278
+ NamedImports = 238,
279
+ ImportSpecifier = 239,
280
+ ExportAssignment = 240,
281
+ ExportDeclaration = 241,
282
+ NamedExports = 242,
283
+ ExportSpecifier = 243,
284
+ MissingDeclaration = 244,
285
+ ExternalModuleReference = 245,
286
+ JsxElement = 246,
287
+ JsxSelfClosingElement = 247,
288
+ JsxOpeningElement = 248,
289
+ JsxClosingElement = 249,
290
+ JsxAttribute = 250,
291
+ JsxSpreadAttribute = 251,
292
+ JsxExpression = 252,
293
+ CaseClause = 253,
294
+ DefaultClause = 254,
295
+ HeritageClause = 255,
296
+ CatchClause = 256,
297
+ PropertyAssignment = 257,
298
+ ShorthandPropertyAssignment = 258,
299
+ SpreadAssignment = 259,
300
+ EnumMember = 260,
301
+ SourceFile = 261,
302
+ JSDocTypeExpression = 262,
303
+ JSDocAllType = 263,
304
+ JSDocUnknownType = 264,
305
+ JSDocArrayType = 265,
306
+ JSDocUnionType = 266,
307
+ JSDocTupleType = 267,
308
+ JSDocNullableType = 268,
309
+ JSDocNonNullableType = 269,
310
+ JSDocRecordType = 270,
311
+ JSDocRecordMember = 271,
312
+ JSDocTypeReference = 272,
313
+ JSDocOptionalType = 273,
314
+ JSDocFunctionType = 274,
315
+ JSDocVariadicType = 275,
316
+ JSDocConstructorType = 276,
317
+ JSDocThisType = 277,
318
+ JSDocComment = 278,
319
+ JSDocTag = 279,
320
+ JSDocAugmentsTag = 280,
321
+ JSDocParameterTag = 281,
322
+ JSDocReturnTag = 282,
323
+ JSDocTypeTag = 283,
324
+ JSDocTemplateTag = 284,
325
+ JSDocTypedefTag = 285,
326
+ JSDocPropertyTag = 286,
327
+ JSDocTypeLiteral = 287,
328
+ JSDocLiteralType = 288,
329
+ JSDocNullKeyword = 289,
330
+ JSDocUndefinedKeyword = 290,
331
+ JSDocNeverKeyword = 291,
332
+ SyntaxList = 292,
333
+ NotEmittedStatement = 293,
334
+ PartiallyEmittedExpression = 294,
335
+ MergeDeclarationMarker = 295,
336
+ EndOfDeclarationMarker = 296,
337
+ Count = 297,
338
+ FirstAssignment = 57,
339
+ LastAssignment = 69,
340
+ FirstCompoundAssignment = 58,
341
+ LastCompoundAssignment = 69,
342
+ FirstReservedWord = 71,
343
+ LastReservedWord = 106,
344
+ FirstKeyword = 71,
345
+ LastKeyword = 140,
346
+ FirstFutureReservedWord = 107,
347
+ LastFutureReservedWord = 115,
348
+ FirstTypeNode = 156,
349
+ LastTypeNode = 171,
350
+ FirstPunctuation = 16,
351
+ LastPunctuation = 69,
352
+ FirstToken = 0,
353
+ LastToken = 140,
354
+ FirstTriviaToken = 2,
355
+ LastTriviaToken = 7,
356
+ FirstLiteralToken = 8,
357
+ LastLiteralToken = 12,
358
+ FirstTemplateToken = 12,
359
+ LastTemplateToken = 15,
360
+ FirstBinaryOperator = 26,
361
+ LastBinaryOperator = 69,
362
+ FirstNode = 141,
363
+ FirstJSDocNode = 262,
364
+ LastJSDocNode = 288,
365
+ FirstJSDocTagNode = 278,
366
+ LastJSDocTagNode = 291,
367
+ }
368
+ enum NodeFlags {
369
+ None = 0,
370
+ Let = 1,
371
+ Const = 2,
372
+ NestedNamespace = 4,
373
+ Synthesized = 8,
374
+ Namespace = 16,
375
+ ExportContext = 32,
376
+ ContainsThis = 64,
377
+ HasImplicitReturn = 128,
378
+ HasExplicitReturn = 256,
379
+ GlobalAugmentation = 512,
380
+ HasAsyncFunctions = 1024,
381
+ DisallowInContext = 2048,
382
+ YieldContext = 4096,
383
+ DecoratorContext = 8192,
384
+ AwaitContext = 16384,
385
+ ThisNodeHasError = 32768,
386
+ JavaScriptFile = 65536,
387
+ ThisNodeOrAnySubNodesHasError = 131072,
388
+ HasAggregatedChildData = 262144,
389
+ BlockScoped = 3,
390
+ ReachabilityCheckFlags = 384,
391
+ ReachabilityAndEmitFlags = 1408,
392
+ ContextFlags = 96256,
393
+ TypeExcludesFlags = 20480,
394
+ }
395
+ enum ModifierFlags {
396
+ None = 0,
397
+ Export = 1,
398
+ Ambient = 2,
399
+ Public = 4,
400
+ Private = 8,
401
+ Protected = 16,
402
+ Static = 32,
403
+ Readonly = 64,
404
+ Abstract = 128,
405
+ Async = 256,
406
+ Default = 512,
407
+ Const = 2048,
408
+ HasComputedFlags = 536870912,
409
+ AccessibilityModifier = 28,
410
+ ParameterPropertyModifier = 92,
411
+ NonPublicAccessibilityModifier = 24,
412
+ TypeScriptModifier = 2270,
413
+ ExportDefault = 513,
414
+ }
415
+ enum JsxFlags {
416
+ None = 0,
417
+ /** An element from a named property of the JSX.IntrinsicElements interface */
418
+ IntrinsicNamedElement = 1,
419
+ /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
420
+ IntrinsicIndexedElement = 2,
421
+ IntrinsicElement = 3,
422
+ }
423
+ interface Node extends TextRange {
424
+ kind: SyntaxKind;
425
+ flags: NodeFlags;
426
+ decorators?: NodeArray<Decorator>;
427
+ modifiers?: ModifiersArray;
428
+ parent?: Node;
429
+ }
430
+ interface NodeArray<T extends Node> extends Array<T>, TextRange {
431
+ hasTrailingComma?: boolean;
432
+ }
433
+ interface Token<TKind extends SyntaxKind> extends Node {
434
+ kind: TKind;
435
+ }
436
+ type DotDotDotToken = Token<SyntaxKind.DotDotDotToken>;
437
+ type QuestionToken = Token<SyntaxKind.QuestionToken>;
438
+ type ColonToken = Token<SyntaxKind.ColonToken>;
439
+ type EqualsToken = Token<SyntaxKind.EqualsToken>;
440
+ type AsteriskToken = Token<SyntaxKind.AsteriskToken>;
441
+ type EqualsGreaterThanToken = Token<SyntaxKind.EqualsGreaterThanToken>;
442
+ type EndOfFileToken = Token<SyntaxKind.EndOfFileToken>;
443
+ type AtToken = Token<SyntaxKind.AtToken>;
444
+ type ReadonlyToken = Token<SyntaxKind.ReadonlyKeyword>;
445
+ 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>;
446
+ type ModifiersArray = NodeArray<Modifier>;
447
+ interface Identifier extends PrimaryExpression {
448
+ kind: SyntaxKind.Identifier;
449
+ text: string;
450
+ originalKeywordKind?: SyntaxKind;
451
+ isInJSDocNamespace?: boolean;
452
+ }
453
+ interface TransientIdentifier extends Identifier {
454
+ resolvedSymbol: Symbol;
455
+ }
456
+ interface QualifiedName extends Node {
457
+ kind: SyntaxKind.QualifiedName;
458
+ left: EntityName;
459
+ right: Identifier;
460
+ }
461
+ type EntityName = Identifier | QualifiedName;
462
+ type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
463
+ type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
464
+ interface Declaration extends Node {
465
+ _declarationBrand: any;
466
+ name?: DeclarationName;
467
+ }
468
+ interface DeclarationStatement extends Declaration, Statement {
469
+ name?: Identifier | StringLiteral | NumericLiteral;
470
+ }
471
+ interface ComputedPropertyName extends Node {
472
+ kind: SyntaxKind.ComputedPropertyName;
473
+ expression: Expression;
474
+ }
475
+ interface Decorator extends Node {
476
+ kind: SyntaxKind.Decorator;
477
+ expression: LeftHandSideExpression;
478
+ }
479
+ interface TypeParameterDeclaration extends Declaration {
480
+ kind: SyntaxKind.TypeParameter;
481
+ name: Identifier;
482
+ constraint?: TypeNode;
483
+ expression?: Expression;
484
+ }
485
+ interface SignatureDeclaration extends Declaration {
486
+ name?: PropertyName;
487
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
488
+ parameters: NodeArray<ParameterDeclaration>;
489
+ type?: TypeNode;
490
+ }
491
+ interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement {
492
+ kind: SyntaxKind.CallSignature;
493
+ }
494
+ interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement {
495
+ kind: SyntaxKind.ConstructSignature;
496
+ }
497
+ type BindingName = Identifier | BindingPattern;
498
+ interface VariableDeclaration extends Declaration {
499
+ kind: SyntaxKind.VariableDeclaration;
500
+ parent?: VariableDeclarationList;
501
+ name: BindingName;
502
+ type?: TypeNode;
503
+ initializer?: Expression;
504
+ }
505
+ interface VariableDeclarationList extends Node {
506
+ kind: SyntaxKind.VariableDeclarationList;
507
+ declarations: NodeArray<VariableDeclaration>;
508
+ }
509
+ interface ParameterDeclaration extends Declaration {
510
+ kind: SyntaxKind.Parameter;
511
+ dotDotDotToken?: DotDotDotToken;
512
+ name: BindingName;
513
+ questionToken?: QuestionToken;
514
+ type?: TypeNode;
515
+ initializer?: Expression;
516
+ }
517
+ interface BindingElement extends Declaration {
518
+ kind: SyntaxKind.BindingElement;
519
+ propertyName?: PropertyName;
520
+ dotDotDotToken?: DotDotDotToken;
521
+ name: BindingName;
522
+ initializer?: Expression;
523
+ }
524
+ interface PropertySignature extends TypeElement {
525
+ kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember;
526
+ name: PropertyName;
527
+ questionToken?: QuestionToken;
528
+ type?: TypeNode;
529
+ initializer?: Expression;
530
+ }
531
+ interface PropertyDeclaration extends ClassElement {
532
+ kind: SyntaxKind.PropertyDeclaration;
533
+ questionToken?: QuestionToken;
534
+ name: PropertyName;
535
+ type?: TypeNode;
536
+ initializer?: Expression;
537
+ }
538
+ interface ObjectLiteralElement extends Declaration {
539
+ _objectLiteralBrandBrand: any;
540
+ name?: PropertyName;
541
+ }
542
+ type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment;
543
+ interface PropertyAssignment extends ObjectLiteralElement {
544
+ kind: SyntaxKind.PropertyAssignment;
545
+ name: PropertyName;
546
+ questionToken?: QuestionToken;
547
+ initializer: Expression;
548
+ }
549
+ interface ShorthandPropertyAssignment extends ObjectLiteralElement {
550
+ kind: SyntaxKind.ShorthandPropertyAssignment;
551
+ name: Identifier;
552
+ questionToken?: QuestionToken;
553
+ equalsToken?: Token<SyntaxKind.EqualsToken>;
554
+ objectAssignmentInitializer?: Expression;
555
+ }
556
+ interface SpreadAssignment extends ObjectLiteralElement {
557
+ kind: SyntaxKind.SpreadAssignment;
558
+ expression: Expression;
559
+ }
560
+ interface VariableLikeDeclaration extends Declaration {
561
+ propertyName?: PropertyName;
562
+ dotDotDotToken?: DotDotDotToken;
563
+ name: DeclarationName;
564
+ questionToken?: QuestionToken;
565
+ type?: TypeNode;
566
+ initializer?: Expression;
567
+ }
568
+ interface PropertyLikeDeclaration extends Declaration {
569
+ name: PropertyName;
570
+ }
571
+ interface ObjectBindingPattern extends Node {
572
+ kind: SyntaxKind.ObjectBindingPattern;
573
+ elements: NodeArray<BindingElement>;
574
+ }
575
+ interface ArrayBindingPattern extends Node {
576
+ kind: SyntaxKind.ArrayBindingPattern;
577
+ elements: NodeArray<ArrayBindingElement>;
578
+ }
579
+ type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
580
+ type ArrayBindingElement = BindingElement | OmittedExpression;
581
+ /**
582
+ * Several node kinds share function-like features such as a signature,
583
+ * a name, and a body. These nodes should extend FunctionLikeDeclaration.
584
+ * Examples:
585
+ * - FunctionDeclaration
586
+ * - MethodDeclaration
587
+ * - AccessorDeclaration
588
+ */
589
+ interface FunctionLikeDeclaration extends SignatureDeclaration {
590
+ _functionLikeDeclarationBrand: any;
591
+ asteriskToken?: AsteriskToken;
592
+ questionToken?: QuestionToken;
593
+ body?: Block | Expression;
594
+ }
595
+ interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement {
596
+ kind: SyntaxKind.FunctionDeclaration;
597
+ name?: Identifier;
598
+ body?: FunctionBody;
599
+ }
600
+ interface MethodSignature extends SignatureDeclaration, TypeElement {
601
+ kind: SyntaxKind.MethodSignature;
602
+ name: PropertyName;
603
+ }
604
+ interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
605
+ kind: SyntaxKind.MethodDeclaration;
606
+ name: PropertyName;
607
+ body?: FunctionBody;
608
+ }
609
+ interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
610
+ kind: SyntaxKind.Constructor;
611
+ body?: FunctionBody;
612
+ }
613
+ interface SemicolonClassElement extends ClassElement {
614
+ kind: SyntaxKind.SemicolonClassElement;
615
+ }
616
+ interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
617
+ kind: SyntaxKind.GetAccessor;
618
+ name: PropertyName;
619
+ body: FunctionBody;
620
+ }
621
+ interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
622
+ kind: SyntaxKind.SetAccessor;
623
+ name: PropertyName;
624
+ body: FunctionBody;
625
+ }
626
+ type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
627
+ interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement {
628
+ kind: SyntaxKind.IndexSignature;
629
+ }
630
+ interface TypeNode extends Node {
631
+ _typeNodeBrand: any;
632
+ }
633
+ interface KeywordTypeNode extends TypeNode {
634
+ kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword;
635
+ }
636
+ interface ThisTypeNode extends TypeNode {
637
+ kind: SyntaxKind.ThisType;
638
+ }
639
+ interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
640
+ kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType;
641
+ }
642
+ interface FunctionTypeNode extends FunctionOrConstructorTypeNode {
643
+ kind: SyntaxKind.FunctionType;
644
+ }
645
+ interface ConstructorTypeNode extends FunctionOrConstructorTypeNode {
646
+ kind: SyntaxKind.ConstructorType;
647
+ }
648
+ interface TypeReferenceNode extends TypeNode {
649
+ kind: SyntaxKind.TypeReference;
650
+ typeName: EntityName;
651
+ typeArguments?: NodeArray<TypeNode>;
652
+ }
653
+ interface TypePredicateNode extends TypeNode {
654
+ kind: SyntaxKind.TypePredicate;
655
+ parameterName: Identifier | ThisTypeNode;
656
+ type: TypeNode;
657
+ }
658
+ interface TypeQueryNode extends TypeNode {
659
+ kind: SyntaxKind.TypeQuery;
660
+ exprName: EntityName;
661
+ }
662
+ interface TypeLiteralNode extends TypeNode, Declaration {
663
+ kind: SyntaxKind.TypeLiteral;
664
+ members: NodeArray<TypeElement>;
665
+ }
666
+ interface ArrayTypeNode extends TypeNode {
667
+ kind: SyntaxKind.ArrayType;
668
+ elementType: TypeNode;
669
+ }
670
+ interface TupleTypeNode extends TypeNode {
671
+ kind: SyntaxKind.TupleType;
672
+ elementTypes: NodeArray<TypeNode>;
673
+ }
674
+ interface UnionOrIntersectionTypeNode extends TypeNode {
675
+ kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType;
676
+ types: NodeArray<TypeNode>;
677
+ }
678
+ interface UnionTypeNode extends UnionOrIntersectionTypeNode {
679
+ kind: SyntaxKind.UnionType;
680
+ }
681
+ interface IntersectionTypeNode extends UnionOrIntersectionTypeNode {
682
+ kind: SyntaxKind.IntersectionType;
683
+ }
684
+ interface ParenthesizedTypeNode extends TypeNode {
685
+ kind: SyntaxKind.ParenthesizedType;
686
+ type: TypeNode;
687
+ }
688
+ interface TypeOperatorNode extends TypeNode {
689
+ kind: SyntaxKind.TypeOperator;
690
+ operator: SyntaxKind.KeyOfKeyword;
691
+ type: TypeNode;
692
+ }
693
+ interface IndexedAccessTypeNode extends TypeNode {
694
+ kind: SyntaxKind.IndexedAccessType;
695
+ objectType: TypeNode;
696
+ indexType: TypeNode;
697
+ }
698
+ interface MappedTypeNode extends TypeNode, Declaration {
699
+ kind: SyntaxKind.MappedType;
700
+ readonlyToken?: ReadonlyToken;
701
+ typeParameter: TypeParameterDeclaration;
702
+ questionToken?: QuestionToken;
703
+ type?: TypeNode;
704
+ }
705
+ interface LiteralTypeNode extends TypeNode {
706
+ kind: SyntaxKind.LiteralType;
707
+ literal: Expression;
708
+ }
709
+ interface StringLiteral extends LiteralExpression {
710
+ kind: SyntaxKind.StringLiteral;
711
+ }
712
+ interface Expression extends Node {
713
+ _expressionBrand: any;
714
+ contextualType?: Type;
715
+ }
716
+ interface OmittedExpression extends Expression {
717
+ kind: SyntaxKind.OmittedExpression;
718
+ }
719
+ interface UnaryExpression extends Expression {
720
+ _unaryExpressionBrand: any;
721
+ }
722
+ interface IncrementExpression extends UnaryExpression {
723
+ _incrementExpressionBrand: any;
724
+ }
725
+ type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken;
726
+ interface PrefixUnaryExpression extends IncrementExpression {
727
+ kind: SyntaxKind.PrefixUnaryExpression;
728
+ operator: PrefixUnaryOperator;
729
+ operand: UnaryExpression;
730
+ }
731
+ type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken;
732
+ interface PostfixUnaryExpression extends IncrementExpression {
733
+ kind: SyntaxKind.PostfixUnaryExpression;
734
+ operand: LeftHandSideExpression;
735
+ operator: PostfixUnaryOperator;
736
+ }
737
+ interface LeftHandSideExpression extends IncrementExpression {
738
+ _leftHandSideExpressionBrand: any;
739
+ }
740
+ interface MemberExpression extends LeftHandSideExpression {
741
+ _memberExpressionBrand: any;
742
+ }
743
+ interface PrimaryExpression extends MemberExpression {
744
+ _primaryExpressionBrand: any;
745
+ }
746
+ interface NullLiteral extends PrimaryExpression {
747
+ kind: SyntaxKind.NullKeyword;
748
+ }
749
+ interface BooleanLiteral extends PrimaryExpression {
750
+ kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword;
751
+ }
752
+ interface ThisExpression extends PrimaryExpression {
753
+ kind: SyntaxKind.ThisKeyword;
754
+ }
755
+ interface SuperExpression extends PrimaryExpression {
756
+ kind: SyntaxKind.SuperKeyword;
757
+ }
758
+ interface DeleteExpression extends UnaryExpression {
759
+ kind: SyntaxKind.DeleteExpression;
760
+ expression: UnaryExpression;
761
+ }
762
+ interface TypeOfExpression extends UnaryExpression {
763
+ kind: SyntaxKind.TypeOfExpression;
764
+ expression: UnaryExpression;
765
+ }
766
+ interface VoidExpression extends UnaryExpression {
767
+ kind: SyntaxKind.VoidExpression;
768
+ expression: UnaryExpression;
769
+ }
770
+ interface AwaitExpression extends UnaryExpression {
771
+ kind: SyntaxKind.AwaitExpression;
772
+ expression: UnaryExpression;
773
+ }
774
+ interface YieldExpression extends Expression {
775
+ kind: SyntaxKind.YieldExpression;
776
+ asteriskToken?: AsteriskToken;
777
+ expression?: Expression;
778
+ }
779
+ type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken;
780
+ type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken;
781
+ type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator;
782
+ type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken;
783
+ type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator;
784
+ type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken;
785
+ type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator;
786
+ type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword;
787
+ type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator;
788
+ type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken;
789
+ type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator;
790
+ type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken;
791
+ type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator;
792
+ type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken;
793
+ type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator;
794
+ 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;
795
+ type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator;
796
+ type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator;
797
+ type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken;
798
+ type BinaryOperatorToken = Token<BinaryOperator>;
799
+ interface BinaryExpression extends Expression, Declaration {
800
+ kind: SyntaxKind.BinaryExpression;
801
+ left: Expression;
802
+ operatorToken: BinaryOperatorToken;
803
+ right: Expression;
804
+ }
805
+ type AssignmentOperatorToken = Token<AssignmentOperator>;
806
+ interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
807
+ left: LeftHandSideExpression;
808
+ operatorToken: TOperator;
809
+ }
810
+ interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
811
+ left: ObjectLiteralExpression;
812
+ }
813
+ interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
814
+ left: ArrayLiteralExpression;
815
+ }
816
+ type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
817
+ type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
818
+ type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
819
+ type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression;
820
+ type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
821
+ type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
822
+ type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
823
+ type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
824
+ interface ConditionalExpression extends Expression {
825
+ kind: SyntaxKind.ConditionalExpression;
826
+ condition: Expression;
827
+ questionToken: QuestionToken;
828
+ whenTrue: Expression;
829
+ colonToken: ColonToken;
830
+ whenFalse: Expression;
831
+ }
832
+ type FunctionBody = Block;
833
+ type ConciseBody = FunctionBody | Expression;
834
+ interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
835
+ kind: SyntaxKind.FunctionExpression;
836
+ name?: Identifier;
837
+ body: FunctionBody;
838
+ }
839
+ interface ArrowFunction extends Expression, FunctionLikeDeclaration {
840
+ kind: SyntaxKind.ArrowFunction;
841
+ equalsGreaterThanToken: EqualsGreaterThanToken;
842
+ body: ConciseBody;
843
+ }
844
+ interface LiteralLikeNode extends Node {
845
+ text: string;
846
+ isUnterminated?: boolean;
847
+ hasExtendedUnicodeEscape?: boolean;
848
+ }
849
+ interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
850
+ _literalExpressionBrand: any;
851
+ }
852
+ interface RegularExpressionLiteral extends LiteralExpression {
853
+ kind: SyntaxKind.RegularExpressionLiteral;
854
+ }
855
+ interface NoSubstitutionTemplateLiteral extends LiteralExpression {
856
+ kind: SyntaxKind.NoSubstitutionTemplateLiteral;
857
+ }
858
+ interface NumericLiteral extends LiteralExpression {
859
+ kind: SyntaxKind.NumericLiteral;
860
+ trailingComment?: string;
861
+ }
862
+ interface TemplateHead extends LiteralLikeNode {
863
+ kind: SyntaxKind.TemplateHead;
864
+ }
865
+ interface TemplateMiddle extends LiteralLikeNode {
866
+ kind: SyntaxKind.TemplateMiddle;
867
+ }
868
+ interface TemplateTail extends LiteralLikeNode {
869
+ kind: SyntaxKind.TemplateTail;
870
+ }
871
+ type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
872
+ interface TemplateExpression extends PrimaryExpression {
873
+ kind: SyntaxKind.TemplateExpression;
874
+ head: TemplateHead;
875
+ templateSpans: NodeArray<TemplateSpan>;
876
+ }
877
+ interface TemplateSpan extends Node {
878
+ kind: SyntaxKind.TemplateSpan;
879
+ expression: Expression;
880
+ literal: TemplateMiddle | TemplateTail;
881
+ }
882
+ interface ParenthesizedExpression extends PrimaryExpression {
883
+ kind: SyntaxKind.ParenthesizedExpression;
884
+ expression: Expression;
885
+ }
886
+ interface ArrayLiteralExpression extends PrimaryExpression {
887
+ kind: SyntaxKind.ArrayLiteralExpression;
888
+ elements: NodeArray<Expression>;
889
+ }
890
+ interface SpreadElement extends Expression {
891
+ kind: SyntaxKind.SpreadElement;
892
+ expression: Expression;
893
+ }
894
+ /**
895
+ * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to
896
+ * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be
897
+ * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type
898
+ * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.)
899
+ **/
900
+ interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration {
901
+ properties: NodeArray<T>;
902
+ }
903
+ interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> {
904
+ kind: SyntaxKind.ObjectLiteralExpression;
905
+ }
906
+ type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
907
+ type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
908
+ interface PropertyAccessExpression extends MemberExpression, Declaration {
909
+ kind: SyntaxKind.PropertyAccessExpression;
910
+ expression: LeftHandSideExpression;
911
+ name: Identifier;
912
+ }
913
+ interface SuperPropertyAccessExpression extends PropertyAccessExpression {
914
+ expression: SuperExpression;
915
+ }
916
+ /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */
917
+ interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
918
+ _propertyAccessExpressionLikeQualifiedNameBrand?: any;
919
+ expression: EntityNameExpression;
920
+ }
921
+ interface ElementAccessExpression extends MemberExpression {
922
+ kind: SyntaxKind.ElementAccessExpression;
923
+ expression: LeftHandSideExpression;
924
+ argumentExpression?: Expression;
925
+ }
926
+ interface SuperElementAccessExpression extends ElementAccessExpression {
927
+ expression: SuperExpression;
928
+ }
929
+ type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
930
+ interface CallExpression extends LeftHandSideExpression, Declaration {
931
+ kind: SyntaxKind.CallExpression;
932
+ expression: LeftHandSideExpression;
933
+ typeArguments?: NodeArray<TypeNode>;
934
+ arguments: NodeArray<Expression>;
935
+ }
936
+ interface SuperCall extends CallExpression {
937
+ expression: SuperExpression;
938
+ }
939
+ interface ExpressionWithTypeArguments extends TypeNode {
940
+ kind: SyntaxKind.ExpressionWithTypeArguments;
941
+ expression: LeftHandSideExpression;
942
+ typeArguments?: NodeArray<TypeNode>;
943
+ }
944
+ interface NewExpression extends PrimaryExpression, Declaration {
945
+ kind: SyntaxKind.NewExpression;
946
+ expression: LeftHandSideExpression;
947
+ typeArguments?: NodeArray<TypeNode>;
948
+ arguments: NodeArray<Expression>;
949
+ }
950
+ interface TaggedTemplateExpression extends MemberExpression {
951
+ kind: SyntaxKind.TaggedTemplateExpression;
952
+ tag: LeftHandSideExpression;
953
+ template: TemplateLiteral;
954
+ }
955
+ type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
956
+ interface AsExpression extends Expression {
957
+ kind: SyntaxKind.AsExpression;
958
+ expression: Expression;
959
+ type: TypeNode;
960
+ }
961
+ interface TypeAssertion extends UnaryExpression {
962
+ kind: SyntaxKind.TypeAssertionExpression;
963
+ type: TypeNode;
964
+ expression: UnaryExpression;
965
+ }
966
+ type AssertionExpression = TypeAssertion | AsExpression;
967
+ interface NonNullExpression extends LeftHandSideExpression {
968
+ kind: SyntaxKind.NonNullExpression;
969
+ expression: Expression;
970
+ }
971
+ interface JsxElement extends PrimaryExpression {
972
+ kind: SyntaxKind.JsxElement;
973
+ openingElement: JsxOpeningElement;
974
+ children: NodeArray<JsxChild>;
975
+ closingElement: JsxClosingElement;
976
+ }
977
+ type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression;
978
+ interface JsxOpeningElement extends Expression {
979
+ kind: SyntaxKind.JsxOpeningElement;
980
+ tagName: JsxTagNameExpression;
981
+ attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>;
982
+ }
983
+ interface JsxSelfClosingElement extends PrimaryExpression {
984
+ kind: SyntaxKind.JsxSelfClosingElement;
985
+ tagName: JsxTagNameExpression;
986
+ attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>;
987
+ }
988
+ type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
989
+ type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
990
+ interface JsxAttribute extends Node {
991
+ kind: SyntaxKind.JsxAttribute;
992
+ name: Identifier;
993
+ initializer?: StringLiteral | JsxExpression;
994
+ }
995
+ interface JsxSpreadAttribute extends Node {
996
+ kind: SyntaxKind.JsxSpreadAttribute;
997
+ expression: Expression;
998
+ }
999
+ interface JsxClosingElement extends Node {
1000
+ kind: SyntaxKind.JsxClosingElement;
1001
+ tagName: JsxTagNameExpression;
1002
+ }
1003
+ interface JsxExpression extends Expression {
1004
+ kind: SyntaxKind.JsxExpression;
1005
+ expression?: Expression;
1006
+ }
1007
+ interface JsxText extends Node {
1008
+ kind: SyntaxKind.JsxText;
1009
+ }
1010
+ type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement;
1011
+ interface Statement extends Node {
1012
+ _statementBrand: any;
1013
+ }
1014
+ interface EmptyStatement extends Statement {
1015
+ kind: SyntaxKind.EmptyStatement;
1016
+ }
1017
+ interface DebuggerStatement extends Statement {
1018
+ kind: SyntaxKind.DebuggerStatement;
1019
+ }
1020
+ interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
1021
+ kind: SyntaxKind.MissingDeclaration;
1022
+ name?: Identifier;
1023
+ }
1024
+ type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
1025
+ interface Block extends Statement {
1026
+ kind: SyntaxKind.Block;
1027
+ statements: NodeArray<Statement>;
1028
+ }
1029
+ interface VariableStatement extends Statement {
1030
+ kind: SyntaxKind.VariableStatement;
1031
+ declarationList: VariableDeclarationList;
1032
+ }
1033
+ interface ExpressionStatement extends Statement {
1034
+ kind: SyntaxKind.ExpressionStatement;
1035
+ expression: Expression;
1036
+ }
1037
+ interface IfStatement extends Statement {
1038
+ kind: SyntaxKind.IfStatement;
1039
+ expression: Expression;
1040
+ thenStatement: Statement;
1041
+ elseStatement?: Statement;
1042
+ }
1043
+ interface IterationStatement extends Statement {
1044
+ statement: Statement;
1045
+ }
1046
+ interface DoStatement extends IterationStatement {
1047
+ kind: SyntaxKind.DoStatement;
1048
+ expression: Expression;
1049
+ }
1050
+ interface WhileStatement extends IterationStatement {
1051
+ kind: SyntaxKind.WhileStatement;
1052
+ expression: Expression;
1053
+ }
1054
+ type ForInitializer = VariableDeclarationList | Expression;
1055
+ interface ForStatement extends IterationStatement {
1056
+ kind: SyntaxKind.ForStatement;
1057
+ initializer?: ForInitializer;
1058
+ condition?: Expression;
1059
+ incrementor?: Expression;
1060
+ }
1061
+ interface ForInStatement extends IterationStatement {
1062
+ kind: SyntaxKind.ForInStatement;
1063
+ initializer: ForInitializer;
1064
+ expression: Expression;
1065
+ }
1066
+ interface ForOfStatement extends IterationStatement {
1067
+ kind: SyntaxKind.ForOfStatement;
1068
+ initializer: ForInitializer;
1069
+ expression: Expression;
1070
+ }
1071
+ interface BreakStatement extends Statement {
1072
+ kind: SyntaxKind.BreakStatement;
1073
+ label?: Identifier;
1074
+ }
1075
+ interface ContinueStatement extends Statement {
1076
+ kind: SyntaxKind.ContinueStatement;
1077
+ label?: Identifier;
1078
+ }
1079
+ type BreakOrContinueStatement = BreakStatement | ContinueStatement;
1080
+ interface ReturnStatement extends Statement {
1081
+ kind: SyntaxKind.ReturnStatement;
1082
+ expression?: Expression;
1083
+ }
1084
+ interface WithStatement extends Statement {
1085
+ kind: SyntaxKind.WithStatement;
1086
+ expression: Expression;
1087
+ statement: Statement;
1088
+ }
1089
+ interface SwitchStatement extends Statement {
1090
+ kind: SyntaxKind.SwitchStatement;
1091
+ expression: Expression;
1092
+ caseBlock: CaseBlock;
1093
+ possiblyExhaustive?: boolean;
1094
+ }
1095
+ interface CaseBlock extends Node {
1096
+ kind: SyntaxKind.CaseBlock;
1097
+ clauses: NodeArray<CaseOrDefaultClause>;
1098
+ }
1099
+ interface CaseClause extends Node {
1100
+ kind: SyntaxKind.CaseClause;
1101
+ expression: Expression;
1102
+ statements: NodeArray<Statement>;
1103
+ }
1104
+ interface DefaultClause extends Node {
1105
+ kind: SyntaxKind.DefaultClause;
1106
+ statements: NodeArray<Statement>;
1107
+ }
1108
+ type CaseOrDefaultClause = CaseClause | DefaultClause;
1109
+ interface LabeledStatement extends Statement {
1110
+ kind: SyntaxKind.LabeledStatement;
1111
+ label: Identifier;
1112
+ statement: Statement;
1113
+ }
1114
+ interface ThrowStatement extends Statement {
1115
+ kind: SyntaxKind.ThrowStatement;
1116
+ expression: Expression;
1117
+ }
1118
+ interface TryStatement extends Statement {
1119
+ kind: SyntaxKind.TryStatement;
1120
+ tryBlock: Block;
1121
+ catchClause?: CatchClause;
1122
+ finallyBlock?: Block;
1123
+ }
1124
+ interface CatchClause extends Node {
1125
+ kind: SyntaxKind.CatchClause;
1126
+ variableDeclaration: VariableDeclaration;
1127
+ block: Block;
1128
+ }
1129
+ type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration;
1130
+ interface ClassLikeDeclaration extends Declaration {
1131
+ name?: Identifier;
1132
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
1133
+ heritageClauses?: NodeArray<HeritageClause>;
1134
+ members: NodeArray<ClassElement>;
1135
+ }
1136
+ interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement {
1137
+ kind: SyntaxKind.ClassDeclaration;
1138
+ name?: Identifier;
1139
+ }
1140
+ interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
1141
+ kind: SyntaxKind.ClassExpression;
1142
+ }
1143
+ interface ClassElement extends Declaration {
1144
+ _classElementBrand: any;
1145
+ name?: PropertyName;
1146
+ }
1147
+ interface TypeElement extends Declaration {
1148
+ _typeElementBrand: any;
1149
+ name?: PropertyName;
1150
+ questionToken?: QuestionToken;
1151
+ }
1152
+ interface InterfaceDeclaration extends DeclarationStatement {
1153
+ kind: SyntaxKind.InterfaceDeclaration;
1154
+ name: Identifier;
1155
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
1156
+ heritageClauses?: NodeArray<HeritageClause>;
1157
+ members: NodeArray<TypeElement>;
1158
+ }
1159
+ interface HeritageClause extends Node {
1160
+ kind: SyntaxKind.HeritageClause;
1161
+ token: SyntaxKind;
1162
+ types?: NodeArray<ExpressionWithTypeArguments>;
1163
+ }
1164
+ interface TypeAliasDeclaration extends DeclarationStatement {
1165
+ kind: SyntaxKind.TypeAliasDeclaration;
1166
+ name: Identifier;
1167
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
1168
+ type: TypeNode;
1169
+ }
1170
+ interface EnumMember extends Declaration {
1171
+ kind: SyntaxKind.EnumMember;
1172
+ name: PropertyName;
1173
+ initializer?: Expression;
1174
+ }
1175
+ interface EnumDeclaration extends DeclarationStatement {
1176
+ kind: SyntaxKind.EnumDeclaration;
1177
+ name: Identifier;
1178
+ members: NodeArray<EnumMember>;
1179
+ }
1180
+ type ModuleBody = ModuleBlock | ModuleDeclaration;
1181
+ type ModuleName = Identifier | StringLiteral;
1182
+ interface ModuleDeclaration extends DeclarationStatement {
1183
+ kind: SyntaxKind.ModuleDeclaration;
1184
+ name: Identifier | StringLiteral;
1185
+ body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
1186
+ }
1187
+ interface NamespaceDeclaration extends ModuleDeclaration {
1188
+ name: Identifier;
1189
+ body: ModuleBlock | NamespaceDeclaration;
1190
+ }
1191
+ interface JSDocNamespaceDeclaration extends ModuleDeclaration {
1192
+ name: Identifier;
1193
+ body: JSDocNamespaceDeclaration | Identifier;
1194
+ }
1195
+ interface ModuleBlock extends Node, Statement {
1196
+ kind: SyntaxKind.ModuleBlock;
1197
+ statements: NodeArray<Statement>;
1198
+ }
1199
+ type ModuleReference = EntityName | ExternalModuleReference;
1200
+ interface ImportEqualsDeclaration extends DeclarationStatement {
1201
+ kind: SyntaxKind.ImportEqualsDeclaration;
1202
+ name: Identifier;
1203
+ moduleReference: ModuleReference;
1204
+ }
1205
+ interface ExternalModuleReference extends Node {
1206
+ kind: SyntaxKind.ExternalModuleReference;
1207
+ expression?: Expression;
1208
+ }
1209
+ interface ImportDeclaration extends Statement {
1210
+ kind: SyntaxKind.ImportDeclaration;
1211
+ importClause?: ImportClause;
1212
+ moduleSpecifier: Expression;
1213
+ }
1214
+ type NamedImportBindings = NamespaceImport | NamedImports;
1215
+ interface ImportClause extends Declaration {
1216
+ kind: SyntaxKind.ImportClause;
1217
+ name?: Identifier;
1218
+ namedBindings?: NamedImportBindings;
1219
+ }
1220
+ interface NamespaceImport extends Declaration {
1221
+ kind: SyntaxKind.NamespaceImport;
1222
+ name: Identifier;
1223
+ }
1224
+ interface NamespaceExportDeclaration extends DeclarationStatement {
1225
+ kind: SyntaxKind.NamespaceExportDeclaration;
1226
+ name: Identifier;
1227
+ moduleReference: LiteralLikeNode;
1228
+ }
1229
+ interface ExportDeclaration extends DeclarationStatement {
1230
+ kind: SyntaxKind.ExportDeclaration;
1231
+ exportClause?: NamedExports;
1232
+ moduleSpecifier?: Expression;
1233
+ }
1234
+ interface NamedImports extends Node {
1235
+ kind: SyntaxKind.NamedImports;
1236
+ elements: NodeArray<ImportSpecifier>;
1237
+ }
1238
+ interface NamedExports extends Node {
1239
+ kind: SyntaxKind.NamedExports;
1240
+ elements: NodeArray<ExportSpecifier>;
1241
+ }
1242
+ type NamedImportsOrExports = NamedImports | NamedExports;
1243
+ interface ImportSpecifier extends Declaration {
1244
+ kind: SyntaxKind.ImportSpecifier;
1245
+ propertyName?: Identifier;
1246
+ name: Identifier;
1247
+ }
1248
+ interface ExportSpecifier extends Declaration {
1249
+ kind: SyntaxKind.ExportSpecifier;
1250
+ propertyName?: Identifier;
1251
+ name: Identifier;
1252
+ }
1253
+ type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
1254
+ interface ExportAssignment extends DeclarationStatement {
1255
+ kind: SyntaxKind.ExportAssignment;
1256
+ isExportEquals?: boolean;
1257
+ expression: Expression;
1258
+ }
1259
+ interface FileReference extends TextRange {
1260
+ fileName: string;
1261
+ }
1262
+ interface CommentRange extends TextRange {
1263
+ hasTrailingNewLine?: boolean;
1264
+ kind: SyntaxKind;
1265
+ }
1266
+ interface JSDocTypeExpression extends Node {
1267
+ kind: SyntaxKind.JSDocTypeExpression;
1268
+ type: JSDocType;
1269
+ }
1270
+ interface JSDocType extends TypeNode {
1271
+ _jsDocTypeBrand: any;
1272
+ }
1273
+ interface JSDocAllType extends JSDocType {
1274
+ kind: SyntaxKind.JSDocAllType;
1275
+ }
1276
+ interface JSDocUnknownType extends JSDocType {
1277
+ kind: SyntaxKind.JSDocUnknownType;
1278
+ }
1279
+ interface JSDocArrayType extends JSDocType {
1280
+ kind: SyntaxKind.JSDocArrayType;
1281
+ elementType: JSDocType;
1282
+ }
1283
+ interface JSDocUnionType extends JSDocType {
1284
+ kind: SyntaxKind.JSDocUnionType;
1285
+ types: NodeArray<JSDocType>;
1286
+ }
1287
+ interface JSDocTupleType extends JSDocType {
1288
+ kind: SyntaxKind.JSDocTupleType;
1289
+ types: NodeArray<JSDocType>;
1290
+ }
1291
+ interface JSDocNonNullableType extends JSDocType {
1292
+ kind: SyntaxKind.JSDocNonNullableType;
1293
+ type: JSDocType;
1294
+ }
1295
+ interface JSDocNullableType extends JSDocType {
1296
+ kind: SyntaxKind.JSDocNullableType;
1297
+ type: JSDocType;
1298
+ }
1299
+ interface JSDocRecordType extends JSDocType {
1300
+ kind: SyntaxKind.JSDocRecordType;
1301
+ literal: TypeLiteralNode;
1302
+ }
1303
+ interface JSDocTypeReference extends JSDocType {
1304
+ kind: SyntaxKind.JSDocTypeReference;
1305
+ name: EntityName;
1306
+ typeArguments: NodeArray<JSDocType>;
1307
+ }
1308
+ interface JSDocOptionalType extends JSDocType {
1309
+ kind: SyntaxKind.JSDocOptionalType;
1310
+ type: JSDocType;
1311
+ }
1312
+ interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
1313
+ kind: SyntaxKind.JSDocFunctionType;
1314
+ parameters: NodeArray<ParameterDeclaration>;
1315
+ type: JSDocType;
1316
+ }
1317
+ interface JSDocVariadicType extends JSDocType {
1318
+ kind: SyntaxKind.JSDocVariadicType;
1319
+ type: JSDocType;
1320
+ }
1321
+ interface JSDocConstructorType extends JSDocType {
1322
+ kind: SyntaxKind.JSDocConstructorType;
1323
+ type: JSDocType;
1324
+ }
1325
+ interface JSDocThisType extends JSDocType {
1326
+ kind: SyntaxKind.JSDocThisType;
1327
+ type: JSDocType;
1328
+ }
1329
+ interface JSDocLiteralType extends JSDocType {
1330
+ kind: SyntaxKind.JSDocLiteralType;
1331
+ literal: LiteralTypeNode;
1332
+ }
1333
+ type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
1334
+ interface JSDocRecordMember extends PropertySignature {
1335
+ kind: SyntaxKind.JSDocRecordMember;
1336
+ name: Identifier | StringLiteral | NumericLiteral;
1337
+ type?: JSDocType;
1338
+ }
1339
+ interface JSDoc extends Node {
1340
+ kind: SyntaxKind.JSDocComment;
1341
+ tags: NodeArray<JSDocTag> | undefined;
1342
+ comment: string | undefined;
1343
+ }
1344
+ interface JSDocTag extends Node {
1345
+ atToken: AtToken;
1346
+ tagName: Identifier;
1347
+ comment: string | undefined;
1348
+ }
1349
+ interface JSDocUnknownTag extends JSDocTag {
1350
+ kind: SyntaxKind.JSDocTag;
1351
+ }
1352
+ interface JSDocAugmentsTag extends JSDocTag {
1353
+ kind: SyntaxKind.JSDocAugmentsTag;
1354
+ typeExpression: JSDocTypeExpression;
1355
+ }
1356
+ interface JSDocTemplateTag extends JSDocTag {
1357
+ kind: SyntaxKind.JSDocTemplateTag;
1358
+ typeParameters: NodeArray<TypeParameterDeclaration>;
1359
+ }
1360
+ interface JSDocReturnTag extends JSDocTag {
1361
+ kind: SyntaxKind.JSDocReturnTag;
1362
+ typeExpression: JSDocTypeExpression;
1363
+ }
1364
+ interface JSDocTypeTag extends JSDocTag {
1365
+ kind: SyntaxKind.JSDocTypeTag;
1366
+ typeExpression: JSDocTypeExpression;
1367
+ }
1368
+ interface JSDocTypedefTag extends JSDocTag, Declaration {
1369
+ kind: SyntaxKind.JSDocTypedefTag;
1370
+ fullName?: JSDocNamespaceDeclaration | Identifier;
1371
+ name?: Identifier;
1372
+ typeExpression?: JSDocTypeExpression;
1373
+ jsDocTypeLiteral?: JSDocTypeLiteral;
1374
+ }
1375
+ interface JSDocPropertyTag extends JSDocTag, TypeElement {
1376
+ kind: SyntaxKind.JSDocPropertyTag;
1377
+ name: Identifier;
1378
+ typeExpression: JSDocTypeExpression;
1379
+ }
1380
+ interface JSDocTypeLiteral extends JSDocType {
1381
+ kind: SyntaxKind.JSDocTypeLiteral;
1382
+ jsDocPropertyTags?: NodeArray<JSDocPropertyTag>;
1383
+ jsDocTypeTag?: JSDocTypeTag;
1384
+ }
1385
+ interface JSDocParameterTag extends JSDocTag {
1386
+ kind: SyntaxKind.JSDocParameterTag;
1387
+ /** the parameter name, if provided *before* the type (TypeScript-style) */
1388
+ preParameterName?: Identifier;
1389
+ typeExpression?: JSDocTypeExpression;
1390
+ /** the parameter name, if provided *after* the type (JSDoc-standard) */
1391
+ postParameterName?: Identifier;
1392
+ /** the parameter name, regardless of the location it was provided */
1393
+ parameterName: Identifier;
1394
+ isBracketed: boolean;
1395
+ }
1396
+ enum FlowFlags {
1397
+ Unreachable = 1,
1398
+ Start = 2,
1399
+ BranchLabel = 4,
1400
+ LoopLabel = 8,
1401
+ Assignment = 16,
1402
+ TrueCondition = 32,
1403
+ FalseCondition = 64,
1404
+ SwitchClause = 128,
1405
+ ArrayMutation = 256,
1406
+ Referenced = 512,
1407
+ Shared = 1024,
1408
+ Label = 12,
1409
+ Condition = 96,
1410
+ }
1411
+ interface FlowNode {
1412
+ flags: FlowFlags;
1413
+ id?: number;
1414
+ }
1415
+ interface FlowStart extends FlowNode {
1416
+ container?: FunctionExpression | ArrowFunction | MethodDeclaration;
1417
+ }
1418
+ interface FlowLabel extends FlowNode {
1419
+ antecedents: FlowNode[];
1420
+ }
1421
+ interface FlowAssignment extends FlowNode {
1422
+ node: Expression | VariableDeclaration | BindingElement;
1423
+ antecedent: FlowNode;
1424
+ }
1425
+ interface FlowCondition extends FlowNode {
1426
+ expression: Expression;
1427
+ antecedent: FlowNode;
1428
+ }
1429
+ interface FlowSwitchClause extends FlowNode {
1430
+ switchStatement: SwitchStatement;
1431
+ clauseStart: number;
1432
+ clauseEnd: number;
1433
+ antecedent: FlowNode;
1434
+ }
1435
+ interface FlowArrayMutation extends FlowNode {
1436
+ node: CallExpression | BinaryExpression;
1437
+ antecedent: FlowNode;
1438
+ }
1439
+ type FlowType = Type | IncompleteType;
1440
+ interface IncompleteType {
1441
+ flags: TypeFlags;
1442
+ type: Type;
1443
+ }
1444
+ interface AmdDependency {
1445
+ path: string;
1446
+ name: string;
1447
+ }
1448
+ interface SourceFile extends Declaration {
1449
+ kind: SyntaxKind.SourceFile;
1450
+ statements: NodeArray<Statement>;
1451
+ endOfFileToken: Token<SyntaxKind.EndOfFileToken>;
1452
+ fileName: string;
1453
+ path: Path;
1454
+ text: string;
1455
+ amdDependencies: AmdDependency[];
1456
+ moduleName: string;
1457
+ referencedFiles: FileReference[];
1458
+ typeReferenceDirectives: FileReference[];
1459
+ languageVariant: LanguageVariant;
1460
+ isDeclarationFile: boolean;
1461
+ /**
1462
+ * lib.d.ts should have a reference comment like
1463
+ *
1464
+ * /// <reference no-default-lib="true"/>
1465
+ *
1466
+ * If any other file has this comment, it signals not to include lib.d.ts
1467
+ * because this containing file is intended to act as a default library.
1468
+ */
1469
+ hasNoDefaultLib: boolean;
1470
+ languageVersion: ScriptTarget;
1471
+ }
1472
+ interface ScriptReferenceHost {
1473
+ getCompilerOptions(): CompilerOptions;
1474
+ getSourceFile(fileName: string): SourceFile;
1475
+ getSourceFileByPath(path: Path): SourceFile;
1476
+ getCurrentDirectory(): string;
1477
+ }
1478
+ interface ParseConfigHost {
1479
+ useCaseSensitiveFileNames: boolean;
1480
+ readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[];
1481
+ /**
1482
+ * Gets a value indicating whether the specified path exists and is a file.
1483
+ * @param path The path to test.
1484
+ */
1485
+ fileExists(path: string): boolean;
1486
+ readFile(path: string): string;
1487
+ }
1488
+ interface WriteFileCallback {
1489
+ (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void;
1490
+ }
1491
+ class OperationCanceledException {
1492
+ }
1493
+ interface CancellationToken {
1494
+ isCancellationRequested(): boolean;
1495
+ /** @throws OperationCanceledException if isCancellationRequested is true */
1496
+ throwIfCancellationRequested(): void;
1497
+ }
1498
+ interface Program extends ScriptReferenceHost {
1499
+ /**
1500
+ * Get a list of root file names that were passed to a 'createProgram'
1501
+ */
1502
+ getRootFileNames(): string[];
1503
+ /**
1504
+ * Get a list of files in the program
1505
+ */
1506
+ getSourceFiles(): SourceFile[];
1507
+ /**
1508
+ * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
1509
+ * the JavaScript and declaration files will be produced for all the files in this program.
1510
+ * If targetSourceFile is specified, then only the JavaScript and declaration for that
1511
+ * specific file will be generated.
1512
+ *
1513
+ * If writeFile is not specified then the writeFile callback from the compiler host will be
1514
+ * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
1515
+ * will be invoked when writing the JavaScript and declaration files.
1516
+ */
1517
+ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult;
1518
+ getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
1519
+ getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
1520
+ getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
1521
+ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
1522
+ getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
1523
+ /**
1524
+ * Gets a type checker that can be used to semantically analyze source fils in the program.
1525
+ */
1526
+ getTypeChecker(): TypeChecker;
1527
+ }
1528
+ interface SourceMapSpan {
1529
+ /** Line number in the .js file. */
1530
+ emittedLine: number;
1531
+ /** Column number in the .js file. */
1532
+ emittedColumn: number;
1533
+ /** Line number in the .ts file. */
1534
+ sourceLine: number;
1535
+ /** Column number in the .ts file. */
1536
+ sourceColumn: number;
1537
+ /** Optional name (index into names array) associated with this span. */
1538
+ nameIndex?: number;
1539
+ /** .ts file (index into sources array) associated with this span */
1540
+ sourceIndex: number;
1541
+ }
1542
+ interface SourceMapData {
1543
+ sourceMapFilePath: string;
1544
+ jsSourceMappingURL: string;
1545
+ sourceMapFile: string;
1546
+ sourceMapSourceRoot: string;
1547
+ sourceMapSources: string[];
1548
+ sourceMapSourcesContent?: string[];
1549
+ inputSourceFileNames: string[];
1550
+ sourceMapNames?: string[];
1551
+ sourceMapMappings: string;
1552
+ sourceMapDecodedMappings: SourceMapSpan[];
1553
+ }
1554
+ /** Return code used by getEmitOutput function to indicate status of the function */
1555
+ enum ExitStatus {
1556
+ Success = 0,
1557
+ DiagnosticsPresent_OutputsSkipped = 1,
1558
+ DiagnosticsPresent_OutputsGenerated = 2,
1559
+ }
1560
+ interface EmitResult {
1561
+ emitSkipped: boolean;
1562
+ /** Contains declaration emit diagnostics */
1563
+ diagnostics: Diagnostic[];
1564
+ emittedFiles: string[];
1565
+ }
1566
+ interface TypeChecker {
1567
+ getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
1568
+ getDeclaredTypeOfSymbol(symbol: Symbol): Type;
1569
+ getPropertiesOfType(type: Type): Symbol[];
1570
+ getPropertyOfType(type: Type, propertyName: string): Symbol;
1571
+ getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
1572
+ getIndexTypeOfType(type: Type, kind: IndexKind): Type;
1573
+ getBaseTypes(type: InterfaceType): ObjectType[];
1574
+ getReturnTypeOfSignature(signature: Signature): Type;
1575
+ getNonNullableType(type: Type): Type;
1576
+ getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
1577
+ getSymbolAtLocation(node: Node): Symbol;
1578
+ getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
1579
+ getShorthandAssignmentValueSymbol(location: Node): Symbol;
1580
+ getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
1581
+ getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol;
1582
+ getTypeAtLocation(node: Node): Type;
1583
+ typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
1584
+ symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
1585
+ getSymbolDisplayBuilder(): SymbolDisplayBuilder;
1586
+ getFullyQualifiedName(symbol: Symbol): string;
1587
+ getAugmentedPropertiesOfType(type: Type): Symbol[];
1588
+ getRootSymbols(symbol: Symbol): Symbol[];
1589
+ getContextualType(node: Expression): Type;
1590
+ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
1591
+ getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
1592
+ isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
1593
+ isUndefinedSymbol(symbol: Symbol): boolean;
1594
+ isArgumentsSymbol(symbol: Symbol): boolean;
1595
+ isUnknownSymbol(symbol: Symbol): boolean;
1596
+ getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
1597
+ isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
1598
+ getAliasedSymbol(symbol: Symbol): Symbol;
1599
+ getExportsOfModule(moduleSymbol: Symbol): Symbol[];
1600
+ getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
1601
+ getJsxIntrinsicTagNames(): Symbol[];
1602
+ isOptionalParameter(node: ParameterDeclaration): boolean;
1603
+ getAmbientModules(): Symbol[];
1604
+ tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
1605
+ }
1606
+ interface SymbolDisplayBuilder {
1607
+ buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1608
+ buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
1609
+ buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
1610
+ buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1611
+ buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1612
+ buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1613
+ buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1614
+ buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1615
+ buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1616
+ buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1617
+ }
1618
+ interface SymbolWriter {
1619
+ writeKeyword(text: string): void;
1620
+ writeOperator(text: string): void;
1621
+ writePunctuation(text: string): void;
1622
+ writeSpace(text: string): void;
1623
+ writeStringLiteral(text: string): void;
1624
+ writeParameter(text: string): void;
1625
+ writeProperty(text: string): void;
1626
+ writeSymbol(text: string, symbol: Symbol): void;
1627
+ writeLine(): void;
1628
+ increaseIndent(): void;
1629
+ decreaseIndent(): void;
1630
+ clear(): void;
1631
+ trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
1632
+ reportInaccessibleThisError(): void;
1633
+ }
1634
+ enum TypeFormatFlags {
1635
+ None = 0,
1636
+ WriteArrayAsGenericType = 1,
1637
+ UseTypeOfFunction = 2,
1638
+ NoTruncation = 4,
1639
+ WriteArrowStyleSignature = 8,
1640
+ WriteOwnNameForAnyLike = 16,
1641
+ WriteTypeArgumentsOfSignature = 32,
1642
+ InElementType = 64,
1643
+ UseFullyQualifiedType = 128,
1644
+ InFirstTypeArgument = 256,
1645
+ InTypeAlias = 512,
1646
+ UseTypeAliasValue = 1024,
1647
+ }
1648
+ enum SymbolFormatFlags {
1649
+ None = 0,
1650
+ WriteTypeParametersOrArguments = 1,
1651
+ UseOnlyExternalAliasing = 2,
1652
+ }
1653
+ enum TypePredicateKind {
1654
+ This = 0,
1655
+ Identifier = 1,
1656
+ }
1657
+ interface TypePredicateBase {
1658
+ kind: TypePredicateKind;
1659
+ type: Type;
1660
+ }
1661
+ interface ThisTypePredicate extends TypePredicateBase {
1662
+ kind: TypePredicateKind.This;
1663
+ }
1664
+ interface IdentifierTypePredicate extends TypePredicateBase {
1665
+ kind: TypePredicateKind.Identifier;
1666
+ parameterName: string;
1667
+ parameterIndex: number;
1668
+ }
1669
+ type TypePredicate = IdentifierTypePredicate | ThisTypePredicate;
1670
+ enum SymbolFlags {
1671
+ None = 0,
1672
+ FunctionScopedVariable = 1,
1673
+ BlockScopedVariable = 2,
1674
+ Property = 4,
1675
+ EnumMember = 8,
1676
+ Function = 16,
1677
+ Class = 32,
1678
+ Interface = 64,
1679
+ ConstEnum = 128,
1680
+ RegularEnum = 256,
1681
+ ValueModule = 512,
1682
+ NamespaceModule = 1024,
1683
+ TypeLiteral = 2048,
1684
+ ObjectLiteral = 4096,
1685
+ Method = 8192,
1686
+ Constructor = 16384,
1687
+ GetAccessor = 32768,
1688
+ SetAccessor = 65536,
1689
+ Signature = 131072,
1690
+ TypeParameter = 262144,
1691
+ TypeAlias = 524288,
1692
+ ExportValue = 1048576,
1693
+ ExportType = 2097152,
1694
+ ExportNamespace = 4194304,
1695
+ Alias = 8388608,
1696
+ Instantiated = 16777216,
1697
+ Merged = 33554432,
1698
+ Transient = 67108864,
1699
+ Prototype = 134217728,
1700
+ SyntheticProperty = 268435456,
1701
+ Optional = 536870912,
1702
+ ExportStar = 1073741824,
1703
+ Enum = 384,
1704
+ Variable = 3,
1705
+ Value = 107455,
1706
+ Type = 793064,
1707
+ Namespace = 1920,
1708
+ Module = 1536,
1709
+ Accessor = 98304,
1710
+ FunctionScopedVariableExcludes = 107454,
1711
+ BlockScopedVariableExcludes = 107455,
1712
+ ParameterExcludes = 107455,
1713
+ PropertyExcludes = 0,
1714
+ EnumMemberExcludes = 900095,
1715
+ FunctionExcludes = 106927,
1716
+ ClassExcludes = 899519,
1717
+ InterfaceExcludes = 792968,
1718
+ RegularEnumExcludes = 899327,
1719
+ ConstEnumExcludes = 899967,
1720
+ ValueModuleExcludes = 106639,
1721
+ NamespaceModuleExcludes = 0,
1722
+ MethodExcludes = 99263,
1723
+ GetAccessorExcludes = 41919,
1724
+ SetAccessorExcludes = 74687,
1725
+ TypeParameterExcludes = 530920,
1726
+ TypeAliasExcludes = 793064,
1727
+ AliasExcludes = 8388608,
1728
+ ModuleMember = 8914931,
1729
+ ExportHasLocal = 944,
1730
+ HasExports = 1952,
1731
+ HasMembers = 6240,
1732
+ BlockScoped = 418,
1733
+ PropertyOrAccessor = 98308,
1734
+ Export = 7340032,
1735
+ ClassMember = 106500,
1736
+ }
1737
+ interface Symbol {
1738
+ flags: SymbolFlags;
1739
+ name: string;
1740
+ declarations?: Declaration[];
1741
+ valueDeclaration?: Declaration;
1742
+ members?: SymbolTable;
1743
+ exports?: SymbolTable;
1744
+ globalExports?: SymbolTable;
1745
+ }
1746
+ type SymbolTable = Map<Symbol>;
1747
+ enum TypeFlags {
1748
+ Any = 1,
1749
+ String = 2,
1750
+ Number = 4,
1751
+ Boolean = 8,
1752
+ Enum = 16,
1753
+ StringLiteral = 32,
1754
+ NumberLiteral = 64,
1755
+ BooleanLiteral = 128,
1756
+ EnumLiteral = 256,
1757
+ ESSymbol = 512,
1758
+ Void = 1024,
1759
+ Undefined = 2048,
1760
+ Null = 4096,
1761
+ Never = 8192,
1762
+ TypeParameter = 16384,
1763
+ Object = 32768,
1764
+ Union = 65536,
1765
+ Intersection = 131072,
1766
+ Index = 262144,
1767
+ IndexedAccess = 524288,
1768
+ Literal = 480,
1769
+ StringOrNumberLiteral = 96,
1770
+ PossiblyFalsy = 7406,
1771
+ StringLike = 262178,
1772
+ NumberLike = 340,
1773
+ BooleanLike = 136,
1774
+ EnumLike = 272,
1775
+ UnionOrIntersection = 196608,
1776
+ StructuredType = 229376,
1777
+ StructuredOrTypeParameter = 507904,
1778
+ TypeVariable = 540672,
1779
+ Narrowable = 1033215,
1780
+ NotUnionOrUnit = 33281,
1781
+ }
1782
+ type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
1783
+ interface Type {
1784
+ flags: TypeFlags;
1785
+ symbol?: Symbol;
1786
+ pattern?: DestructuringPattern;
1787
+ aliasSymbol?: Symbol;
1788
+ aliasTypeArguments?: Type[];
1789
+ }
1790
+ interface LiteralType extends Type {
1791
+ text: string;
1792
+ freshType?: LiteralType;
1793
+ regularType?: LiteralType;
1794
+ }
1795
+ interface EnumType extends Type {
1796
+ memberTypes: Map<EnumLiteralType>;
1797
+ }
1798
+ interface EnumLiteralType extends LiteralType {
1799
+ baseType: EnumType & UnionType;
1800
+ }
1801
+ enum ObjectFlags {
1802
+ Class = 1,
1803
+ Interface = 2,
1804
+ Reference = 4,
1805
+ Tuple = 8,
1806
+ Anonymous = 16,
1807
+ Mapped = 32,
1808
+ Instantiated = 64,
1809
+ ObjectLiteral = 128,
1810
+ EvolvingArray = 256,
1811
+ ObjectLiteralPatternWithComputedProperties = 512,
1812
+ ClassOrInterface = 3,
1813
+ }
1814
+ interface ObjectType extends Type {
1815
+ objectFlags: ObjectFlags;
1816
+ }
1817
+ interface InterfaceType extends ObjectType {
1818
+ typeParameters: TypeParameter[];
1819
+ outerTypeParameters: TypeParameter[];
1820
+ localTypeParameters: TypeParameter[];
1821
+ thisType: TypeParameter;
1822
+ }
1823
+ interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
1824
+ declaredProperties: Symbol[];
1825
+ declaredCallSignatures: Signature[];
1826
+ declaredConstructSignatures: Signature[];
1827
+ declaredStringIndexInfo: IndexInfo;
1828
+ declaredNumberIndexInfo: IndexInfo;
1829
+ }
1830
+ interface TypeReference extends ObjectType {
1831
+ target: GenericType;
1832
+ typeArguments: Type[];
1833
+ }
1834
+ interface GenericType extends InterfaceType, TypeReference {
1835
+ }
1836
+ interface UnionOrIntersectionType extends Type {
1837
+ types: Type[];
1838
+ }
1839
+ interface UnionType extends UnionOrIntersectionType {
1840
+ }
1841
+ interface IntersectionType extends UnionOrIntersectionType {
1842
+ }
1843
+ type StructuredType = ObjectType | UnionType | IntersectionType;
1844
+ interface EvolvingArrayType extends ObjectType {
1845
+ elementType: Type;
1846
+ finalArrayType?: Type;
1847
+ }
1848
+ interface TypeVariable extends Type {
1849
+ }
1850
+ interface TypeParameter extends TypeVariable {
1851
+ constraint: Type;
1852
+ }
1853
+ interface IndexedAccessType extends TypeVariable {
1854
+ objectType: Type;
1855
+ indexType: Type;
1856
+ constraint?: Type;
1857
+ }
1858
+ interface IndexType extends Type {
1859
+ type: TypeVariable | UnionOrIntersectionType;
1860
+ }
1861
+ enum SignatureKind {
1862
+ Call = 0,
1863
+ Construct = 1,
1864
+ }
1865
+ interface Signature {
1866
+ declaration: SignatureDeclaration;
1867
+ typeParameters: TypeParameter[];
1868
+ parameters: Symbol[];
1869
+ }
1870
+ enum IndexKind {
1871
+ String = 0,
1872
+ Number = 1,
1873
+ }
1874
+ interface IndexInfo {
1875
+ type: Type;
1876
+ isReadonly: boolean;
1877
+ declaration?: SignatureDeclaration;
1878
+ }
1879
+ interface FileExtensionInfo {
1880
+ extension: string;
1881
+ scriptKind: ScriptKind;
1882
+ isMixedContent: boolean;
1883
+ }
1884
+ interface DiagnosticMessage {
1885
+ key: string;
1886
+ category: DiagnosticCategory;
1887
+ code: number;
1888
+ message: string;
1889
+ }
1890
+ /**
1891
+ * A linked list of formatted diagnostic messages to be used as part of a multiline message.
1892
+ * It is built from the bottom up, leaving the head to be the "main" diagnostic.
1893
+ * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
1894
+ * the difference is that messages are all preformatted in DMC.
1895
+ */
1896
+ interface DiagnosticMessageChain {
1897
+ messageText: string;
1898
+ category: DiagnosticCategory;
1899
+ code: number;
1900
+ next?: DiagnosticMessageChain;
1901
+ }
1902
+ interface Diagnostic {
1903
+ file: SourceFile;
1904
+ start: number;
1905
+ length: number;
1906
+ messageText: string | DiagnosticMessageChain;
1907
+ category: DiagnosticCategory;
1908
+ code: number;
1909
+ }
1910
+ enum DiagnosticCategory {
1911
+ Warning = 0,
1912
+ Error = 1,
1913
+ Message = 2,
1914
+ }
1915
+ enum ModuleResolutionKind {
1916
+ Classic = 1,
1917
+ NodeJs = 2,
1918
+ }
1919
+ type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]>;
1920
+ interface CompilerOptions {
1921
+ allowJs?: boolean;
1922
+ allowSyntheticDefaultImports?: boolean;
1923
+ allowUnreachableCode?: boolean;
1924
+ allowUnusedLabels?: boolean;
1925
+ alwaysStrict?: boolean;
1926
+ baseUrl?: string;
1927
+ charset?: string;
1928
+ declaration?: boolean;
1929
+ declarationDir?: string;
1930
+ disableSizeLimit?: boolean;
1931
+ emitBOM?: boolean;
1932
+ emitDecoratorMetadata?: boolean;
1933
+ experimentalDecorators?: boolean;
1934
+ forceConsistentCasingInFileNames?: boolean;
1935
+ importHelpers?: boolean;
1936
+ inlineSourceMap?: boolean;
1937
+ inlineSources?: boolean;
1938
+ isolatedModules?: boolean;
1939
+ jsx?: JsxEmit;
1940
+ lib?: string[];
1941
+ locale?: string;
1942
+ mapRoot?: string;
1943
+ maxNodeModuleJsDepth?: number;
1944
+ module?: ModuleKind;
1945
+ moduleResolution?: ModuleResolutionKind;
1946
+ newLine?: NewLineKind;
1947
+ noEmit?: boolean;
1948
+ noEmitHelpers?: boolean;
1949
+ noEmitOnError?: boolean;
1950
+ noErrorTruncation?: boolean;
1951
+ noFallthroughCasesInSwitch?: boolean;
1952
+ noImplicitAny?: boolean;
1953
+ noImplicitReturns?: boolean;
1954
+ noImplicitThis?: boolean;
1955
+ noUnusedLocals?: boolean;
1956
+ noUnusedParameters?: boolean;
1957
+ noImplicitUseStrict?: boolean;
1958
+ noLib?: boolean;
1959
+ noResolve?: boolean;
1960
+ out?: string;
1961
+ outDir?: string;
1962
+ outFile?: string;
1963
+ paths?: MapLike<string[]>;
1964
+ preserveConstEnums?: boolean;
1965
+ project?: string;
1966
+ reactNamespace?: string;
1967
+ jsxFactory?: string;
1968
+ removeComments?: boolean;
1969
+ rootDir?: string;
1970
+ rootDirs?: string[];
1971
+ skipLibCheck?: boolean;
1972
+ skipDefaultLibCheck?: boolean;
1973
+ sourceMap?: boolean;
1974
+ sourceRoot?: string;
1975
+ strictNullChecks?: boolean;
1976
+ suppressExcessPropertyErrors?: boolean;
1977
+ suppressImplicitAnyIndexErrors?: boolean;
1978
+ target?: ScriptTarget;
1979
+ traceResolution?: boolean;
1980
+ types?: string[];
1981
+ /** Paths used to compute primary types search locations */
1982
+ typeRoots?: string[];
1983
+ [option: string]: CompilerOptionsValue | undefined;
1984
+ }
1985
+ interface TypeAcquisition {
1986
+ enableAutoDiscovery?: boolean;
1987
+ enable?: boolean;
1988
+ include?: string[];
1989
+ exclude?: string[];
1990
+ [option: string]: string[] | boolean | undefined;
1991
+ }
1992
+ interface DiscoverTypingsInfo {
1993
+ fileNames: string[];
1994
+ projectRootPath: string;
1995
+ safeListPath: string;
1996
+ packageNameToTypingLocation: Map<string>;
1997
+ typeAcquisition: TypeAcquisition;
1998
+ compilerOptions: CompilerOptions;
1999
+ unresolvedImports: ReadonlyArray<string>;
2000
+ }
2001
+ enum ModuleKind {
2002
+ None = 0,
2003
+ CommonJS = 1,
2004
+ AMD = 2,
2005
+ UMD = 3,
2006
+ System = 4,
2007
+ ES2015 = 5,
2008
+ }
2009
+ enum JsxEmit {
2010
+ None = 0,
2011
+ Preserve = 1,
2012
+ React = 2,
2013
+ }
2014
+ enum NewLineKind {
2015
+ CarriageReturnLineFeed = 0,
2016
+ LineFeed = 1,
2017
+ }
2018
+ interface LineAndCharacter {
2019
+ line: number;
2020
+ character: number;
2021
+ }
2022
+ enum ScriptKind {
2023
+ Unknown = 0,
2024
+ JS = 1,
2025
+ JSX = 2,
2026
+ TS = 3,
2027
+ TSX = 4,
2028
+ }
2029
+ enum ScriptTarget {
2030
+ ES3 = 0,
2031
+ ES5 = 1,
2032
+ ES2015 = 2,
2033
+ ES2016 = 3,
2034
+ ES2017 = 4,
2035
+ ESNext = 5,
2036
+ Latest = 5,
2037
+ }
2038
+ enum LanguageVariant {
2039
+ Standard = 0,
2040
+ JSX = 1,
2041
+ }
2042
+ /** Either a parsed command line or a parsed tsconfig.json */
2043
+ interface ParsedCommandLine {
2044
+ options: CompilerOptions;
2045
+ typeAcquisition?: TypeAcquisition;
2046
+ fileNames: string[];
2047
+ raw?: any;
2048
+ errors: Diagnostic[];
2049
+ wildcardDirectories?: MapLike<WatchDirectoryFlags>;
2050
+ compileOnSave?: boolean;
2051
+ }
2052
+ enum WatchDirectoryFlags {
2053
+ None = 0,
2054
+ Recursive = 1,
2055
+ }
2056
+ interface ExpandResult {
2057
+ fileNames: string[];
2058
+ wildcardDirectories: MapLike<WatchDirectoryFlags>;
2059
+ }
2060
+ interface ModuleResolutionHost {
2061
+ fileExists(fileName: string): boolean;
2062
+ readFile(fileName: string): string;
2063
+ trace?(s: string): void;
2064
+ directoryExists?(directoryName: string): boolean;
2065
+ realpath?(path: string): string;
2066
+ getCurrentDirectory?(): string;
2067
+ getDirectories?(path: string): string[];
2068
+ }
2069
+ /**
2070
+ * Represents the result of module resolution.
2071
+ * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
2072
+ * The Program will then filter results based on these flags.
2073
+ *
2074
+ * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
2075
+ */
2076
+ interface ResolvedModule {
2077
+ /** Path of the file the module was resolved to. */
2078
+ resolvedFileName: string;
2079
+ /**
2080
+ * Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module:
2081
+ * - be a .d.ts file
2082
+ * - use top level imports\exports
2083
+ * - don't use tripleslash references
2084
+ */
2085
+ isExternalLibraryImport?: boolean;
2086
+ }
2087
+ /**
2088
+ * ResolvedModule with an explicitly provided `extension` property.
2089
+ * Prefer this over `ResolvedModule`.
2090
+ */
2091
+ interface ResolvedModuleFull extends ResolvedModule {
2092
+ /**
2093
+ * Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
2094
+ * This is optional for backwards-compatibility, but will be added if not provided.
2095
+ */
2096
+ extension: Extension;
2097
+ }
2098
+ enum Extension {
2099
+ Ts = 0,
2100
+ Tsx = 1,
2101
+ Dts = 2,
2102
+ Js = 3,
2103
+ Jsx = 4,
2104
+ LastTypeScriptExtension = 2,
2105
+ }
2106
+ interface ResolvedModuleWithFailedLookupLocations {
2107
+ resolvedModule: ResolvedModuleFull | undefined;
2108
+ failedLookupLocations: string[];
2109
+ }
2110
+ interface ResolvedTypeReferenceDirective {
2111
+ primary: boolean;
2112
+ resolvedFileName?: string;
2113
+ }
2114
+ interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
2115
+ resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective;
2116
+ failedLookupLocations: string[];
2117
+ }
2118
+ interface CompilerHost extends ModuleResolutionHost {
2119
+ getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
2120
+ getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
2121
+ getCancellationToken?(): CancellationToken;
2122
+ getDefaultLibFileName(options: CompilerOptions): string;
2123
+ getDefaultLibLocation?(): string;
2124
+ writeFile: WriteFileCallback;
2125
+ getCurrentDirectory(): string;
2126
+ getDirectories(path: string): string[];
2127
+ getCanonicalFileName(fileName: string): string;
2128
+ useCaseSensitiveFileNames(): boolean;
2129
+ getNewLine(): string;
2130
+ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
2131
+ /**
2132
+ * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
2133
+ */
2134
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
2135
+ getEnvironmentVariable?(name: string): string;
2136
+ }
2137
+ interface TextSpan {
2138
+ start: number;
2139
+ length: number;
2140
+ }
2141
+ interface TextChangeRange {
2142
+ span: TextSpan;
2143
+ newLength: number;
2144
+ }
2145
+ interface SyntaxList extends Node {
2146
+ _children: Node[];
2147
+ }
2148
+ }
2149
+ declare namespace ts {
2150
+ /** The version of the TypeScript compiler release */
2151
+ const version = "2.1.5";
2152
+ }
2153
+ declare namespace ts {
2154
+ type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
2155
+ type DirectoryWatcherCallback = (fileName: string) => void;
2156
+ interface WatchedFile {
2157
+ fileName: string;
2158
+ callback: FileWatcherCallback;
2159
+ mtime?: Date;
2160
+ }
2161
+ interface System {
2162
+ args: string[];
2163
+ newLine: string;
2164
+ useCaseSensitiveFileNames: boolean;
2165
+ write(s: string): void;
2166
+ readFile(path: string, encoding?: string): string;
2167
+ getFileSize?(path: string): number;
2168
+ writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
2169
+ /**
2170
+ * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
2171
+ * use native OS file watching
2172
+ */
2173
+ watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
2174
+ watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
2175
+ resolvePath(path: string): string;
2176
+ fileExists(path: string): boolean;
2177
+ directoryExists(path: string): boolean;
2178
+ createDirectory(path: string): void;
2179
+ getExecutingFilePath(): string;
2180
+ getCurrentDirectory(): string;
2181
+ getDirectories(path: string): string[];
2182
+ readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
2183
+ getModifiedTime?(path: string): Date;
2184
+ createHash?(data: string): string;
2185
+ getMemoryUsage?(): number;
2186
+ exit(exitCode?: number): void;
2187
+ realpath?(path: string): string;
2188
+ setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
2189
+ clearTimeout?(timeoutId: any): void;
2190
+ }
2191
+ interface FileWatcher {
2192
+ close(): void;
2193
+ }
2194
+ interface DirectoryWatcher extends FileWatcher {
2195
+ directoryName: string;
2196
+ referenceCount: number;
2197
+ }
2198
+ let sys: System;
2199
+ }
2200
+ declare namespace ts {
2201
+ interface ErrorCallback {
2202
+ (message: DiagnosticMessage, length: number): void;
2203
+ }
2204
+ interface Scanner {
2205
+ getStartPos(): number;
2206
+ getToken(): SyntaxKind;
2207
+ getTextPos(): number;
2208
+ getTokenPos(): number;
2209
+ getTokenText(): string;
2210
+ getTokenValue(): string;
2211
+ hasExtendedUnicodeEscape(): boolean;
2212
+ hasPrecedingLineBreak(): boolean;
2213
+ isIdentifier(): boolean;
2214
+ isReservedWord(): boolean;
2215
+ isUnterminated(): boolean;
2216
+ reScanGreaterToken(): SyntaxKind;
2217
+ reScanSlashToken(): SyntaxKind;
2218
+ reScanTemplateToken(): SyntaxKind;
2219
+ scanJsxIdentifier(): SyntaxKind;
2220
+ scanJsxAttributeValue(): SyntaxKind;
2221
+ reScanJsxToken(): SyntaxKind;
2222
+ scanJsxToken(): SyntaxKind;
2223
+ scanJSDocToken(): SyntaxKind;
2224
+ scan(): SyntaxKind;
2225
+ getText(): string;
2226
+ setText(text: string, start?: number, length?: number): void;
2227
+ setOnError(onError: ErrorCallback): void;
2228
+ setScriptTarget(scriptTarget: ScriptTarget): void;
2229
+ setLanguageVariant(variant: LanguageVariant): void;
2230
+ setTextPos(textPos: number): void;
2231
+ lookAhead<T>(callback: () => T): T;
2232
+ scanRange<T>(start: number, length: number, callback: () => T): T;
2233
+ tryScan<T>(callback: () => T): T;
2234
+ }
2235
+ function tokenToString(t: SyntaxKind): string;
2236
+ function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
2237
+ function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
2238
+ function isWhiteSpace(ch: number): boolean;
2239
+ /** Does not include line breaks. For that, see isWhiteSpaceLike. */
2240
+ function isWhiteSpaceSingleLine(ch: number): boolean;
2241
+ function isLineBreak(ch: number): boolean;
2242
+ function couldStartTrivia(text: string, pos: number): boolean;
2243
+ function forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U;
2244
+ function forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U;
2245
+ function reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
2246
+ function reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
2247
+ function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
2248
+ function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
2249
+ /** Optionally, get the shebang */
2250
+ function getShebang(text: string): string;
2251
+ function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
2252
+ function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
2253
+ function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
2254
+ }
2255
+ declare namespace ts {
2256
+ function getDefaultLibFileName(options: CompilerOptions): string;
2257
+ function textSpanEnd(span: TextSpan): number;
2258
+ function textSpanIsEmpty(span: TextSpan): boolean;
2259
+ function textSpanContainsPosition(span: TextSpan, position: number): boolean;
2260
+ function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
2261
+ function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
2262
+ function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
2263
+ function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
2264
+ function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
2265
+ function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
2266
+ function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
2267
+ function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
2268
+ function createTextSpan(start: number, length: number): TextSpan;
2269
+ function createTextSpanFromBounds(start: number, end: number): TextSpan;
2270
+ function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
2271
+ function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
2272
+ function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
2273
+ let unchangedTextChangeRange: TextChangeRange;
2274
+ /**
2275
+ * Called to merge all the changes that occurred across several versions of a script snapshot
2276
+ * into a single change. i.e. if a user keeps making successive edits to a script we will
2277
+ * have a text change from V1 to V2, V2 to V3, ..., Vn.
2278
+ *
2279
+ * This function will then merge those changes into a single change range valid between V1 and
2280
+ * Vn.
2281
+ */
2282
+ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
2283
+ function getTypeParameterOwner(d: Declaration): Declaration;
2284
+ function isParameterPropertyDeclaration(node: Node): boolean;
2285
+ function getCombinedModifierFlags(node: Node): ModifierFlags;
2286
+ function getCombinedNodeFlags(node: Node): NodeFlags;
2287
+ /**
2288
+ * Checks to see if the locale is in the appropriate format,
2289
+ * and if it is, attempts to set the appropriate language.
2290
+ */
2291
+ function validateLocaleAndSetLanguage(locale: string, sys: {
2292
+ getExecutingFilePath(): string;
2293
+ resolvePath(path: string): string;
2294
+ fileExists(fileName: string): boolean;
2295
+ readFile(fileName: string): string;
2296
+ }, errors?: Diagnostic[]): void;
2297
+ }
2298
+ declare namespace ts {
2299
+ function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
2300
+ function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
2301
+ function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
2302
+ function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
2303
+ function isExternalModule(file: SourceFile): boolean;
2304
+ function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
2305
+ }
2306
+ declare namespace ts {
2307
+ function moduleHasNonRelativeName(moduleName: string): boolean;
2308
+ function getEffectiveTypeRoots(options: CompilerOptions, host: {
2309
+ directoryExists?: (directoryName: string) => boolean;
2310
+ getCurrentDirectory?: () => string;
2311
+ }): string[] | undefined;
2312
+ /**
2313
+ * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.
2314
+ * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
2315
+ * is assumed to be the same as root directory of the project.
2316
+ */
2317
+ function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
2318
+ /**
2319
+ * Given a set of options, returns the set of type directive names
2320
+ * that should be included for this program automatically.
2321
+ * This list could either come from the config file,
2322
+ * or from enumerating the types root + initial secondary types lookup location.
2323
+ * More type directives might appear in the program later as a result of loading actual source files;
2324
+ * this list is only the set of defaults that are implicitly included.
2325
+ */
2326
+ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
2327
+ /**
2328
+ * Cached module resolutions per containing directory.
2329
+ * This assumes that any module id will have the same resolution for sibling files located in the same folder.
2330
+ */
2331
+ interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
2332
+ getOrCreateCacheForDirectory(directoryName: string): Map<ResolvedModuleWithFailedLookupLocations>;
2333
+ }
2334
+ /**
2335
+ * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
2336
+ * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
2337
+ */
2338
+ interface NonRelativeModuleNameResolutionCache {
2339
+ getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache;
2340
+ }
2341
+ interface PerModuleNameCache {
2342
+ get(directory: string): ResolvedModuleWithFailedLookupLocations;
2343
+ set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
2344
+ }
2345
+ function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
2346
+ function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
2347
+ function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
2348
+ function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations;
2349
+ }
2350
+ declare namespace ts {
2351
+ function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
2352
+ function resolveTripleslashReference(moduleName: string, containingFile: string): string;
2353
+ function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
2354
+ function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
2355
+ interface FormatDiagnosticsHost {
2356
+ getCurrentDirectory(): string;
2357
+ getCanonicalFileName(fileName: string): string;
2358
+ getNewLine(): string;
2359
+ }
2360
+ function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
2361
+ function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
2362
+ function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
2363
+ }
2364
+ declare namespace ts {
2365
+ function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
2366
+ /**
2367
+ * Read tsconfig.json file
2368
+ * @param fileName The path to the config file
2369
+ */
2370
+ function readConfigFile(fileName: string, readFile: (path: string) => string): {
2371
+ config?: any;
2372
+ error?: Diagnostic;
2373
+ };
2374
+ /**
2375
+ * Parse the text of the tsconfig.json file
2376
+ * @param fileName The path to the config file
2377
+ * @param jsonText The text of the config file
2378
+ */
2379
+ function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): {
2380
+ config?: any;
2381
+ error?: Diagnostic;
2382
+ };
2383
+ /**
2384
+ * Parse the contents of a config file (tsconfig.json).
2385
+ * @param json The contents of the config file to parse
2386
+ * @param host Instance of ParseConfigHost used to enumerate files in folder.
2387
+ * @param basePath A root directory to resolve relative path entries in the config
2388
+ * file to. e.g. outDir
2389
+ */
2390
+ function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
2391
+ function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
2392
+ function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
2393
+ options: CompilerOptions;
2394
+ errors: Diagnostic[];
2395
+ };
2396
+ function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
2397
+ options: TypeAcquisition;
2398
+ errors: Diagnostic[];
2399
+ };
2400
+ }
2401
+ declare namespace ts {
2402
+ interface Node {
2403
+ getSourceFile(): SourceFile;
2404
+ getChildCount(sourceFile?: SourceFile): number;
2405
+ getChildAt(index: number, sourceFile?: SourceFile): Node;
2406
+ getChildren(sourceFile?: SourceFile): Node[];
2407
+ getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
2408
+ getFullStart(): number;
2409
+ getEnd(): number;
2410
+ getWidth(sourceFile?: SourceFile): number;
2411
+ getFullWidth(): number;
2412
+ getLeadingTriviaWidth(sourceFile?: SourceFile): number;
2413
+ getFullText(sourceFile?: SourceFile): string;
2414
+ getText(sourceFile?: SourceFile): string;
2415
+ getFirstToken(sourceFile?: SourceFile): Node;
2416
+ getLastToken(sourceFile?: SourceFile): Node;
2417
+ }
2418
+ interface Symbol {
2419
+ getFlags(): SymbolFlags;
2420
+ getName(): string;
2421
+ getDeclarations(): Declaration[];
2422
+ getDocumentationComment(): SymbolDisplayPart[];
2423
+ getJsDocTags(): JSDocTagInfo[];
2424
+ }
2425
+ interface Type {
2426
+ getFlags(): TypeFlags;
2427
+ getSymbol(): Symbol;
2428
+ getProperties(): Symbol[];
2429
+ getProperty(propertyName: string): Symbol;
2430
+ getApparentProperties(): Symbol[];
2431
+ getCallSignatures(): Signature[];
2432
+ getConstructSignatures(): Signature[];
2433
+ getStringIndexType(): Type;
2434
+ getNumberIndexType(): Type;
2435
+ getBaseTypes(): ObjectType[];
2436
+ getNonNullableType(): Type;
2437
+ }
2438
+ interface Signature {
2439
+ getDeclaration(): SignatureDeclaration;
2440
+ getTypeParameters(): Type[];
2441
+ getParameters(): Symbol[];
2442
+ getReturnType(): Type;
2443
+ getDocumentationComment(): SymbolDisplayPart[];
2444
+ getJsDocTags(): JSDocTagInfo[];
2445
+ }
2446
+ interface SourceFile {
2447
+ getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
2448
+ getLineEndOfPosition(pos: number): number;
2449
+ getLineStarts(): number[];
2450
+ getPositionOfLineAndCharacter(line: number, character: number): number;
2451
+ update(newText: string, textChangeRange: TextChangeRange): SourceFile;
2452
+ }
2453
+ /**
2454
+ * Represents an immutable snapshot of a script at a specified time.Once acquired, the
2455
+ * snapshot is observably immutable. i.e. the same calls with the same parameters will return
2456
+ * the same values.
2457
+ */
2458
+ interface IScriptSnapshot {
2459
+ /** Gets a portion of the script snapshot specified by [start, end). */
2460
+ getText(start: number, end: number): string;
2461
+ /** Gets the length of this script snapshot. */
2462
+ getLength(): number;
2463
+ /**
2464
+ * Gets the TextChangeRange that describe how the text changed between this text and
2465
+ * an older version. This information is used by the incremental parser to determine
2466
+ * what sections of the script need to be re-parsed. 'undefined' can be returned if the
2467
+ * change range cannot be determined. However, in that case, incremental parsing will
2468
+ * not happen and the entire document will be re - parsed.
2469
+ */
2470
+ getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;
2471
+ /** Releases all resources held by this script snapshot */
2472
+ dispose?(): void;
2473
+ }
2474
+ namespace ScriptSnapshot {
2475
+ function fromString(text: string): IScriptSnapshot;
2476
+ }
2477
+ interface PreProcessedFileInfo {
2478
+ referencedFiles: FileReference[];
2479
+ typeReferenceDirectives: FileReference[];
2480
+ importedFiles: FileReference[];
2481
+ ambientExternalModules: string[];
2482
+ isLibFile: boolean;
2483
+ }
2484
+ interface HostCancellationToken {
2485
+ isCancellationRequested(): boolean;
2486
+ }
2487
+ interface LanguageServiceHost {
2488
+ getCompilationSettings(): CompilerOptions;
2489
+ getNewLine?(): string;
2490
+ getProjectVersion?(): string;
2491
+ getScriptFileNames(): string[];
2492
+ getScriptKind?(fileName: string): ScriptKind;
2493
+ getScriptVersion(fileName: string): string;
2494
+ getScriptSnapshot(fileName: string): IScriptSnapshot | undefined;
2495
+ getLocalizedDiagnosticMessages?(): any;
2496
+ getCancellationToken?(): HostCancellationToken;
2497
+ getCurrentDirectory(): string;
2498
+ getDefaultLibFileName(options: CompilerOptions): string;
2499
+ log?(s: string): void;
2500
+ trace?(s: string): void;
2501
+ error?(s: string): void;
2502
+ useCaseSensitiveFileNames?(): boolean;
2503
+ readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
2504
+ readFile?(path: string, encoding?: string): string;
2505
+ fileExists?(path: string): boolean;
2506
+ getTypeRootsVersion?(): number;
2507
+ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
2508
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
2509
+ directoryExists?(directoryName: string): boolean;
2510
+ getDirectories?(directoryName: string): string[];
2511
+ }
2512
+ interface LanguageService {
2513
+ cleanupSemanticCache(): void;
2514
+ getSyntacticDiagnostics(fileName: string): Diagnostic[];
2515
+ getSemanticDiagnostics(fileName: string): Diagnostic[];
2516
+ getCompilerOptionsDiagnostics(): Diagnostic[];
2517
+ /**
2518
+ * @deprecated Use getEncodedSyntacticClassifications instead.
2519
+ */
2520
+ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
2521
+ /**
2522
+ * @deprecated Use getEncodedSemanticClassifications instead.
2523
+ */
2524
+ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
2525
+ getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
2526
+ getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
2527
+ getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
2528
+ getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
2529
+ getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol;
2530
+ getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
2531
+ getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
2532
+ getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan;
2533
+ getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems;
2534
+ getRenameInfo(fileName: string, position: number): RenameInfo;
2535
+ findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
2536
+ getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
2537
+ getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
2538
+ getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[];
2539
+ getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
2540
+ findReferences(fileName: string, position: number): ReferencedSymbol[];
2541
+ getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
2542
+ /** @deprecated */
2543
+ getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
2544
+ getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[];
2545
+ getNavigationBarItems(fileName: string): NavigationBarItem[];
2546
+ getNavigationTree(fileName: string): NavigationTree;
2547
+ getOutliningSpans(fileName: string): OutliningSpan[];
2548
+ getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
2549
+ getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
2550
+ getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number;
2551
+ getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
2552
+ getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
2553
+ getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
2554
+ getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
2555
+ isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
2556
+ getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[];
2557
+ getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
2558
+ getProgram(): Program;
2559
+ dispose(): void;
2560
+ }
2561
+ interface Classifications {
2562
+ spans: number[];
2563
+ endOfLineState: EndOfLineState;
2564
+ }
2565
+ interface ClassifiedSpan {
2566
+ textSpan: TextSpan;
2567
+ classificationType: string;
2568
+ }
2569
+ /**
2570
+ * Navigation bar interface designed for visual studio's dual-column layout.
2571
+ * This does not form a proper tree.
2572
+ * The navbar is returned as a list of top-level items, each of which has a list of child items.
2573
+ * Child items always have an empty array for their `childItems`.
2574
+ */
2575
+ interface NavigationBarItem {
2576
+ text: string;
2577
+ kind: string;
2578
+ kindModifiers: string;
2579
+ spans: TextSpan[];
2580
+ childItems: NavigationBarItem[];
2581
+ indent: number;
2582
+ bolded: boolean;
2583
+ grayed: boolean;
2584
+ }
2585
+ /**
2586
+ * Node in a tree of nested declarations in a file.
2587
+ * The top node is always a script or module node.
2588
+ */
2589
+ interface NavigationTree {
2590
+ /** Name of the declaration, or a short description, e.g. "<class>". */
2591
+ text: string;
2592
+ /** A ScriptElementKind */
2593
+ kind: string;
2594
+ /** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
2595
+ kindModifiers: string;
2596
+ /**
2597
+ * Spans of the nodes that generated this declaration.
2598
+ * There will be more than one if this is the result of merging.
2599
+ */
2600
+ spans: TextSpan[];
2601
+ /** Present if non-empty */
2602
+ childItems?: NavigationTree[];
2603
+ }
2604
+ interface TodoCommentDescriptor {
2605
+ text: string;
2606
+ priority: number;
2607
+ }
2608
+ interface TodoComment {
2609
+ descriptor: TodoCommentDescriptor;
2610
+ message: string;
2611
+ position: number;
2612
+ }
2613
+ class TextChange {
2614
+ span: TextSpan;
2615
+ newText: string;
2616
+ }
2617
+ interface FileTextChanges {
2618
+ fileName: string;
2619
+ textChanges: TextChange[];
2620
+ }
2621
+ interface CodeAction {
2622
+ /** Description of the code action to display in the UI of the editor */
2623
+ description: string;
2624
+ /** Text changes to apply to each file as part of the code action */
2625
+ changes: FileTextChanges[];
2626
+ }
2627
+ interface TextInsertion {
2628
+ newText: string;
2629
+ /** The position in newText the caret should point to after the insertion. */
2630
+ caretOffset: number;
2631
+ }
2632
+ interface RenameLocation {
2633
+ textSpan: TextSpan;
2634
+ fileName: string;
2635
+ }
2636
+ interface ReferenceEntry {
2637
+ textSpan: TextSpan;
2638
+ fileName: string;
2639
+ isWriteAccess: boolean;
2640
+ isDefinition: boolean;
2641
+ }
2642
+ interface ImplementationLocation {
2643
+ textSpan: TextSpan;
2644
+ fileName: string;
2645
+ }
2646
+ interface DocumentHighlights {
2647
+ fileName: string;
2648
+ highlightSpans: HighlightSpan[];
2649
+ }
2650
+ namespace HighlightSpanKind {
2651
+ const none = "none";
2652
+ const definition = "definition";
2653
+ const reference = "reference";
2654
+ const writtenReference = "writtenReference";
2655
+ }
2656
+ interface HighlightSpan {
2657
+ fileName?: string;
2658
+ textSpan: TextSpan;
2659
+ kind: string;
2660
+ }
2661
+ interface NavigateToItem {
2662
+ name: string;
2663
+ kind: string;
2664
+ kindModifiers: string;
2665
+ matchKind: string;
2666
+ isCaseSensitive: boolean;
2667
+ fileName: string;
2668
+ textSpan: TextSpan;
2669
+ containerName: string;
2670
+ containerKind: string;
2671
+ }
2672
+ enum IndentStyle {
2673
+ None = 0,
2674
+ Block = 1,
2675
+ Smart = 2,
2676
+ }
2677
+ interface EditorOptions {
2678
+ BaseIndentSize?: number;
2679
+ IndentSize: number;
2680
+ TabSize: number;
2681
+ NewLineCharacter: string;
2682
+ ConvertTabsToSpaces: boolean;
2683
+ IndentStyle: IndentStyle;
2684
+ }
2685
+ interface EditorSettings {
2686
+ baseIndentSize?: number;
2687
+ indentSize?: number;
2688
+ tabSize?: number;
2689
+ newLineCharacter?: string;
2690
+ convertTabsToSpaces?: boolean;
2691
+ indentStyle?: IndentStyle;
2692
+ }
2693
+ interface FormatCodeOptions extends EditorOptions {
2694
+ InsertSpaceAfterCommaDelimiter: boolean;
2695
+ InsertSpaceAfterSemicolonInForStatements: boolean;
2696
+ InsertSpaceBeforeAndAfterBinaryOperators: boolean;
2697
+ InsertSpaceAfterConstructor?: boolean;
2698
+ InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
2699
+ InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
2700
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
2701
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
2702
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
2703
+ InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
2704
+ InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
2705
+ InsertSpaceAfterTypeAssertion?: boolean;
2706
+ InsertSpaceBeforeFunctionParenthesis?: boolean;
2707
+ PlaceOpenBraceOnNewLineForFunctions: boolean;
2708
+ PlaceOpenBraceOnNewLineForControlBlocks: boolean;
2709
+ }
2710
+ interface FormatCodeSettings extends EditorSettings {
2711
+ insertSpaceAfterCommaDelimiter?: boolean;
2712
+ insertSpaceAfterSemicolonInForStatements?: boolean;
2713
+ insertSpaceBeforeAndAfterBinaryOperators?: boolean;
2714
+ insertSpaceAfterConstructor?: boolean;
2715
+ insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
2716
+ insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
2717
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
2718
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
2719
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
2720
+ insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
2721
+ insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
2722
+ insertSpaceAfterTypeAssertion?: boolean;
2723
+ insertSpaceBeforeFunctionParenthesis?: boolean;
2724
+ placeOpenBraceOnNewLineForFunctions?: boolean;
2725
+ placeOpenBraceOnNewLineForControlBlocks?: boolean;
2726
+ }
2727
+ interface DefinitionInfo {
2728
+ fileName: string;
2729
+ textSpan: TextSpan;
2730
+ kind: string;
2731
+ name: string;
2732
+ containerKind: string;
2733
+ containerName: string;
2734
+ }
2735
+ interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
2736
+ displayParts: SymbolDisplayPart[];
2737
+ }
2738
+ interface ReferencedSymbol {
2739
+ definition: ReferencedSymbolDefinitionInfo;
2740
+ references: ReferenceEntry[];
2741
+ }
2742
+ enum SymbolDisplayPartKind {
2743
+ aliasName = 0,
2744
+ className = 1,
2745
+ enumName = 2,
2746
+ fieldName = 3,
2747
+ interfaceName = 4,
2748
+ keyword = 5,
2749
+ lineBreak = 6,
2750
+ numericLiteral = 7,
2751
+ stringLiteral = 8,
2752
+ localName = 9,
2753
+ methodName = 10,
2754
+ moduleName = 11,
2755
+ operator = 12,
2756
+ parameterName = 13,
2757
+ propertyName = 14,
2758
+ punctuation = 15,
2759
+ space = 16,
2760
+ text = 17,
2761
+ typeParameterName = 18,
2762
+ enumMemberName = 19,
2763
+ functionName = 20,
2764
+ regularExpressionLiteral = 21,
2765
+ }
2766
+ interface SymbolDisplayPart {
2767
+ text: string;
2768
+ kind: string;
2769
+ }
2770
+ interface JSDocTagInfo {
2771
+ name: string;
2772
+ text?: string;
2773
+ }
2774
+ interface QuickInfo {
2775
+ kind: string;
2776
+ kindModifiers: string;
2777
+ textSpan: TextSpan;
2778
+ displayParts: SymbolDisplayPart[];
2779
+ documentation: SymbolDisplayPart[];
2780
+ tags: JSDocTagInfo[];
2781
+ }
2782
+ interface RenameInfo {
2783
+ canRename: boolean;
2784
+ localizedErrorMessage: string;
2785
+ displayName: string;
2786
+ fullDisplayName: string;
2787
+ kind: string;
2788
+ kindModifiers: string;
2789
+ triggerSpan: TextSpan;
2790
+ }
2791
+ interface SignatureHelpParameter {
2792
+ name: string;
2793
+ documentation: SymbolDisplayPart[];
2794
+ displayParts: SymbolDisplayPart[];
2795
+ isOptional: boolean;
2796
+ }
2797
+ /**
2798
+ * Represents a single signature to show in signature help.
2799
+ * The id is used for subsequent calls into the language service to ask questions about the
2800
+ * signature help item in the context of any documents that have been updated. i.e. after
2801
+ * an edit has happened, while signature help is still active, the host can ask important
2802
+ * questions like 'what parameter is the user currently contained within?'.
2803
+ */
2804
+ interface SignatureHelpItem {
2805
+ isVariadic: boolean;
2806
+ prefixDisplayParts: SymbolDisplayPart[];
2807
+ suffixDisplayParts: SymbolDisplayPart[];
2808
+ separatorDisplayParts: SymbolDisplayPart[];
2809
+ parameters: SignatureHelpParameter[];
2810
+ documentation: SymbolDisplayPart[];
2811
+ tags: JSDocTagInfo[];
2812
+ }
2813
+ /**
2814
+ * Represents a set of signature help items, and the preferred item that should be selected.
2815
+ */
2816
+ interface SignatureHelpItems {
2817
+ items: SignatureHelpItem[];
2818
+ applicableSpan: TextSpan;
2819
+ selectedItemIndex: number;
2820
+ argumentIndex: number;
2821
+ argumentCount: number;
2822
+ }
2823
+ interface CompletionInfo {
2824
+ isGlobalCompletion: boolean;
2825
+ isMemberCompletion: boolean;
2826
+ /**
2827
+ * true when the current location also allows for a new identifier
2828
+ */
2829
+ isNewIdentifierLocation: boolean;
2830
+ entries: CompletionEntry[];
2831
+ }
2832
+ interface CompletionEntry {
2833
+ name: string;
2834
+ kind: string;
2835
+ kindModifiers: string;
2836
+ sortText: string;
2837
+ /**
2838
+ * An optional span that indicates the text to be replaced by this completion item. It will be
2839
+ * set if the required span differs from the one generated by the default replacement behavior and should
2840
+ * be used in that case
2841
+ */
2842
+ replacementSpan?: TextSpan;
2843
+ }
2844
+ interface CompletionEntryDetails {
2845
+ name: string;
2846
+ kind: string;
2847
+ kindModifiers: string;
2848
+ displayParts: SymbolDisplayPart[];
2849
+ documentation: SymbolDisplayPart[];
2850
+ tags: JSDocTagInfo[];
2851
+ }
2852
+ interface OutliningSpan {
2853
+ /** The span of the document to actually collapse. */
2854
+ textSpan: TextSpan;
2855
+ /** The span of the document to display when the user hovers over the collapsed span. */
2856
+ hintSpan: TextSpan;
2857
+ /** The text to display in the editor for the collapsed region. */
2858
+ bannerText: string;
2859
+ /**
2860
+ * Whether or not this region should be automatically collapsed when
2861
+ * the 'Collapse to Definitions' command is invoked.
2862
+ */
2863
+ autoCollapse: boolean;
2864
+ }
2865
+ interface EmitOutput {
2866
+ outputFiles: OutputFile[];
2867
+ emitSkipped: boolean;
2868
+ }
2869
+ enum OutputFileType {
2870
+ JavaScript = 0,
2871
+ SourceMap = 1,
2872
+ Declaration = 2,
2873
+ }
2874
+ interface OutputFile {
2875
+ name: string;
2876
+ writeByteOrderMark: boolean;
2877
+ text: string;
2878
+ }
2879
+ enum EndOfLineState {
2880
+ None = 0,
2881
+ InMultiLineCommentTrivia = 1,
2882
+ InSingleQuoteStringLiteral = 2,
2883
+ InDoubleQuoteStringLiteral = 3,
2884
+ InTemplateHeadOrNoSubstitutionTemplate = 4,
2885
+ InTemplateMiddleOrTail = 5,
2886
+ InTemplateSubstitutionPosition = 6,
2887
+ }
2888
+ enum TokenClass {
2889
+ Punctuation = 0,
2890
+ Keyword = 1,
2891
+ Operator = 2,
2892
+ Comment = 3,
2893
+ Whitespace = 4,
2894
+ Identifier = 5,
2895
+ NumberLiteral = 6,
2896
+ StringLiteral = 7,
2897
+ RegExpLiteral = 8,
2898
+ }
2899
+ interface ClassificationResult {
2900
+ finalLexState: EndOfLineState;
2901
+ entries: ClassificationInfo[];
2902
+ }
2903
+ interface ClassificationInfo {
2904
+ length: number;
2905
+ classification: TokenClass;
2906
+ }
2907
+ interface Classifier {
2908
+ /**
2909
+ * Gives lexical classifications of tokens on a line without any syntactic context.
2910
+ * For instance, a token consisting of the text 'string' can be either an identifier
2911
+ * named 'string' or the keyword 'string', however, because this classifier is not aware,
2912
+ * it relies on certain heuristics to give acceptable results. For classifications where
2913
+ * speed trumps accuracy, this function is preferable; however, for true accuracy, the
2914
+ * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
2915
+ * lexical, syntactic, and semantic classifiers may issue the best user experience.
2916
+ *
2917
+ * @param text The text of a line to classify.
2918
+ * @param lexState The state of the lexical classifier at the end of the previous line.
2919
+ * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
2920
+ * If there is no syntactic classifier (syntacticClassifierAbsent=true),
2921
+ * certain heuristics may be used in its place; however, if there is a
2922
+ * syntactic classifier (syntacticClassifierAbsent=false), certain
2923
+ * classifications which may be incorrectly categorized will be given
2924
+ * back as Identifiers in order to allow the syntactic classifier to
2925
+ * subsume the classification.
2926
+ * @deprecated Use getLexicalClassifications instead.
2927
+ */
2928
+ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
2929
+ getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
2930
+ }
2931
+ namespace ScriptElementKind {
2932
+ const unknown = "";
2933
+ const warning = "warning";
2934
+ /** predefined type (void) or keyword (class) */
2935
+ const keyword = "keyword";
2936
+ /** top level script node */
2937
+ const scriptElement = "script";
2938
+ /** module foo {} */
2939
+ const moduleElement = "module";
2940
+ /** class X {} */
2941
+ const classElement = "class";
2942
+ /** var x = class X {} */
2943
+ const localClassElement = "local class";
2944
+ /** interface Y {} */
2945
+ const interfaceElement = "interface";
2946
+ /** type T = ... */
2947
+ const typeElement = "type";
2948
+ /** enum E */
2949
+ const enumElement = "enum";
2950
+ const enumMemberElement = "const";
2951
+ /**
2952
+ * Inside module and script only
2953
+ * const v = ..
2954
+ */
2955
+ const variableElement = "var";
2956
+ /** Inside function */
2957
+ const localVariableElement = "local var";
2958
+ /**
2959
+ * Inside module and script only
2960
+ * function f() { }
2961
+ */
2962
+ const functionElement = "function";
2963
+ /** Inside function */
2964
+ const localFunctionElement = "local function";
2965
+ /** class X { [public|private]* foo() {} } */
2966
+ const memberFunctionElement = "method";
2967
+ /** class X { [public|private]* [get|set] foo:number; } */
2968
+ const memberGetAccessorElement = "getter";
2969
+ const memberSetAccessorElement = "setter";
2970
+ /**
2971
+ * class X { [public|private]* foo:number; }
2972
+ * interface Y { foo:number; }
2973
+ */
2974
+ const memberVariableElement = "property";
2975
+ /** class X { constructor() { } } */
2976
+ const constructorImplementationElement = "constructor";
2977
+ /** interface Y { ():number; } */
2978
+ const callSignatureElement = "call";
2979
+ /** interface Y { []:number; } */
2980
+ const indexSignatureElement = "index";
2981
+ /** interface Y { new():Y; } */
2982
+ const constructSignatureElement = "construct";
2983
+ /** function foo(*Y*: string) */
2984
+ const parameterElement = "parameter";
2985
+ const typeParameterElement = "type parameter";
2986
+ const primitiveType = "primitive type";
2987
+ const label = "label";
2988
+ const alias = "alias";
2989
+ const constElement = "const";
2990
+ const letElement = "let";
2991
+ const directory = "directory";
2992
+ const externalModuleName = "external module name";
2993
+ }
2994
+ namespace ScriptElementKindModifier {
2995
+ const none = "";
2996
+ const publicMemberModifier = "public";
2997
+ const privateMemberModifier = "private";
2998
+ const protectedMemberModifier = "protected";
2999
+ const exportedModifier = "export";
3000
+ const ambientModifier = "declare";
3001
+ const staticModifier = "static";
3002
+ const abstractModifier = "abstract";
3003
+ }
3004
+ class ClassificationTypeNames {
3005
+ static comment: string;
3006
+ static identifier: string;
3007
+ static keyword: string;
3008
+ static numericLiteral: string;
3009
+ static operator: string;
3010
+ static stringLiteral: string;
3011
+ static whiteSpace: string;
3012
+ static text: string;
3013
+ static punctuation: string;
3014
+ static className: string;
3015
+ static enumName: string;
3016
+ static interfaceName: string;
3017
+ static moduleName: string;
3018
+ static typeParameterName: string;
3019
+ static typeAliasName: string;
3020
+ static parameterName: string;
3021
+ static docCommentTagName: string;
3022
+ static jsxOpenTagName: string;
3023
+ static jsxCloseTagName: string;
3024
+ static jsxSelfClosingTagName: string;
3025
+ static jsxAttribute: string;
3026
+ static jsxText: string;
3027
+ static jsxAttributeStringLiteralValue: string;
3028
+ }
3029
+ enum ClassificationType {
3030
+ comment = 1,
3031
+ identifier = 2,
3032
+ keyword = 3,
3033
+ numericLiteral = 4,
3034
+ operator = 5,
3035
+ stringLiteral = 6,
3036
+ regularExpressionLiteral = 7,
3037
+ whiteSpace = 8,
3038
+ text = 9,
3039
+ punctuation = 10,
3040
+ className = 11,
3041
+ enumName = 12,
3042
+ interfaceName = 13,
3043
+ moduleName = 14,
3044
+ typeParameterName = 15,
3045
+ typeAliasName = 16,
3046
+ parameterName = 17,
3047
+ docCommentTagName = 18,
3048
+ jsxOpenTagName = 19,
3049
+ jsxCloseTagName = 20,
3050
+ jsxSelfClosingTagName = 21,
3051
+ jsxAttribute = 22,
3052
+ jsxText = 23,
3053
+ jsxAttributeStringLiteralValue = 24,
3054
+ }
3055
+ }
3056
+ declare namespace ts {
3057
+ function createClassifier(): Classifier;
3058
+ }
3059
+ declare namespace ts {
3060
+ /**
3061
+ * The document registry represents a store of SourceFile objects that can be shared between
3062
+ * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)
3063
+ * of files in the context.
3064
+ * SourceFile objects account for most of the memory usage by the language service. Sharing
3065
+ * the same DocumentRegistry instance between different instances of LanguageService allow
3066
+ * for more efficient memory utilization since all projects will share at least the library
3067
+ * file (lib.d.ts).
3068
+ *
3069
+ * A more advanced use of the document registry is to serialize sourceFile objects to disk
3070
+ * and re-hydrate them when needed.
3071
+ *
3072
+ * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
3073
+ * to all subsequent createLanguageService calls.
3074
+ */
3075
+ interface DocumentRegistry {
3076
+ /**
3077
+ * Request a stored SourceFile with a given fileName and compilationSettings.
3078
+ * The first call to acquire will call createLanguageServiceSourceFile to generate
3079
+ * the SourceFile if was not found in the registry.
3080
+ *
3081
+ * @param fileName The name of the file requested
3082
+ * @param compilationSettings Some compilation settings like target affects the
3083
+ * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
3084
+ * multiple copies of the same file for different compilation settings.
3085
+ * @parm scriptSnapshot Text of the file. Only used if the file was not found
3086
+ * in the registry and a new one was created.
3087
+ * @parm version Current version of the file. Only used if the file was not found
3088
+ * in the registry and a new one was created.
3089
+ */
3090
+ acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
3091
+ acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
3092
+ /**
3093
+ * Request an updated version of an already existing SourceFile with a given fileName
3094
+ * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
3095
+ * to get an updated SourceFile.
3096
+ *
3097
+ * @param fileName The name of the file requested
3098
+ * @param compilationSettings Some compilation settings like target affects the
3099
+ * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
3100
+ * multiple copies of the same file for different compilation settings.
3101
+ * @param scriptSnapshot Text of the file.
3102
+ * @param version Current version of the file.
3103
+ */
3104
+ updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
3105
+ updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
3106
+ getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey;
3107
+ /**
3108
+ * Informs the DocumentRegistry that a file is not needed any longer.
3109
+ *
3110
+ * Note: It is not allowed to call release on a SourceFile that was not acquired from
3111
+ * this registry originally.
3112
+ *
3113
+ * @param fileName The name of the file to be released
3114
+ * @param compilationSettings The compilation settings used to acquire the file
3115
+ */
3116
+ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
3117
+ releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void;
3118
+ reportStats(): string;
3119
+ }
3120
+ type DocumentRegistryBucketKey = string & {
3121
+ __bucketKey: any;
3122
+ };
3123
+ function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
3124
+ }
3125
+ declare namespace ts {
3126
+ function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
3127
+ }
3128
+ declare namespace ts {
3129
+ interface TranspileOptions {
3130
+ compilerOptions?: CompilerOptions;
3131
+ fileName?: string;
3132
+ reportDiagnostics?: boolean;
3133
+ moduleName?: string;
3134
+ renamedDependencies?: MapLike<string>;
3135
+ }
3136
+ interface TranspileOutput {
3137
+ outputText: string;
3138
+ diagnostics?: Diagnostic[];
3139
+ sourceMapText?: string;
3140
+ }
3141
+ function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
3142
+ function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
3143
+ }
3144
+ declare namespace ts {
3145
+ /** The version of the language service API */
3146
+ const servicesVersion = "0.5";
3147
+ interface DisplayPartsSymbolWriter extends SymbolWriter {
3148
+ displayParts(): SymbolDisplayPart[];
3149
+ }
3150
+ function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
3151
+ function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
3152
+ function getDefaultCompilerOptions(): CompilerOptions;
3153
+ function getSupportedCodeFixes(): string[];
3154
+ function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
3155
+ let disableIncrementalParsing: boolean;
3156
+ function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
3157
+ function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
3158
+ /**
3159
+ * Get the path of the default library files (lib.d.ts) as distributed with the typescript
3160
+ * node package.
3161
+ * The functionality is not supported if the ts module is consumed outside of a node module.
3162
+ */
3163
+ function getDefaultLibFilePath(options: CompilerOptions): string;
3164
+ }