typescript-src 1.4.1.3 → 1.6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +7 -0
  3. data/lib/typescript-src.rb +6 -1
  4. data/lib/typescript-src/support/typescript/.editorconfig +10 -0
  5. data/lib/typescript-src/support/typescript/.gitattributes +2 -0
  6. data/lib/typescript-src/support/typescript/.npmignore +8 -7
  7. data/lib/typescript-src/support/typescript/AUTHORS.md +70 -0
  8. data/lib/typescript-src/support/typescript/CONTRIBUTING.md +49 -18
  9. data/lib/typescript-src/support/typescript/Jakefile.js +795 -0
  10. data/lib/typescript-src/support/typescript/README.md +20 -4
  11. data/lib/typescript-src/support/typescript/bin/tsc +2 -2
  12. data/lib/typescript-src/support/typescript/bin/tsserver +2 -0
  13. data/lib/typescript-src/support/typescript/lib/lib.core.d.ts +3840 -0
  14. data/lib/typescript-src/support/typescript/{bin → lib}/lib.core.es6.d.ts +1747 -1420
  15. data/lib/typescript-src/support/typescript/{bin/lib.es6.d.ts → lib/lib.d.ts} +12054 -11947
  16. data/lib/typescript-src/support/typescript/{bin → lib}/lib.dom.d.ts +11167 -11015
  17. data/lib/typescript-src/support/typescript/{bin/lib.d.ts → lib/lib.es6.d.ts} +15023 -10641
  18. data/lib/typescript-src/support/typescript/lib/lib.scriptHost.d.ts +294 -0
  19. data/lib/typescript-src/support/typescript/lib/lib.webworker.d.ts +1202 -0
  20. data/lib/typescript-src/support/typescript/lib/tsc.js +31079 -0
  21. data/lib/typescript-src/support/typescript/lib/tsserver.js +44390 -0
  22. data/lib/typescript-src/support/typescript/lib/typescript.d.ts +2145 -0
  23. data/lib/typescript-src/support/typescript/lib/typescript.js +49349 -0
  24. data/lib/typescript-src/support/typescript/lib/typescriptServices.d.ts +2143 -0
  25. data/lib/typescript-src/support/typescript/lib/typescriptServices.js +49349 -0
  26. data/lib/typescript-src/support/typescript/package.json +77 -69
  27. data/lib/typescript-src/support/typescript/tslint.json +34 -0
  28. data/lib/typescript-src/version.rb +1 -1
  29. metadata +21 -15
  30. data/lib/typescript-src/support/typescript/bin/lib.core.d.ts +0 -1164
  31. data/lib/typescript-src/support/typescript/bin/lib.scriptHost.d.ts +0 -38
  32. data/lib/typescript-src/support/typescript/bin/lib.webworker.d.ts +0 -1652
  33. data/lib/typescript-src/support/typescript/bin/tsc.js +0 -18289
  34. data/lib/typescript-src/support/typescript/bin/typescript.d.ts +0 -1849
  35. data/lib/typescript-src/support/typescript/bin/typescriptServices.d.ts +0 -1849
  36. data/lib/typescript-src/support/typescript/bin/typescriptServices.js +0 -26273
  37. data/lib/typescript-src/support/typescript/bin/typescriptServices_internal.d.ts +0 -258
  38. data/lib/typescript-src/support/typescript/bin/typescript_internal.d.ts +0 -258
@@ -0,0 +1,2143 @@
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 Map<T> {
18
+ [index: string]: T;
19
+ }
20
+ interface FileMap<T> {
21
+ get(fileName: string): T;
22
+ set(fileName: string, value: T): void;
23
+ contains(fileName: string): boolean;
24
+ remove(fileName: string): void;
25
+ forEachValue(f: (v: T) => void): void;
26
+ clear(): void;
27
+ }
28
+ interface TextRange {
29
+ pos: number;
30
+ end: number;
31
+ }
32
+ const enum SyntaxKind {
33
+ Unknown = 0,
34
+ EndOfFileToken = 1,
35
+ SingleLineCommentTrivia = 2,
36
+ MultiLineCommentTrivia = 3,
37
+ NewLineTrivia = 4,
38
+ WhitespaceTrivia = 5,
39
+ ShebangTrivia = 6,
40
+ ConflictMarkerTrivia = 7,
41
+ NumericLiteral = 8,
42
+ StringLiteral = 9,
43
+ RegularExpressionLiteral = 10,
44
+ NoSubstitutionTemplateLiteral = 11,
45
+ TemplateHead = 12,
46
+ TemplateMiddle = 13,
47
+ TemplateTail = 14,
48
+ OpenBraceToken = 15,
49
+ CloseBraceToken = 16,
50
+ OpenParenToken = 17,
51
+ CloseParenToken = 18,
52
+ OpenBracketToken = 19,
53
+ CloseBracketToken = 20,
54
+ DotToken = 21,
55
+ DotDotDotToken = 22,
56
+ SemicolonToken = 23,
57
+ CommaToken = 24,
58
+ LessThanToken = 25,
59
+ LessThanSlashToken = 26,
60
+ GreaterThanToken = 27,
61
+ LessThanEqualsToken = 28,
62
+ GreaterThanEqualsToken = 29,
63
+ EqualsEqualsToken = 30,
64
+ ExclamationEqualsToken = 31,
65
+ EqualsEqualsEqualsToken = 32,
66
+ ExclamationEqualsEqualsToken = 33,
67
+ EqualsGreaterThanToken = 34,
68
+ PlusToken = 35,
69
+ MinusToken = 36,
70
+ AsteriskToken = 37,
71
+ SlashToken = 38,
72
+ PercentToken = 39,
73
+ PlusPlusToken = 40,
74
+ MinusMinusToken = 41,
75
+ LessThanLessThanToken = 42,
76
+ GreaterThanGreaterThanToken = 43,
77
+ GreaterThanGreaterThanGreaterThanToken = 44,
78
+ AmpersandToken = 45,
79
+ BarToken = 46,
80
+ CaretToken = 47,
81
+ ExclamationToken = 48,
82
+ TildeToken = 49,
83
+ AmpersandAmpersandToken = 50,
84
+ BarBarToken = 51,
85
+ QuestionToken = 52,
86
+ ColonToken = 53,
87
+ AtToken = 54,
88
+ EqualsToken = 55,
89
+ PlusEqualsToken = 56,
90
+ MinusEqualsToken = 57,
91
+ AsteriskEqualsToken = 58,
92
+ SlashEqualsToken = 59,
93
+ PercentEqualsToken = 60,
94
+ LessThanLessThanEqualsToken = 61,
95
+ GreaterThanGreaterThanEqualsToken = 62,
96
+ GreaterThanGreaterThanGreaterThanEqualsToken = 63,
97
+ AmpersandEqualsToken = 64,
98
+ BarEqualsToken = 65,
99
+ CaretEqualsToken = 66,
100
+ Identifier = 67,
101
+ BreakKeyword = 68,
102
+ CaseKeyword = 69,
103
+ CatchKeyword = 70,
104
+ ClassKeyword = 71,
105
+ ConstKeyword = 72,
106
+ ContinueKeyword = 73,
107
+ DebuggerKeyword = 74,
108
+ DefaultKeyword = 75,
109
+ DeleteKeyword = 76,
110
+ DoKeyword = 77,
111
+ ElseKeyword = 78,
112
+ EnumKeyword = 79,
113
+ ExportKeyword = 80,
114
+ ExtendsKeyword = 81,
115
+ FalseKeyword = 82,
116
+ FinallyKeyword = 83,
117
+ ForKeyword = 84,
118
+ FunctionKeyword = 85,
119
+ IfKeyword = 86,
120
+ ImportKeyword = 87,
121
+ InKeyword = 88,
122
+ InstanceOfKeyword = 89,
123
+ NewKeyword = 90,
124
+ NullKeyword = 91,
125
+ ReturnKeyword = 92,
126
+ SuperKeyword = 93,
127
+ SwitchKeyword = 94,
128
+ ThisKeyword = 95,
129
+ ThrowKeyword = 96,
130
+ TrueKeyword = 97,
131
+ TryKeyword = 98,
132
+ TypeOfKeyword = 99,
133
+ VarKeyword = 100,
134
+ VoidKeyword = 101,
135
+ WhileKeyword = 102,
136
+ WithKeyword = 103,
137
+ ImplementsKeyword = 104,
138
+ InterfaceKeyword = 105,
139
+ LetKeyword = 106,
140
+ PackageKeyword = 107,
141
+ PrivateKeyword = 108,
142
+ ProtectedKeyword = 109,
143
+ PublicKeyword = 110,
144
+ StaticKeyword = 111,
145
+ YieldKeyword = 112,
146
+ AbstractKeyword = 113,
147
+ AsKeyword = 114,
148
+ AnyKeyword = 115,
149
+ AsyncKeyword = 116,
150
+ AwaitKeyword = 117,
151
+ BooleanKeyword = 118,
152
+ ConstructorKeyword = 119,
153
+ DeclareKeyword = 120,
154
+ GetKeyword = 121,
155
+ IsKeyword = 122,
156
+ ModuleKeyword = 123,
157
+ NamespaceKeyword = 124,
158
+ RequireKeyword = 125,
159
+ NumberKeyword = 126,
160
+ SetKeyword = 127,
161
+ StringKeyword = 128,
162
+ SymbolKeyword = 129,
163
+ TypeKeyword = 130,
164
+ FromKeyword = 131,
165
+ OfKeyword = 132,
166
+ QualifiedName = 133,
167
+ ComputedPropertyName = 134,
168
+ TypeParameter = 135,
169
+ Parameter = 136,
170
+ Decorator = 137,
171
+ PropertySignature = 138,
172
+ PropertyDeclaration = 139,
173
+ MethodSignature = 140,
174
+ MethodDeclaration = 141,
175
+ Constructor = 142,
176
+ GetAccessor = 143,
177
+ SetAccessor = 144,
178
+ CallSignature = 145,
179
+ ConstructSignature = 146,
180
+ IndexSignature = 147,
181
+ TypePredicate = 148,
182
+ TypeReference = 149,
183
+ FunctionType = 150,
184
+ ConstructorType = 151,
185
+ TypeQuery = 152,
186
+ TypeLiteral = 153,
187
+ ArrayType = 154,
188
+ TupleType = 155,
189
+ UnionType = 156,
190
+ IntersectionType = 157,
191
+ ParenthesizedType = 158,
192
+ ObjectBindingPattern = 159,
193
+ ArrayBindingPattern = 160,
194
+ BindingElement = 161,
195
+ ArrayLiteralExpression = 162,
196
+ ObjectLiteralExpression = 163,
197
+ PropertyAccessExpression = 164,
198
+ ElementAccessExpression = 165,
199
+ CallExpression = 166,
200
+ NewExpression = 167,
201
+ TaggedTemplateExpression = 168,
202
+ TypeAssertionExpression = 169,
203
+ ParenthesizedExpression = 170,
204
+ FunctionExpression = 171,
205
+ ArrowFunction = 172,
206
+ DeleteExpression = 173,
207
+ TypeOfExpression = 174,
208
+ VoidExpression = 175,
209
+ AwaitExpression = 176,
210
+ PrefixUnaryExpression = 177,
211
+ PostfixUnaryExpression = 178,
212
+ BinaryExpression = 179,
213
+ ConditionalExpression = 180,
214
+ TemplateExpression = 181,
215
+ YieldExpression = 182,
216
+ SpreadElementExpression = 183,
217
+ ClassExpression = 184,
218
+ OmittedExpression = 185,
219
+ ExpressionWithTypeArguments = 186,
220
+ AsExpression = 187,
221
+ TemplateSpan = 188,
222
+ SemicolonClassElement = 189,
223
+ Block = 190,
224
+ VariableStatement = 191,
225
+ EmptyStatement = 192,
226
+ ExpressionStatement = 193,
227
+ IfStatement = 194,
228
+ DoStatement = 195,
229
+ WhileStatement = 196,
230
+ ForStatement = 197,
231
+ ForInStatement = 198,
232
+ ForOfStatement = 199,
233
+ ContinueStatement = 200,
234
+ BreakStatement = 201,
235
+ ReturnStatement = 202,
236
+ WithStatement = 203,
237
+ SwitchStatement = 204,
238
+ LabeledStatement = 205,
239
+ ThrowStatement = 206,
240
+ TryStatement = 207,
241
+ DebuggerStatement = 208,
242
+ VariableDeclaration = 209,
243
+ VariableDeclarationList = 210,
244
+ FunctionDeclaration = 211,
245
+ ClassDeclaration = 212,
246
+ InterfaceDeclaration = 213,
247
+ TypeAliasDeclaration = 214,
248
+ EnumDeclaration = 215,
249
+ ModuleDeclaration = 216,
250
+ ModuleBlock = 217,
251
+ CaseBlock = 218,
252
+ ImportEqualsDeclaration = 219,
253
+ ImportDeclaration = 220,
254
+ ImportClause = 221,
255
+ NamespaceImport = 222,
256
+ NamedImports = 223,
257
+ ImportSpecifier = 224,
258
+ ExportAssignment = 225,
259
+ ExportDeclaration = 226,
260
+ NamedExports = 227,
261
+ ExportSpecifier = 228,
262
+ MissingDeclaration = 229,
263
+ ExternalModuleReference = 230,
264
+ JsxElement = 231,
265
+ JsxSelfClosingElement = 232,
266
+ JsxOpeningElement = 233,
267
+ JsxText = 234,
268
+ JsxClosingElement = 235,
269
+ JsxAttribute = 236,
270
+ JsxSpreadAttribute = 237,
271
+ JsxExpression = 238,
272
+ CaseClause = 239,
273
+ DefaultClause = 240,
274
+ HeritageClause = 241,
275
+ CatchClause = 242,
276
+ PropertyAssignment = 243,
277
+ ShorthandPropertyAssignment = 244,
278
+ EnumMember = 245,
279
+ SourceFile = 246,
280
+ JSDocTypeExpression = 247,
281
+ JSDocAllType = 248,
282
+ JSDocUnknownType = 249,
283
+ JSDocArrayType = 250,
284
+ JSDocUnionType = 251,
285
+ JSDocTupleType = 252,
286
+ JSDocNullableType = 253,
287
+ JSDocNonNullableType = 254,
288
+ JSDocRecordType = 255,
289
+ JSDocRecordMember = 256,
290
+ JSDocTypeReference = 257,
291
+ JSDocOptionalType = 258,
292
+ JSDocFunctionType = 259,
293
+ JSDocVariadicType = 260,
294
+ JSDocConstructorType = 261,
295
+ JSDocThisType = 262,
296
+ JSDocComment = 263,
297
+ JSDocTag = 264,
298
+ JSDocParameterTag = 265,
299
+ JSDocReturnTag = 266,
300
+ JSDocTypeTag = 267,
301
+ JSDocTemplateTag = 268,
302
+ SyntaxList = 269,
303
+ Count = 270,
304
+ FirstAssignment = 55,
305
+ LastAssignment = 66,
306
+ FirstReservedWord = 68,
307
+ LastReservedWord = 103,
308
+ FirstKeyword = 68,
309
+ LastKeyword = 132,
310
+ FirstFutureReservedWord = 104,
311
+ LastFutureReservedWord = 112,
312
+ FirstTypeNode = 149,
313
+ LastTypeNode = 158,
314
+ FirstPunctuation = 15,
315
+ LastPunctuation = 66,
316
+ FirstToken = 0,
317
+ LastToken = 132,
318
+ FirstTriviaToken = 2,
319
+ LastTriviaToken = 7,
320
+ FirstLiteralToken = 8,
321
+ LastLiteralToken = 11,
322
+ FirstTemplateToken = 11,
323
+ LastTemplateToken = 14,
324
+ FirstBinaryOperator = 25,
325
+ LastBinaryOperator = 66,
326
+ FirstNode = 133,
327
+ }
328
+ const enum NodeFlags {
329
+ Export = 1,
330
+ Ambient = 2,
331
+ Public = 16,
332
+ Private = 32,
333
+ Protected = 64,
334
+ Static = 128,
335
+ Abstract = 256,
336
+ Async = 512,
337
+ Default = 1024,
338
+ MultiLine = 2048,
339
+ Synthetic = 4096,
340
+ DeclarationFile = 8192,
341
+ Let = 16384,
342
+ Const = 32768,
343
+ OctalLiteral = 65536,
344
+ Namespace = 131072,
345
+ ExportContext = 262144,
346
+ Modifier = 2035,
347
+ AccessibilityModifier = 112,
348
+ BlockScoped = 49152,
349
+ }
350
+ const enum JsxFlags {
351
+ None = 0,
352
+ IntrinsicNamedElement = 1,
353
+ IntrinsicIndexedElement = 2,
354
+ ClassElement = 4,
355
+ UnknownElement = 8,
356
+ IntrinsicElement = 3,
357
+ }
358
+ interface Node extends TextRange {
359
+ kind: SyntaxKind;
360
+ flags: NodeFlags;
361
+ decorators?: NodeArray<Decorator>;
362
+ modifiers?: ModifiersArray;
363
+ parent?: Node;
364
+ }
365
+ interface NodeArray<T> extends Array<T>, TextRange {
366
+ hasTrailingComma?: boolean;
367
+ }
368
+ interface ModifiersArray extends NodeArray<Node> {
369
+ flags: number;
370
+ }
371
+ interface Identifier extends PrimaryExpression {
372
+ text: string;
373
+ originalKeywordKind?: SyntaxKind;
374
+ }
375
+ interface QualifiedName extends Node {
376
+ left: EntityName;
377
+ right: Identifier;
378
+ }
379
+ type EntityName = Identifier | QualifiedName;
380
+ type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
381
+ interface Declaration extends Node {
382
+ _declarationBrand: any;
383
+ name?: DeclarationName;
384
+ }
385
+ interface ComputedPropertyName extends Node {
386
+ expression: Expression;
387
+ }
388
+ interface Decorator extends Node {
389
+ expression: LeftHandSideExpression;
390
+ }
391
+ interface TypeParameterDeclaration extends Declaration {
392
+ name: Identifier;
393
+ constraint?: TypeNode;
394
+ expression?: Expression;
395
+ }
396
+ interface SignatureDeclaration extends Declaration {
397
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
398
+ parameters: NodeArray<ParameterDeclaration>;
399
+ type?: TypeNode;
400
+ }
401
+ interface VariableDeclaration extends Declaration {
402
+ parent?: VariableDeclarationList;
403
+ name: Identifier | BindingPattern;
404
+ type?: TypeNode;
405
+ initializer?: Expression;
406
+ }
407
+ interface VariableDeclarationList extends Node {
408
+ declarations: NodeArray<VariableDeclaration>;
409
+ }
410
+ interface ParameterDeclaration extends Declaration {
411
+ dotDotDotToken?: Node;
412
+ name: Identifier | BindingPattern;
413
+ questionToken?: Node;
414
+ type?: TypeNode;
415
+ initializer?: Expression;
416
+ }
417
+ interface BindingElement extends Declaration {
418
+ propertyName?: Identifier;
419
+ dotDotDotToken?: Node;
420
+ name: Identifier | BindingPattern;
421
+ initializer?: Expression;
422
+ }
423
+ interface PropertyDeclaration extends Declaration, ClassElement {
424
+ name: DeclarationName;
425
+ questionToken?: Node;
426
+ type?: TypeNode;
427
+ initializer?: Expression;
428
+ }
429
+ interface ObjectLiteralElement extends Declaration {
430
+ _objectLiteralBrandBrand: any;
431
+ }
432
+ interface PropertyAssignment extends ObjectLiteralElement {
433
+ _propertyAssignmentBrand: any;
434
+ name: DeclarationName;
435
+ questionToken?: Node;
436
+ initializer: Expression;
437
+ }
438
+ interface ShorthandPropertyAssignment extends ObjectLiteralElement {
439
+ name: Identifier;
440
+ questionToken?: Node;
441
+ }
442
+ interface VariableLikeDeclaration extends Declaration {
443
+ propertyName?: Identifier;
444
+ dotDotDotToken?: Node;
445
+ name: DeclarationName;
446
+ questionToken?: Node;
447
+ type?: TypeNode;
448
+ initializer?: Expression;
449
+ }
450
+ interface BindingPattern extends Node {
451
+ elements: NodeArray<BindingElement>;
452
+ }
453
+ /**
454
+ * Several node kinds share function-like features such as a signature,
455
+ * a name, and a body. These nodes should extend FunctionLikeDeclaration.
456
+ * Examples:
457
+ * - FunctionDeclaration
458
+ * - MethodDeclaration
459
+ * - AccessorDeclaration
460
+ */
461
+ interface FunctionLikeDeclaration extends SignatureDeclaration {
462
+ _functionLikeDeclarationBrand: any;
463
+ asteriskToken?: Node;
464
+ questionToken?: Node;
465
+ body?: Block | Expression;
466
+ }
467
+ interface FunctionDeclaration extends FunctionLikeDeclaration, Statement {
468
+ name?: Identifier;
469
+ body?: Block;
470
+ }
471
+ interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
472
+ body?: Block;
473
+ }
474
+ interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
475
+ body?: Block;
476
+ }
477
+ interface SemicolonClassElement extends ClassElement {
478
+ _semicolonClassElementBrand: any;
479
+ }
480
+ interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
481
+ _accessorDeclarationBrand: any;
482
+ body: Block;
483
+ }
484
+ interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
485
+ _indexSignatureDeclarationBrand: any;
486
+ }
487
+ interface TypeNode extends Node {
488
+ _typeNodeBrand: any;
489
+ }
490
+ interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
491
+ _functionOrConstructorTypeNodeBrand: any;
492
+ }
493
+ interface TypeReferenceNode extends TypeNode {
494
+ typeName: EntityName;
495
+ typeArguments?: NodeArray<TypeNode>;
496
+ }
497
+ interface TypePredicateNode extends TypeNode {
498
+ parameterName: Identifier;
499
+ type: TypeNode;
500
+ }
501
+ interface TypeQueryNode extends TypeNode {
502
+ exprName: EntityName;
503
+ }
504
+ interface TypeLiteralNode extends TypeNode, Declaration {
505
+ members: NodeArray<Node>;
506
+ }
507
+ interface ArrayTypeNode extends TypeNode {
508
+ elementType: TypeNode;
509
+ }
510
+ interface TupleTypeNode extends TypeNode {
511
+ elementTypes: NodeArray<TypeNode>;
512
+ }
513
+ interface UnionOrIntersectionTypeNode extends TypeNode {
514
+ types: NodeArray<TypeNode>;
515
+ }
516
+ interface UnionTypeNode extends UnionOrIntersectionTypeNode {
517
+ }
518
+ interface IntersectionTypeNode extends UnionOrIntersectionTypeNode {
519
+ }
520
+ interface ParenthesizedTypeNode extends TypeNode {
521
+ type: TypeNode;
522
+ }
523
+ interface StringLiteral extends LiteralExpression, TypeNode {
524
+ _stringLiteralBrand: any;
525
+ }
526
+ interface Expression extends Node {
527
+ _expressionBrand: any;
528
+ contextualType?: Type;
529
+ }
530
+ interface UnaryExpression extends Expression {
531
+ _unaryExpressionBrand: any;
532
+ }
533
+ interface PrefixUnaryExpression extends UnaryExpression {
534
+ operator: SyntaxKind;
535
+ operand: UnaryExpression;
536
+ }
537
+ interface PostfixUnaryExpression extends PostfixExpression {
538
+ operand: LeftHandSideExpression;
539
+ operator: SyntaxKind;
540
+ }
541
+ interface PostfixExpression extends UnaryExpression {
542
+ _postfixExpressionBrand: any;
543
+ }
544
+ interface LeftHandSideExpression extends PostfixExpression {
545
+ _leftHandSideExpressionBrand: any;
546
+ }
547
+ interface MemberExpression extends LeftHandSideExpression {
548
+ _memberExpressionBrand: any;
549
+ }
550
+ interface PrimaryExpression extends MemberExpression {
551
+ _primaryExpressionBrand: any;
552
+ }
553
+ interface DeleteExpression extends UnaryExpression {
554
+ expression: UnaryExpression;
555
+ }
556
+ interface TypeOfExpression extends UnaryExpression {
557
+ expression: UnaryExpression;
558
+ }
559
+ interface VoidExpression extends UnaryExpression {
560
+ expression: UnaryExpression;
561
+ }
562
+ interface AwaitExpression extends UnaryExpression {
563
+ expression: UnaryExpression;
564
+ }
565
+ interface YieldExpression extends Expression {
566
+ asteriskToken?: Node;
567
+ expression?: Expression;
568
+ }
569
+ interface BinaryExpression extends Expression {
570
+ left: Expression;
571
+ operatorToken: Node;
572
+ right: Expression;
573
+ }
574
+ interface ConditionalExpression extends Expression {
575
+ condition: Expression;
576
+ questionToken: Node;
577
+ whenTrue: Expression;
578
+ colonToken: Node;
579
+ whenFalse: Expression;
580
+ }
581
+ interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
582
+ name?: Identifier;
583
+ body: Block | Expression;
584
+ }
585
+ interface ArrowFunction extends Expression, FunctionLikeDeclaration {
586
+ equalsGreaterThanToken: Node;
587
+ }
588
+ interface LiteralExpression extends PrimaryExpression {
589
+ text: string;
590
+ isUnterminated?: boolean;
591
+ hasExtendedUnicodeEscape?: boolean;
592
+ }
593
+ interface TemplateExpression extends PrimaryExpression {
594
+ head: LiteralExpression;
595
+ templateSpans: NodeArray<TemplateSpan>;
596
+ }
597
+ interface TemplateSpan extends Node {
598
+ expression: Expression;
599
+ literal: LiteralExpression;
600
+ }
601
+ interface ParenthesizedExpression extends PrimaryExpression {
602
+ expression: Expression;
603
+ }
604
+ interface ArrayLiteralExpression extends PrimaryExpression {
605
+ elements: NodeArray<Expression>;
606
+ }
607
+ interface SpreadElementExpression extends Expression {
608
+ expression: Expression;
609
+ }
610
+ interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
611
+ properties: NodeArray<ObjectLiteralElement>;
612
+ }
613
+ interface PropertyAccessExpression extends MemberExpression {
614
+ expression: LeftHandSideExpression;
615
+ dotToken: Node;
616
+ name: Identifier;
617
+ }
618
+ interface ElementAccessExpression extends MemberExpression {
619
+ expression: LeftHandSideExpression;
620
+ argumentExpression?: Expression;
621
+ }
622
+ interface CallExpression extends LeftHandSideExpression {
623
+ expression: LeftHandSideExpression;
624
+ typeArguments?: NodeArray<TypeNode>;
625
+ arguments: NodeArray<Expression>;
626
+ }
627
+ interface ExpressionWithTypeArguments extends TypeNode {
628
+ expression: LeftHandSideExpression;
629
+ typeArguments?: NodeArray<TypeNode>;
630
+ }
631
+ interface NewExpression extends CallExpression, PrimaryExpression {
632
+ }
633
+ interface TaggedTemplateExpression extends MemberExpression {
634
+ tag: LeftHandSideExpression;
635
+ template: LiteralExpression | TemplateExpression;
636
+ }
637
+ type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
638
+ interface AsExpression extends Expression {
639
+ expression: Expression;
640
+ type: TypeNode;
641
+ }
642
+ interface TypeAssertion extends UnaryExpression {
643
+ type: TypeNode;
644
+ expression: UnaryExpression;
645
+ }
646
+ type AssertionExpression = TypeAssertion | AsExpression;
647
+ interface JsxElement extends PrimaryExpression {
648
+ openingElement: JsxOpeningElement;
649
+ children: NodeArray<JsxChild>;
650
+ closingElement: JsxClosingElement;
651
+ }
652
+ interface JsxOpeningElement extends Expression {
653
+ _openingElementBrand?: any;
654
+ tagName: EntityName;
655
+ attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>;
656
+ }
657
+ interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement {
658
+ _selfClosingElementBrand?: any;
659
+ }
660
+ type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
661
+ interface JsxAttribute extends Node {
662
+ name: Identifier;
663
+ initializer?: Expression;
664
+ }
665
+ interface JsxSpreadAttribute extends Node {
666
+ expression: Expression;
667
+ }
668
+ interface JsxClosingElement extends Node {
669
+ tagName: EntityName;
670
+ }
671
+ interface JsxExpression extends Expression {
672
+ expression?: Expression;
673
+ }
674
+ interface JsxText extends Node {
675
+ _jsxTextExpressionBrand: any;
676
+ }
677
+ type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement;
678
+ interface Statement extends Node {
679
+ _statementBrand: any;
680
+ }
681
+ interface Block extends Statement {
682
+ statements: NodeArray<Statement>;
683
+ }
684
+ interface VariableStatement extends Statement {
685
+ declarationList: VariableDeclarationList;
686
+ }
687
+ interface ExpressionStatement extends Statement {
688
+ expression: Expression;
689
+ }
690
+ interface IfStatement extends Statement {
691
+ expression: Expression;
692
+ thenStatement: Statement;
693
+ elseStatement?: Statement;
694
+ }
695
+ interface IterationStatement extends Statement {
696
+ statement: Statement;
697
+ }
698
+ interface DoStatement extends IterationStatement {
699
+ expression: Expression;
700
+ }
701
+ interface WhileStatement extends IterationStatement {
702
+ expression: Expression;
703
+ }
704
+ interface ForStatement extends IterationStatement {
705
+ initializer?: VariableDeclarationList | Expression;
706
+ condition?: Expression;
707
+ incrementor?: Expression;
708
+ }
709
+ interface ForInStatement extends IterationStatement {
710
+ initializer: VariableDeclarationList | Expression;
711
+ expression: Expression;
712
+ }
713
+ interface ForOfStatement extends IterationStatement {
714
+ initializer: VariableDeclarationList | Expression;
715
+ expression: Expression;
716
+ }
717
+ interface BreakOrContinueStatement extends Statement {
718
+ label?: Identifier;
719
+ }
720
+ interface ReturnStatement extends Statement {
721
+ expression?: Expression;
722
+ }
723
+ interface WithStatement extends Statement {
724
+ expression: Expression;
725
+ statement: Statement;
726
+ }
727
+ interface SwitchStatement extends Statement {
728
+ expression: Expression;
729
+ caseBlock: CaseBlock;
730
+ }
731
+ interface CaseBlock extends Node {
732
+ clauses: NodeArray<CaseOrDefaultClause>;
733
+ }
734
+ interface CaseClause extends Node {
735
+ expression?: Expression;
736
+ statements: NodeArray<Statement>;
737
+ }
738
+ interface DefaultClause extends Node {
739
+ statements: NodeArray<Statement>;
740
+ }
741
+ type CaseOrDefaultClause = CaseClause | DefaultClause;
742
+ interface LabeledStatement extends Statement {
743
+ label: Identifier;
744
+ statement: Statement;
745
+ }
746
+ interface ThrowStatement extends Statement {
747
+ expression: Expression;
748
+ }
749
+ interface TryStatement extends Statement {
750
+ tryBlock: Block;
751
+ catchClause?: CatchClause;
752
+ finallyBlock?: Block;
753
+ }
754
+ interface CatchClause extends Node {
755
+ variableDeclaration: VariableDeclaration;
756
+ block: Block;
757
+ }
758
+ interface ClassLikeDeclaration extends Declaration {
759
+ name?: Identifier;
760
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
761
+ heritageClauses?: NodeArray<HeritageClause>;
762
+ members: NodeArray<ClassElement>;
763
+ }
764
+ interface ClassDeclaration extends ClassLikeDeclaration, Statement {
765
+ }
766
+ interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
767
+ }
768
+ interface ClassElement extends Declaration {
769
+ _classElementBrand: any;
770
+ }
771
+ interface InterfaceDeclaration extends Declaration, Statement {
772
+ name: Identifier;
773
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
774
+ heritageClauses?: NodeArray<HeritageClause>;
775
+ members: NodeArray<Declaration>;
776
+ }
777
+ interface HeritageClause extends Node {
778
+ token: SyntaxKind;
779
+ types?: NodeArray<ExpressionWithTypeArguments>;
780
+ }
781
+ interface TypeAliasDeclaration extends Declaration, Statement {
782
+ name: Identifier;
783
+ typeParameters?: NodeArray<TypeParameterDeclaration>;
784
+ type: TypeNode;
785
+ }
786
+ interface EnumMember extends Declaration {
787
+ name: DeclarationName;
788
+ initializer?: Expression;
789
+ }
790
+ interface EnumDeclaration extends Declaration, Statement {
791
+ name: Identifier;
792
+ members: NodeArray<EnumMember>;
793
+ }
794
+ interface ModuleDeclaration extends Declaration, Statement {
795
+ name: Identifier | LiteralExpression;
796
+ body: ModuleBlock | ModuleDeclaration;
797
+ }
798
+ interface ModuleBlock extends Node, Statement {
799
+ statements: NodeArray<Statement>;
800
+ }
801
+ interface ImportEqualsDeclaration extends Declaration, Statement {
802
+ name: Identifier;
803
+ moduleReference: EntityName | ExternalModuleReference;
804
+ }
805
+ interface ExternalModuleReference extends Node {
806
+ expression?: Expression;
807
+ }
808
+ interface ImportDeclaration extends Statement {
809
+ importClause?: ImportClause;
810
+ moduleSpecifier: Expression;
811
+ }
812
+ interface ImportClause extends Declaration {
813
+ name?: Identifier;
814
+ namedBindings?: NamespaceImport | NamedImports;
815
+ }
816
+ interface NamespaceImport extends Declaration {
817
+ name: Identifier;
818
+ }
819
+ interface ExportDeclaration extends Declaration, Statement {
820
+ exportClause?: NamedExports;
821
+ moduleSpecifier?: Expression;
822
+ }
823
+ interface NamedImportsOrExports extends Node {
824
+ elements: NodeArray<ImportOrExportSpecifier>;
825
+ }
826
+ type NamedImports = NamedImportsOrExports;
827
+ type NamedExports = NamedImportsOrExports;
828
+ interface ImportOrExportSpecifier extends Declaration {
829
+ propertyName?: Identifier;
830
+ name: Identifier;
831
+ }
832
+ type ImportSpecifier = ImportOrExportSpecifier;
833
+ type ExportSpecifier = ImportOrExportSpecifier;
834
+ interface ExportAssignment extends Declaration, Statement {
835
+ isExportEquals?: boolean;
836
+ expression: Expression;
837
+ }
838
+ interface FileReference extends TextRange {
839
+ fileName: string;
840
+ }
841
+ interface CommentRange extends TextRange {
842
+ hasTrailingNewLine?: boolean;
843
+ kind: SyntaxKind;
844
+ }
845
+ interface JSDocTypeExpression extends Node {
846
+ type: JSDocType;
847
+ }
848
+ interface JSDocType extends TypeNode {
849
+ _jsDocTypeBrand: any;
850
+ }
851
+ interface JSDocAllType extends JSDocType {
852
+ _JSDocAllTypeBrand: any;
853
+ }
854
+ interface JSDocUnknownType extends JSDocType {
855
+ _JSDocUnknownTypeBrand: any;
856
+ }
857
+ interface JSDocArrayType extends JSDocType {
858
+ elementType: JSDocType;
859
+ }
860
+ interface JSDocUnionType extends JSDocType {
861
+ types: NodeArray<JSDocType>;
862
+ }
863
+ interface JSDocTupleType extends JSDocType {
864
+ types: NodeArray<JSDocType>;
865
+ }
866
+ interface JSDocNonNullableType extends JSDocType {
867
+ type: JSDocType;
868
+ }
869
+ interface JSDocNullableType extends JSDocType {
870
+ type: JSDocType;
871
+ }
872
+ interface JSDocRecordType extends JSDocType, TypeLiteralNode {
873
+ members: NodeArray<JSDocRecordMember>;
874
+ }
875
+ interface JSDocTypeReference extends JSDocType {
876
+ name: EntityName;
877
+ typeArguments: NodeArray<JSDocType>;
878
+ }
879
+ interface JSDocOptionalType extends JSDocType {
880
+ type: JSDocType;
881
+ }
882
+ interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
883
+ parameters: NodeArray<ParameterDeclaration>;
884
+ type: JSDocType;
885
+ }
886
+ interface JSDocVariadicType extends JSDocType {
887
+ type: JSDocType;
888
+ }
889
+ interface JSDocConstructorType extends JSDocType {
890
+ type: JSDocType;
891
+ }
892
+ interface JSDocThisType extends JSDocType {
893
+ type: JSDocType;
894
+ }
895
+ interface JSDocRecordMember extends PropertyDeclaration {
896
+ name: Identifier | LiteralExpression;
897
+ type?: JSDocType;
898
+ }
899
+ interface JSDocComment extends Node {
900
+ tags: NodeArray<JSDocTag>;
901
+ }
902
+ interface JSDocTag extends Node {
903
+ atToken: Node;
904
+ tagName: Identifier;
905
+ }
906
+ interface JSDocTemplateTag extends JSDocTag {
907
+ typeParameters: NodeArray<TypeParameterDeclaration>;
908
+ }
909
+ interface JSDocReturnTag extends JSDocTag {
910
+ typeExpression: JSDocTypeExpression;
911
+ }
912
+ interface JSDocTypeTag extends JSDocTag {
913
+ typeExpression: JSDocTypeExpression;
914
+ }
915
+ interface JSDocParameterTag extends JSDocTag {
916
+ preParameterName?: Identifier;
917
+ typeExpression?: JSDocTypeExpression;
918
+ postParameterName?: Identifier;
919
+ isBracketed: boolean;
920
+ }
921
+ interface SourceFile extends Declaration {
922
+ statements: NodeArray<Statement>;
923
+ endOfFileToken: Node;
924
+ fileName: string;
925
+ text: string;
926
+ amdDependencies: {
927
+ path: string;
928
+ name: string;
929
+ }[];
930
+ moduleName: string;
931
+ referencedFiles: FileReference[];
932
+ languageVariant: LanguageVariant;
933
+ /**
934
+ * lib.d.ts should have a reference comment like
935
+ *
936
+ * /// <reference no-default-lib="true"/>
937
+ *
938
+ * If any other file has this comment, it signals not to include lib.d.ts
939
+ * because this containing file is intended to act as a default library.
940
+ */
941
+ hasNoDefaultLib: boolean;
942
+ languageVersion: ScriptTarget;
943
+ }
944
+ interface ScriptReferenceHost {
945
+ getCompilerOptions(): CompilerOptions;
946
+ getSourceFile(fileName: string): SourceFile;
947
+ getCurrentDirectory(): string;
948
+ }
949
+ interface ParseConfigHost extends ModuleResolutionHost {
950
+ readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
951
+ }
952
+ interface WriteFileCallback {
953
+ (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
954
+ }
955
+ class OperationCanceledException {
956
+ }
957
+ interface CancellationToken {
958
+ isCancellationRequested(): boolean;
959
+ /** @throws OperationCanceledException if isCancellationRequested is true */
960
+ throwIfCancellationRequested(): void;
961
+ }
962
+ interface Program extends ScriptReferenceHost {
963
+ /**
964
+ * Get a list of root file names that were passed to a 'createProgram'
965
+ */
966
+ getRootFileNames(): string[];
967
+ /**
968
+ * Get a list of files in the program
969
+ */
970
+ getSourceFiles(): SourceFile[];
971
+ /**
972
+ * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
973
+ * the JavaScript and declaration files will be produced for all the files in this program.
974
+ * If targetSourceFile is specified, then only the JavaScript and declaration for that
975
+ * specific file will be generated.
976
+ *
977
+ * If writeFile is not specified then the writeFile callback from the compiler host will be
978
+ * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
979
+ * will be invoked when writing the JavaScript and declaration files.
980
+ */
981
+ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult;
982
+ getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
983
+ getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
984
+ getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
985
+ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
986
+ getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
987
+ /**
988
+ * Gets a type checker that can be used to semantically analyze source fils in the program.
989
+ */
990
+ getTypeChecker(): TypeChecker;
991
+ }
992
+ interface SourceMapSpan {
993
+ /** Line number in the .js file. */
994
+ emittedLine: number;
995
+ /** Column number in the .js file. */
996
+ emittedColumn: number;
997
+ /** Line number in the .ts file. */
998
+ sourceLine: number;
999
+ /** Column number in the .ts file. */
1000
+ sourceColumn: number;
1001
+ /** Optional name (index into names array) associated with this span. */
1002
+ nameIndex?: number;
1003
+ /** .ts file (index into sources array) associated with this span */
1004
+ sourceIndex: number;
1005
+ }
1006
+ interface SourceMapData {
1007
+ sourceMapFilePath: string;
1008
+ jsSourceMappingURL: string;
1009
+ sourceMapFile: string;
1010
+ sourceMapSourceRoot: string;
1011
+ sourceMapSources: string[];
1012
+ sourceMapSourcesContent?: string[];
1013
+ inputSourceFileNames: string[];
1014
+ sourceMapNames?: string[];
1015
+ sourceMapMappings: string;
1016
+ sourceMapDecodedMappings: SourceMapSpan[];
1017
+ }
1018
+ /** Return code used by getEmitOutput function to indicate status of the function */
1019
+ enum ExitStatus {
1020
+ Success = 0,
1021
+ DiagnosticsPresent_OutputsSkipped = 1,
1022
+ DiagnosticsPresent_OutputsGenerated = 2,
1023
+ }
1024
+ interface EmitResult {
1025
+ emitSkipped: boolean;
1026
+ diagnostics: Diagnostic[];
1027
+ }
1028
+ interface TypeChecker {
1029
+ getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
1030
+ getDeclaredTypeOfSymbol(symbol: Symbol): Type;
1031
+ getPropertiesOfType(type: Type): Symbol[];
1032
+ getPropertyOfType(type: Type, propertyName: string): Symbol;
1033
+ getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
1034
+ getIndexTypeOfType(type: Type, kind: IndexKind): Type;
1035
+ getBaseTypes(type: InterfaceType): ObjectType[];
1036
+ getReturnTypeOfSignature(signature: Signature): Type;
1037
+ getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
1038
+ getSymbolAtLocation(node: Node): Symbol;
1039
+ getShorthandAssignmentValueSymbol(location: Node): Symbol;
1040
+ getTypeAtLocation(node: Node): Type;
1041
+ typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
1042
+ symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
1043
+ getSymbolDisplayBuilder(): SymbolDisplayBuilder;
1044
+ getFullyQualifiedName(symbol: Symbol): string;
1045
+ getAugmentedPropertiesOfType(type: Type): Symbol[];
1046
+ getRootSymbols(symbol: Symbol): Symbol[];
1047
+ getContextualType(node: Expression): Type;
1048
+ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
1049
+ getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
1050
+ isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
1051
+ isUndefinedSymbol(symbol: Symbol): boolean;
1052
+ isArgumentsSymbol(symbol: Symbol): boolean;
1053
+ getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
1054
+ isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
1055
+ getAliasedSymbol(symbol: Symbol): Symbol;
1056
+ getExportsOfModule(moduleSymbol: Symbol): Symbol[];
1057
+ getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
1058
+ getJsxIntrinsicTagNames(): Symbol[];
1059
+ isOptionalParameter(node: ParameterDeclaration): boolean;
1060
+ }
1061
+ interface SymbolDisplayBuilder {
1062
+ buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1063
+ buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
1064
+ buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1065
+ buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1066
+ buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1067
+ buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void;
1068
+ buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1069
+ buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1070
+ buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
1071
+ }
1072
+ interface SymbolWriter {
1073
+ writeKeyword(text: string): void;
1074
+ writeOperator(text: string): void;
1075
+ writePunctuation(text: string): void;
1076
+ writeSpace(text: string): void;
1077
+ writeStringLiteral(text: string): void;
1078
+ writeParameter(text: string): void;
1079
+ writeSymbol(text: string, symbol: Symbol): void;
1080
+ writeLine(): void;
1081
+ increaseIndent(): void;
1082
+ decreaseIndent(): void;
1083
+ clear(): void;
1084
+ trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
1085
+ }
1086
+ const enum TypeFormatFlags {
1087
+ None = 0,
1088
+ WriteArrayAsGenericType = 1,
1089
+ UseTypeOfFunction = 2,
1090
+ NoTruncation = 4,
1091
+ WriteArrowStyleSignature = 8,
1092
+ WriteOwnNameForAnyLike = 16,
1093
+ WriteTypeArgumentsOfSignature = 32,
1094
+ InElementType = 64,
1095
+ UseFullyQualifiedType = 128,
1096
+ }
1097
+ const enum SymbolFormatFlags {
1098
+ None = 0,
1099
+ WriteTypeParametersOrArguments = 1,
1100
+ UseOnlyExternalAliasing = 2,
1101
+ }
1102
+ interface TypePredicate {
1103
+ parameterName: string;
1104
+ parameterIndex: number;
1105
+ type: Type;
1106
+ }
1107
+ const enum SymbolFlags {
1108
+ None = 0,
1109
+ FunctionScopedVariable = 1,
1110
+ BlockScopedVariable = 2,
1111
+ Property = 4,
1112
+ EnumMember = 8,
1113
+ Function = 16,
1114
+ Class = 32,
1115
+ Interface = 64,
1116
+ ConstEnum = 128,
1117
+ RegularEnum = 256,
1118
+ ValueModule = 512,
1119
+ NamespaceModule = 1024,
1120
+ TypeLiteral = 2048,
1121
+ ObjectLiteral = 4096,
1122
+ Method = 8192,
1123
+ Constructor = 16384,
1124
+ GetAccessor = 32768,
1125
+ SetAccessor = 65536,
1126
+ Signature = 131072,
1127
+ TypeParameter = 262144,
1128
+ TypeAlias = 524288,
1129
+ ExportValue = 1048576,
1130
+ ExportType = 2097152,
1131
+ ExportNamespace = 4194304,
1132
+ Alias = 8388608,
1133
+ Instantiated = 16777216,
1134
+ Merged = 33554432,
1135
+ Transient = 67108864,
1136
+ Prototype = 134217728,
1137
+ SyntheticProperty = 268435456,
1138
+ Optional = 536870912,
1139
+ ExportStar = 1073741824,
1140
+ Enum = 384,
1141
+ Variable = 3,
1142
+ Value = 107455,
1143
+ Type = 793056,
1144
+ Namespace = 1536,
1145
+ Module = 1536,
1146
+ Accessor = 98304,
1147
+ FunctionScopedVariableExcludes = 107454,
1148
+ BlockScopedVariableExcludes = 107455,
1149
+ ParameterExcludes = 107455,
1150
+ PropertyExcludes = 107455,
1151
+ EnumMemberExcludes = 107455,
1152
+ FunctionExcludes = 106927,
1153
+ ClassExcludes = 899519,
1154
+ InterfaceExcludes = 792960,
1155
+ RegularEnumExcludes = 899327,
1156
+ ConstEnumExcludes = 899967,
1157
+ ValueModuleExcludes = 106639,
1158
+ NamespaceModuleExcludes = 0,
1159
+ MethodExcludes = 99263,
1160
+ GetAccessorExcludes = 41919,
1161
+ SetAccessorExcludes = 74687,
1162
+ TypeParameterExcludes = 530912,
1163
+ TypeAliasExcludes = 793056,
1164
+ AliasExcludes = 8388608,
1165
+ ModuleMember = 8914931,
1166
+ ExportHasLocal = 944,
1167
+ HasExports = 1952,
1168
+ HasMembers = 6240,
1169
+ BlockScoped = 418,
1170
+ PropertyOrAccessor = 98308,
1171
+ Export = 7340032,
1172
+ }
1173
+ interface Symbol {
1174
+ flags: SymbolFlags;
1175
+ name: string;
1176
+ declarations?: Declaration[];
1177
+ valueDeclaration?: Declaration;
1178
+ members?: SymbolTable;
1179
+ exports?: SymbolTable;
1180
+ }
1181
+ interface SymbolTable {
1182
+ [index: string]: Symbol;
1183
+ }
1184
+ const enum TypeFlags {
1185
+ Any = 1,
1186
+ String = 2,
1187
+ Number = 4,
1188
+ Boolean = 8,
1189
+ Void = 16,
1190
+ Undefined = 32,
1191
+ Null = 64,
1192
+ Enum = 128,
1193
+ StringLiteral = 256,
1194
+ TypeParameter = 512,
1195
+ Class = 1024,
1196
+ Interface = 2048,
1197
+ Reference = 4096,
1198
+ Tuple = 8192,
1199
+ Union = 16384,
1200
+ Intersection = 32768,
1201
+ Anonymous = 65536,
1202
+ Instantiated = 131072,
1203
+ ObjectLiteral = 524288,
1204
+ ESSymbol = 16777216,
1205
+ StringLike = 258,
1206
+ NumberLike = 132,
1207
+ ObjectType = 80896,
1208
+ UnionOrIntersection = 49152,
1209
+ StructuredType = 130048,
1210
+ }
1211
+ interface Type {
1212
+ flags: TypeFlags;
1213
+ symbol?: Symbol;
1214
+ }
1215
+ interface StringLiteralType extends Type {
1216
+ text: string;
1217
+ }
1218
+ interface ObjectType extends Type {
1219
+ }
1220
+ interface InterfaceType extends ObjectType {
1221
+ typeParameters: TypeParameter[];
1222
+ outerTypeParameters: TypeParameter[];
1223
+ localTypeParameters: TypeParameter[];
1224
+ }
1225
+ interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
1226
+ declaredProperties: Symbol[];
1227
+ declaredCallSignatures: Signature[];
1228
+ declaredConstructSignatures: Signature[];
1229
+ declaredStringIndexType: Type;
1230
+ declaredNumberIndexType: Type;
1231
+ }
1232
+ interface TypeReference extends ObjectType {
1233
+ target: GenericType;
1234
+ typeArguments: Type[];
1235
+ }
1236
+ interface GenericType extends InterfaceType, TypeReference {
1237
+ }
1238
+ interface TupleType extends ObjectType {
1239
+ elementTypes: Type[];
1240
+ baseArrayType: TypeReference;
1241
+ }
1242
+ interface UnionOrIntersectionType extends Type {
1243
+ types: Type[];
1244
+ }
1245
+ interface UnionType extends UnionOrIntersectionType {
1246
+ }
1247
+ interface IntersectionType extends UnionOrIntersectionType {
1248
+ }
1249
+ interface TypeParameter extends Type {
1250
+ constraint: Type;
1251
+ }
1252
+ const enum SignatureKind {
1253
+ Call = 0,
1254
+ Construct = 1,
1255
+ }
1256
+ interface Signature {
1257
+ declaration: SignatureDeclaration;
1258
+ typeParameters: TypeParameter[];
1259
+ parameters: Symbol[];
1260
+ typePredicate?: TypePredicate;
1261
+ }
1262
+ const enum IndexKind {
1263
+ String = 0,
1264
+ Number = 1,
1265
+ }
1266
+ interface DiagnosticMessage {
1267
+ key: string;
1268
+ category: DiagnosticCategory;
1269
+ code: number;
1270
+ }
1271
+ /**
1272
+ * A linked list of formatted diagnostic messages to be used as part of a multiline message.
1273
+ * It is built from the bottom up, leaving the head to be the "main" diagnostic.
1274
+ * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
1275
+ * the difference is that messages are all preformatted in DMC.
1276
+ */
1277
+ interface DiagnosticMessageChain {
1278
+ messageText: string;
1279
+ category: DiagnosticCategory;
1280
+ code: number;
1281
+ next?: DiagnosticMessageChain;
1282
+ }
1283
+ interface Diagnostic {
1284
+ file: SourceFile;
1285
+ start: number;
1286
+ length: number;
1287
+ messageText: string | DiagnosticMessageChain;
1288
+ category: DiagnosticCategory;
1289
+ code: number;
1290
+ }
1291
+ enum DiagnosticCategory {
1292
+ Warning = 0,
1293
+ Error = 1,
1294
+ Message = 2,
1295
+ }
1296
+ const enum ModuleResolutionKind {
1297
+ Classic = 1,
1298
+ NodeJs = 2,
1299
+ }
1300
+ interface CompilerOptions {
1301
+ allowNonTsExtensions?: boolean;
1302
+ charset?: string;
1303
+ declaration?: boolean;
1304
+ diagnostics?: boolean;
1305
+ emitBOM?: boolean;
1306
+ help?: boolean;
1307
+ init?: boolean;
1308
+ inlineSourceMap?: boolean;
1309
+ inlineSources?: boolean;
1310
+ jsx?: JsxEmit;
1311
+ listFiles?: boolean;
1312
+ locale?: string;
1313
+ mapRoot?: string;
1314
+ module?: ModuleKind;
1315
+ newLine?: NewLineKind;
1316
+ noEmit?: boolean;
1317
+ noEmitHelpers?: boolean;
1318
+ noEmitOnError?: boolean;
1319
+ noErrorTruncation?: boolean;
1320
+ noImplicitAny?: boolean;
1321
+ noLib?: boolean;
1322
+ noResolve?: boolean;
1323
+ out?: string;
1324
+ outFile?: string;
1325
+ outDir?: string;
1326
+ preserveConstEnums?: boolean;
1327
+ project?: string;
1328
+ removeComments?: boolean;
1329
+ rootDir?: string;
1330
+ sourceMap?: boolean;
1331
+ sourceRoot?: string;
1332
+ suppressExcessPropertyErrors?: boolean;
1333
+ suppressImplicitAnyIndexErrors?: boolean;
1334
+ target?: ScriptTarget;
1335
+ version?: boolean;
1336
+ watch?: boolean;
1337
+ isolatedModules?: boolean;
1338
+ experimentalDecorators?: boolean;
1339
+ experimentalAsyncFunctions?: boolean;
1340
+ emitDecoratorMetadata?: boolean;
1341
+ moduleResolution?: ModuleResolutionKind;
1342
+ [option: string]: string | number | boolean;
1343
+ }
1344
+ const enum ModuleKind {
1345
+ None = 0,
1346
+ CommonJS = 1,
1347
+ AMD = 2,
1348
+ UMD = 3,
1349
+ System = 4,
1350
+ }
1351
+ const enum JsxEmit {
1352
+ None = 0,
1353
+ Preserve = 1,
1354
+ React = 2,
1355
+ }
1356
+ const enum NewLineKind {
1357
+ CarriageReturnLineFeed = 0,
1358
+ LineFeed = 1,
1359
+ }
1360
+ interface LineAndCharacter {
1361
+ line: number;
1362
+ character: number;
1363
+ }
1364
+ const enum ScriptTarget {
1365
+ ES3 = 0,
1366
+ ES5 = 1,
1367
+ ES6 = 2,
1368
+ Latest = 2,
1369
+ }
1370
+ const enum LanguageVariant {
1371
+ Standard = 0,
1372
+ JSX = 1,
1373
+ }
1374
+ interface ParsedCommandLine {
1375
+ options: CompilerOptions;
1376
+ fileNames: string[];
1377
+ errors: Diagnostic[];
1378
+ }
1379
+ interface ModuleResolutionHost {
1380
+ fileExists(fileName: string): boolean;
1381
+ readFile(fileName: string): string;
1382
+ }
1383
+ interface ResolvedModule {
1384
+ resolvedFileName: string;
1385
+ isExternalLibraryImport?: boolean;
1386
+ }
1387
+ interface ResolvedModuleWithFailedLookupLocations {
1388
+ resolvedModule: ResolvedModule;
1389
+ failedLookupLocations: string[];
1390
+ }
1391
+ interface CompilerHost extends ModuleResolutionHost {
1392
+ getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
1393
+ getCancellationToken?(): CancellationToken;
1394
+ getDefaultLibFileName(options: CompilerOptions): string;
1395
+ writeFile: WriteFileCallback;
1396
+ getCurrentDirectory(): string;
1397
+ getCanonicalFileName(fileName: string): string;
1398
+ useCaseSensitiveFileNames(): boolean;
1399
+ getNewLine(): string;
1400
+ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
1401
+ }
1402
+ interface TextSpan {
1403
+ start: number;
1404
+ length: number;
1405
+ }
1406
+ interface TextChangeRange {
1407
+ span: TextSpan;
1408
+ newLength: number;
1409
+ }
1410
+ }
1411
+ declare namespace ts {
1412
+ interface System {
1413
+ args: string[];
1414
+ newLine: string;
1415
+ useCaseSensitiveFileNames: boolean;
1416
+ write(s: string): void;
1417
+ readFile(path: string, encoding?: string): string;
1418
+ writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
1419
+ watchFile?(path: string, callback: (path: string) => void): FileWatcher;
1420
+ resolvePath(path: string): string;
1421
+ fileExists(path: string): boolean;
1422
+ directoryExists(path: string): boolean;
1423
+ createDirectory(path: string): void;
1424
+ getExecutingFilePath(): string;
1425
+ getCurrentDirectory(): string;
1426
+ readDirectory(path: string, extension?: string, exclude?: string[]): string[];
1427
+ getMemoryUsage?(): number;
1428
+ exit(exitCode?: number): void;
1429
+ }
1430
+ interface FileWatcher {
1431
+ close(): void;
1432
+ }
1433
+ var sys: System;
1434
+ }
1435
+ declare namespace ts {
1436
+ interface ErrorCallback {
1437
+ (message: DiagnosticMessage, length: number): void;
1438
+ }
1439
+ interface Scanner {
1440
+ getStartPos(): number;
1441
+ getToken(): SyntaxKind;
1442
+ getTextPos(): number;
1443
+ getTokenPos(): number;
1444
+ getTokenText(): string;
1445
+ getTokenValue(): string;
1446
+ hasExtendedUnicodeEscape(): boolean;
1447
+ hasPrecedingLineBreak(): boolean;
1448
+ isIdentifier(): boolean;
1449
+ isReservedWord(): boolean;
1450
+ isUnterminated(): boolean;
1451
+ reScanGreaterToken(): SyntaxKind;
1452
+ reScanSlashToken(): SyntaxKind;
1453
+ reScanTemplateToken(): SyntaxKind;
1454
+ scanJsxIdentifier(): SyntaxKind;
1455
+ reScanJsxToken(): SyntaxKind;
1456
+ scanJsxToken(): SyntaxKind;
1457
+ scan(): SyntaxKind;
1458
+ setText(text: string, start?: number, length?: number): void;
1459
+ setOnError(onError: ErrorCallback): void;
1460
+ setScriptTarget(scriptTarget: ScriptTarget): void;
1461
+ setLanguageVariant(variant: LanguageVariant): void;
1462
+ setTextPos(textPos: number): void;
1463
+ lookAhead<T>(callback: () => T): T;
1464
+ tryScan<T>(callback: () => T): T;
1465
+ }
1466
+ function tokenToString(t: SyntaxKind): string;
1467
+ function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
1468
+ function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
1469
+ function isWhiteSpace(ch: number): boolean;
1470
+ function isLineBreak(ch: number): boolean;
1471
+ function couldStartTrivia(text: string, pos: number): boolean;
1472
+ function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
1473
+ function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
1474
+ /** Optionally, get the shebang */
1475
+ function getShebang(text: string): string;
1476
+ function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
1477
+ function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
1478
+ function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
1479
+ }
1480
+ declare namespace ts {
1481
+ function getDefaultLibFileName(options: CompilerOptions): string;
1482
+ function textSpanEnd(span: TextSpan): number;
1483
+ function textSpanIsEmpty(span: TextSpan): boolean;
1484
+ function textSpanContainsPosition(span: TextSpan, position: number): boolean;
1485
+ function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
1486
+ function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
1487
+ function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
1488
+ function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
1489
+ function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
1490
+ function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
1491
+ function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
1492
+ function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
1493
+ function createTextSpan(start: number, length: number): TextSpan;
1494
+ function createTextSpanFromBounds(start: number, end: number): TextSpan;
1495
+ function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
1496
+ function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
1497
+ function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
1498
+ let unchangedTextChangeRange: TextChangeRange;
1499
+ /**
1500
+ * Called to merge all the changes that occurred across several versions of a script snapshot
1501
+ * into a single change. i.e. if a user keeps making successive edits to a script we will
1502
+ * have a text change from V1 to V2, V2 to V3, ..., Vn.
1503
+ *
1504
+ * This function will then merge those changes into a single change range valid between V1 and
1505
+ * Vn.
1506
+ */
1507
+ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
1508
+ function getTypeParameterOwner(d: Declaration): Declaration;
1509
+ }
1510
+ declare namespace ts {
1511
+ function getNodeConstructor(kind: SyntaxKind): new () => Node;
1512
+ function createNode(kind: SyntaxKind): Node;
1513
+ function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
1514
+ function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
1515
+ function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
1516
+ }
1517
+ declare namespace ts {
1518
+ const version: string;
1519
+ function findConfigFile(searchPath: string): string;
1520
+ function resolveTripleslashReference(moduleName: string, containingFile: string): string;
1521
+ function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
1522
+ function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
1523
+ function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
1524
+ function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
1525
+ function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
1526
+ function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
1527
+ function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
1528
+ }
1529
+ declare namespace ts {
1530
+ function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
1531
+ /**
1532
+ * Read tsconfig.json file
1533
+ * @param fileName The path to the config file
1534
+ */
1535
+ function readConfigFile(fileName: string): {
1536
+ config?: any;
1537
+ error?: Diagnostic;
1538
+ };
1539
+ /**
1540
+ * Parse the text of the tsconfig.json file
1541
+ * @param fileName The path to the config file
1542
+ * @param jsonText The text of the config file
1543
+ */
1544
+ function parseConfigFileText(fileName: string, jsonText: string): {
1545
+ config?: any;
1546
+ error?: Diagnostic;
1547
+ };
1548
+ /**
1549
+ * Parse the contents of a config file (tsconfig.json).
1550
+ * @param json The contents of the config file to parse
1551
+ * @param basePath A root directory to resolve relative path entries in the config
1552
+ * file to. e.g. outDir
1553
+ */
1554
+ function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
1555
+ }
1556
+ declare namespace ts {
1557
+ /** The version of the language service API */
1558
+ let servicesVersion: string;
1559
+ interface Node {
1560
+ getSourceFile(): SourceFile;
1561
+ getChildCount(sourceFile?: SourceFile): number;
1562
+ getChildAt(index: number, sourceFile?: SourceFile): Node;
1563
+ getChildren(sourceFile?: SourceFile): Node[];
1564
+ getStart(sourceFile?: SourceFile): number;
1565
+ getFullStart(): number;
1566
+ getEnd(): number;
1567
+ getWidth(sourceFile?: SourceFile): number;
1568
+ getFullWidth(): number;
1569
+ getLeadingTriviaWidth(sourceFile?: SourceFile): number;
1570
+ getFullText(sourceFile?: SourceFile): string;
1571
+ getText(sourceFile?: SourceFile): string;
1572
+ getFirstToken(sourceFile?: SourceFile): Node;
1573
+ getLastToken(sourceFile?: SourceFile): Node;
1574
+ }
1575
+ interface Symbol {
1576
+ getFlags(): SymbolFlags;
1577
+ getName(): string;
1578
+ getDeclarations(): Declaration[];
1579
+ getDocumentationComment(): SymbolDisplayPart[];
1580
+ }
1581
+ interface Type {
1582
+ getFlags(): TypeFlags;
1583
+ getSymbol(): Symbol;
1584
+ getProperties(): Symbol[];
1585
+ getProperty(propertyName: string): Symbol;
1586
+ getApparentProperties(): Symbol[];
1587
+ getCallSignatures(): Signature[];
1588
+ getConstructSignatures(): Signature[];
1589
+ getStringIndexType(): Type;
1590
+ getNumberIndexType(): Type;
1591
+ getBaseTypes(): ObjectType[];
1592
+ }
1593
+ interface Signature {
1594
+ getDeclaration(): SignatureDeclaration;
1595
+ getTypeParameters(): Type[];
1596
+ getParameters(): Symbol[];
1597
+ getReturnType(): Type;
1598
+ getDocumentationComment(): SymbolDisplayPart[];
1599
+ }
1600
+ interface SourceFile {
1601
+ getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
1602
+ getLineStarts(): number[];
1603
+ getPositionOfLineAndCharacter(line: number, character: number): number;
1604
+ update(newText: string, textChangeRange: TextChangeRange): SourceFile;
1605
+ }
1606
+ /**
1607
+ * Represents an immutable snapshot of a script at a specified time.Once acquired, the
1608
+ * snapshot is observably immutable. i.e. the same calls with the same parameters will return
1609
+ * the same values.
1610
+ */
1611
+ interface IScriptSnapshot {
1612
+ /** Gets a portion of the script snapshot specified by [start, end). */
1613
+ getText(start: number, end: number): string;
1614
+ /** Gets the length of this script snapshot. */
1615
+ getLength(): number;
1616
+ /**
1617
+ * Gets the TextChangeRange that describe how the text changed between this text and
1618
+ * an older version. This information is used by the incremental parser to determine
1619
+ * what sections of the script need to be re-parsed. 'undefined' can be returned if the
1620
+ * change range cannot be determined. However, in that case, incremental parsing will
1621
+ * not happen and the entire document will be re - parsed.
1622
+ */
1623
+ getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
1624
+ /** Releases all resources held by this script snapshot */
1625
+ dispose?(): void;
1626
+ }
1627
+ module ScriptSnapshot {
1628
+ function fromString(text: string): IScriptSnapshot;
1629
+ }
1630
+ interface PreProcessedFileInfo {
1631
+ referencedFiles: FileReference[];
1632
+ importedFiles: FileReference[];
1633
+ ambientExternalModules: string[];
1634
+ isLibFile: boolean;
1635
+ }
1636
+ interface HostCancellationToken {
1637
+ isCancellationRequested(): boolean;
1638
+ }
1639
+ interface LanguageServiceHost {
1640
+ getCompilationSettings(): CompilerOptions;
1641
+ getNewLine?(): string;
1642
+ getProjectVersion?(): string;
1643
+ getScriptFileNames(): string[];
1644
+ getScriptVersion(fileName: string): string;
1645
+ getScriptSnapshot(fileName: string): IScriptSnapshot;
1646
+ getLocalizedDiagnosticMessages?(): any;
1647
+ getCancellationToken?(): HostCancellationToken;
1648
+ getCurrentDirectory(): string;
1649
+ getDefaultLibFileName(options: CompilerOptions): string;
1650
+ log?(s: string): void;
1651
+ trace?(s: string): void;
1652
+ error?(s: string): void;
1653
+ useCaseSensitiveFileNames?(): boolean;
1654
+ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
1655
+ }
1656
+ interface LanguageService {
1657
+ cleanupSemanticCache(): void;
1658
+ getSyntacticDiagnostics(fileName: string): Diagnostic[];
1659
+ getSemanticDiagnostics(fileName: string): Diagnostic[];
1660
+ getCompilerOptionsDiagnostics(): Diagnostic[];
1661
+ /**
1662
+ * @deprecated Use getEncodedSyntacticClassifications instead.
1663
+ */
1664
+ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
1665
+ /**
1666
+ * @deprecated Use getEncodedSemanticClassifications instead.
1667
+ */
1668
+ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
1669
+ getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
1670
+ getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
1671
+ getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
1672
+ getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
1673
+ getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
1674
+ getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
1675
+ getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan;
1676
+ getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems;
1677
+ getRenameInfo(fileName: string, position: number): RenameInfo;
1678
+ findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
1679
+ getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
1680
+ getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
1681
+ getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
1682
+ findReferences(fileName: string, position: number): ReferencedSymbol[];
1683
+ getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
1684
+ /** @deprecated */
1685
+ getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
1686
+ getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
1687
+ getNavigationBarItems(fileName: string): NavigationBarItem[];
1688
+ getOutliningSpans(fileName: string): OutliningSpan[];
1689
+ getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
1690
+ getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
1691
+ getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number;
1692
+ getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[];
1693
+ getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[];
1694
+ getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[];
1695
+ getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
1696
+ getEmitOutput(fileName: string): EmitOutput;
1697
+ getProgram(): Program;
1698
+ getSourceFile(fileName: string): SourceFile;
1699
+ dispose(): void;
1700
+ }
1701
+ interface Classifications {
1702
+ spans: number[];
1703
+ endOfLineState: EndOfLineState;
1704
+ }
1705
+ interface ClassifiedSpan {
1706
+ textSpan: TextSpan;
1707
+ classificationType: string;
1708
+ }
1709
+ interface NavigationBarItem {
1710
+ text: string;
1711
+ kind: string;
1712
+ kindModifiers: string;
1713
+ spans: TextSpan[];
1714
+ childItems: NavigationBarItem[];
1715
+ indent: number;
1716
+ bolded: boolean;
1717
+ grayed: boolean;
1718
+ }
1719
+ interface TodoCommentDescriptor {
1720
+ text: string;
1721
+ priority: number;
1722
+ }
1723
+ interface TodoComment {
1724
+ descriptor: TodoCommentDescriptor;
1725
+ message: string;
1726
+ position: number;
1727
+ }
1728
+ class TextChange {
1729
+ span: TextSpan;
1730
+ newText: string;
1731
+ }
1732
+ interface TextInsertion {
1733
+ newText: string;
1734
+ /** The position in newText the caret should point to after the insertion. */
1735
+ caretOffset: number;
1736
+ }
1737
+ interface RenameLocation {
1738
+ textSpan: TextSpan;
1739
+ fileName: string;
1740
+ }
1741
+ interface ReferenceEntry {
1742
+ textSpan: TextSpan;
1743
+ fileName: string;
1744
+ isWriteAccess: boolean;
1745
+ }
1746
+ interface DocumentHighlights {
1747
+ fileName: string;
1748
+ highlightSpans: HighlightSpan[];
1749
+ }
1750
+ module HighlightSpanKind {
1751
+ const none: string;
1752
+ const definition: string;
1753
+ const reference: string;
1754
+ const writtenReference: string;
1755
+ }
1756
+ interface HighlightSpan {
1757
+ fileName?: string;
1758
+ textSpan: TextSpan;
1759
+ kind: string;
1760
+ }
1761
+ interface NavigateToItem {
1762
+ name: string;
1763
+ kind: string;
1764
+ kindModifiers: string;
1765
+ matchKind: string;
1766
+ isCaseSensitive: boolean;
1767
+ fileName: string;
1768
+ textSpan: TextSpan;
1769
+ containerName: string;
1770
+ containerKind: string;
1771
+ }
1772
+ interface EditorOptions {
1773
+ IndentSize: number;
1774
+ TabSize: number;
1775
+ NewLineCharacter: string;
1776
+ ConvertTabsToSpaces: boolean;
1777
+ }
1778
+ interface FormatCodeOptions extends EditorOptions {
1779
+ InsertSpaceAfterCommaDelimiter: boolean;
1780
+ InsertSpaceAfterSemicolonInForStatements: boolean;
1781
+ InsertSpaceBeforeAndAfterBinaryOperators: boolean;
1782
+ InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
1783
+ InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
1784
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
1785
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
1786
+ PlaceOpenBraceOnNewLineForFunctions: boolean;
1787
+ PlaceOpenBraceOnNewLineForControlBlocks: boolean;
1788
+ [s: string]: boolean | number | string;
1789
+ }
1790
+ interface DefinitionInfo {
1791
+ fileName: string;
1792
+ textSpan: TextSpan;
1793
+ kind: string;
1794
+ name: string;
1795
+ containerKind: string;
1796
+ containerName: string;
1797
+ }
1798
+ interface ReferencedSymbol {
1799
+ definition: DefinitionInfo;
1800
+ references: ReferenceEntry[];
1801
+ }
1802
+ enum SymbolDisplayPartKind {
1803
+ aliasName = 0,
1804
+ className = 1,
1805
+ enumName = 2,
1806
+ fieldName = 3,
1807
+ interfaceName = 4,
1808
+ keyword = 5,
1809
+ lineBreak = 6,
1810
+ numericLiteral = 7,
1811
+ stringLiteral = 8,
1812
+ localName = 9,
1813
+ methodName = 10,
1814
+ moduleName = 11,
1815
+ operator = 12,
1816
+ parameterName = 13,
1817
+ propertyName = 14,
1818
+ punctuation = 15,
1819
+ space = 16,
1820
+ text = 17,
1821
+ typeParameterName = 18,
1822
+ enumMemberName = 19,
1823
+ functionName = 20,
1824
+ regularExpressionLiteral = 21,
1825
+ }
1826
+ interface SymbolDisplayPart {
1827
+ text: string;
1828
+ kind: string;
1829
+ }
1830
+ interface QuickInfo {
1831
+ kind: string;
1832
+ kindModifiers: string;
1833
+ textSpan: TextSpan;
1834
+ displayParts: SymbolDisplayPart[];
1835
+ documentation: SymbolDisplayPart[];
1836
+ }
1837
+ interface RenameInfo {
1838
+ canRename: boolean;
1839
+ localizedErrorMessage: string;
1840
+ displayName: string;
1841
+ fullDisplayName: string;
1842
+ kind: string;
1843
+ kindModifiers: string;
1844
+ triggerSpan: TextSpan;
1845
+ }
1846
+ interface SignatureHelpParameter {
1847
+ name: string;
1848
+ documentation: SymbolDisplayPart[];
1849
+ displayParts: SymbolDisplayPart[];
1850
+ isOptional: boolean;
1851
+ }
1852
+ /**
1853
+ * Represents a single signature to show in signature help.
1854
+ * The id is used for subsequent calls into the language service to ask questions about the
1855
+ * signature help item in the context of any documents that have been updated. i.e. after
1856
+ * an edit has happened, while signature help is still active, the host can ask important
1857
+ * questions like 'what parameter is the user currently contained within?'.
1858
+ */
1859
+ interface SignatureHelpItem {
1860
+ isVariadic: boolean;
1861
+ prefixDisplayParts: SymbolDisplayPart[];
1862
+ suffixDisplayParts: SymbolDisplayPart[];
1863
+ separatorDisplayParts: SymbolDisplayPart[];
1864
+ parameters: SignatureHelpParameter[];
1865
+ documentation: SymbolDisplayPart[];
1866
+ }
1867
+ /**
1868
+ * Represents a set of signature help items, and the preferred item that should be selected.
1869
+ */
1870
+ interface SignatureHelpItems {
1871
+ items: SignatureHelpItem[];
1872
+ applicableSpan: TextSpan;
1873
+ selectedItemIndex: number;
1874
+ argumentIndex: number;
1875
+ argumentCount: number;
1876
+ }
1877
+ interface CompletionInfo {
1878
+ isMemberCompletion: boolean;
1879
+ isNewIdentifierLocation: boolean;
1880
+ entries: CompletionEntry[];
1881
+ }
1882
+ interface CompletionEntry {
1883
+ name: string;
1884
+ kind: string;
1885
+ kindModifiers: string;
1886
+ sortText: string;
1887
+ }
1888
+ interface CompletionEntryDetails {
1889
+ name: string;
1890
+ kind: string;
1891
+ kindModifiers: string;
1892
+ displayParts: SymbolDisplayPart[];
1893
+ documentation: SymbolDisplayPart[];
1894
+ }
1895
+ interface OutliningSpan {
1896
+ /** The span of the document to actually collapse. */
1897
+ textSpan: TextSpan;
1898
+ /** The span of the document to display when the user hovers over the collapsed span. */
1899
+ hintSpan: TextSpan;
1900
+ /** The text to display in the editor for the collapsed region. */
1901
+ bannerText: string;
1902
+ /**
1903
+ * Whether or not this region should be automatically collapsed when
1904
+ * the 'Collapse to Definitions' command is invoked.
1905
+ */
1906
+ autoCollapse: boolean;
1907
+ }
1908
+ interface EmitOutput {
1909
+ outputFiles: OutputFile[];
1910
+ emitSkipped: boolean;
1911
+ }
1912
+ const enum OutputFileType {
1913
+ JavaScript = 0,
1914
+ SourceMap = 1,
1915
+ Declaration = 2,
1916
+ }
1917
+ interface OutputFile {
1918
+ name: string;
1919
+ writeByteOrderMark: boolean;
1920
+ text: string;
1921
+ }
1922
+ const enum EndOfLineState {
1923
+ None = 0,
1924
+ InMultiLineCommentTrivia = 1,
1925
+ InSingleQuoteStringLiteral = 2,
1926
+ InDoubleQuoteStringLiteral = 3,
1927
+ InTemplateHeadOrNoSubstitutionTemplate = 4,
1928
+ InTemplateMiddleOrTail = 5,
1929
+ InTemplateSubstitutionPosition = 6,
1930
+ }
1931
+ enum TokenClass {
1932
+ Punctuation = 0,
1933
+ Keyword = 1,
1934
+ Operator = 2,
1935
+ Comment = 3,
1936
+ Whitespace = 4,
1937
+ Identifier = 5,
1938
+ NumberLiteral = 6,
1939
+ StringLiteral = 7,
1940
+ RegExpLiteral = 8,
1941
+ }
1942
+ interface ClassificationResult {
1943
+ finalLexState: EndOfLineState;
1944
+ entries: ClassificationInfo[];
1945
+ }
1946
+ interface ClassificationInfo {
1947
+ length: number;
1948
+ classification: TokenClass;
1949
+ }
1950
+ interface Classifier {
1951
+ /**
1952
+ * Gives lexical classifications of tokens on a line without any syntactic context.
1953
+ * For instance, a token consisting of the text 'string' can be either an identifier
1954
+ * named 'string' or the keyword 'string', however, because this classifier is not aware,
1955
+ * it relies on certain heuristics to give acceptable results. For classifications where
1956
+ * speed trumps accuracy, this function is preferable; however, for true accuracy, the
1957
+ * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
1958
+ * lexical, syntactic, and semantic classifiers may issue the best user experience.
1959
+ *
1960
+ * @param text The text of a line to classify.
1961
+ * @param lexState The state of the lexical classifier at the end of the previous line.
1962
+ * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
1963
+ * If there is no syntactic classifier (syntacticClassifierAbsent=true),
1964
+ * certain heuristics may be used in its place; however, if there is a
1965
+ * syntactic classifier (syntacticClassifierAbsent=false), certain
1966
+ * classifications which may be incorrectly categorized will be given
1967
+ * back as Identifiers in order to allow the syntactic classifier to
1968
+ * subsume the classification.
1969
+ * @deprecated Use getLexicalClassifications instead.
1970
+ */
1971
+ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
1972
+ getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
1973
+ }
1974
+ /**
1975
+ * The document registry represents a store of SourceFile objects that can be shared between
1976
+ * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)
1977
+ * of files in the context.
1978
+ * SourceFile objects account for most of the memory usage by the language service. Sharing
1979
+ * the same DocumentRegistry instance between different instances of LanguageService allow
1980
+ * for more efficient memory utilization since all projects will share at least the library
1981
+ * file (lib.d.ts).
1982
+ *
1983
+ * A more advanced use of the document registry is to serialize sourceFile objects to disk
1984
+ * and re-hydrate them when needed.
1985
+ *
1986
+ * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
1987
+ * to all subsequent createLanguageService calls.
1988
+ */
1989
+ interface DocumentRegistry {
1990
+ /**
1991
+ * Request a stored SourceFile with a given fileName and compilationSettings.
1992
+ * The first call to acquire will call createLanguageServiceSourceFile to generate
1993
+ * the SourceFile if was not found in the registry.
1994
+ *
1995
+ * @param fileName The name of the file requested
1996
+ * @param compilationSettings Some compilation settings like target affects the
1997
+ * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
1998
+ * multiple copies of the same file for different compilation settings.
1999
+ * @parm scriptSnapshot Text of the file. Only used if the file was not found
2000
+ * in the registry and a new one was created.
2001
+ * @parm version Current version of the file. Only used if the file was not found
2002
+ * in the registry and a new one was created.
2003
+ */
2004
+ acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
2005
+ /**
2006
+ * Request an updated version of an already existing SourceFile with a given fileName
2007
+ * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
2008
+ * to get an updated SourceFile.
2009
+ *
2010
+ * @param fileName The name of the file requested
2011
+ * @param compilationSettings Some compilation settings like target affects the
2012
+ * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
2013
+ * multiple copies of the same file for different compilation settings.
2014
+ * @param scriptSnapshot Text of the file.
2015
+ * @param version Current version of the file.
2016
+ */
2017
+ updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
2018
+ /**
2019
+ * Informs the DocumentRegistry that a file is not needed any longer.
2020
+ *
2021
+ * Note: It is not allowed to call release on a SourceFile that was not acquired from
2022
+ * this registry originally.
2023
+ *
2024
+ * @param fileName The name of the file to be released
2025
+ * @param compilationSettings The compilation settings used to acquire the file
2026
+ */
2027
+ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
2028
+ reportStats(): string;
2029
+ }
2030
+ module ScriptElementKind {
2031
+ const unknown: string;
2032
+ const warning: string;
2033
+ const keyword: string;
2034
+ const scriptElement: string;
2035
+ const moduleElement: string;
2036
+ const classElement: string;
2037
+ const localClassElement: string;
2038
+ const interfaceElement: string;
2039
+ const typeElement: string;
2040
+ const enumElement: string;
2041
+ const variableElement: string;
2042
+ const localVariableElement: string;
2043
+ const functionElement: string;
2044
+ const localFunctionElement: string;
2045
+ const memberFunctionElement: string;
2046
+ const memberGetAccessorElement: string;
2047
+ const memberSetAccessorElement: string;
2048
+ const memberVariableElement: string;
2049
+ const constructorImplementationElement: string;
2050
+ const callSignatureElement: string;
2051
+ const indexSignatureElement: string;
2052
+ const constructSignatureElement: string;
2053
+ const parameterElement: string;
2054
+ const typeParameterElement: string;
2055
+ const primitiveType: string;
2056
+ const label: string;
2057
+ const alias: string;
2058
+ const constElement: string;
2059
+ const letElement: string;
2060
+ }
2061
+ module ScriptElementKindModifier {
2062
+ const none: string;
2063
+ const publicMemberModifier: string;
2064
+ const privateMemberModifier: string;
2065
+ const protectedMemberModifier: string;
2066
+ const exportedModifier: string;
2067
+ const ambientModifier: string;
2068
+ const staticModifier: string;
2069
+ const abstractModifier: string;
2070
+ }
2071
+ class ClassificationTypeNames {
2072
+ static comment: string;
2073
+ static identifier: string;
2074
+ static keyword: string;
2075
+ static numericLiteral: string;
2076
+ static operator: string;
2077
+ static stringLiteral: string;
2078
+ static whiteSpace: string;
2079
+ static text: string;
2080
+ static punctuation: string;
2081
+ static className: string;
2082
+ static enumName: string;
2083
+ static interfaceName: string;
2084
+ static moduleName: string;
2085
+ static typeParameterName: string;
2086
+ static typeAliasName: string;
2087
+ static parameterName: string;
2088
+ static docCommentTagName: string;
2089
+ }
2090
+ const enum ClassificationType {
2091
+ comment = 1,
2092
+ identifier = 2,
2093
+ keyword = 3,
2094
+ numericLiteral = 4,
2095
+ operator = 5,
2096
+ stringLiteral = 6,
2097
+ regularExpressionLiteral = 7,
2098
+ whiteSpace = 8,
2099
+ text = 9,
2100
+ punctuation = 10,
2101
+ className = 11,
2102
+ enumName = 12,
2103
+ interfaceName = 13,
2104
+ moduleName = 14,
2105
+ typeParameterName = 15,
2106
+ typeAliasName = 16,
2107
+ parameterName = 17,
2108
+ docCommentTagName = 18,
2109
+ }
2110
+ interface DisplayPartsSymbolWriter extends SymbolWriter {
2111
+ displayParts(): SymbolDisplayPart[];
2112
+ }
2113
+ function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
2114
+ function getDefaultCompilerOptions(): CompilerOptions;
2115
+ interface TranspileOptions {
2116
+ compilerOptions?: CompilerOptions;
2117
+ fileName?: string;
2118
+ reportDiagnostics?: boolean;
2119
+ moduleName?: string;
2120
+ renamedDependencies?: Map<string>;
2121
+ }
2122
+ interface TranspileOutput {
2123
+ outputText: string;
2124
+ diagnostics?: Diagnostic[];
2125
+ sourceMapText?: string;
2126
+ }
2127
+ function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
2128
+ function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
2129
+ function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
2130
+ let disableIncrementalParsing: boolean;
2131
+ function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
2132
+ function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
2133
+ function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
2134
+ function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
2135
+ function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
2136
+ function createClassifier(): Classifier;
2137
+ /**
2138
+ * Get the path of the default library files (lib.d.ts) as distributed with the typescript
2139
+ * node package.
2140
+ * The functionality is not supported if the ts module is consumed outside of a node module.
2141
+ */
2142
+ function getDefaultLibFilePath(options: CompilerOptions): string;
2143
+ }