@microsoft/api-extractor 7.55.5 → 7.56.1
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.
- package/CHANGELOG.json +24 -0
- package/CHANGELOG.md +13 -1
- package/lib/generators/ApiModelGenerator.d.ts +1 -1
- package/lib/generators/ApiModelGenerator.d.ts.map +1 -1
- package/lib/generators/ApiModelGenerator.js +101 -71
- package/lib/generators/ApiModelGenerator.js.map +1 -1
- package/lib/generators/ApiReportGenerator.d.ts.map +1 -1
- package/lib/generators/ApiReportGenerator.js +22 -4
- package/lib/generators/ApiReportGenerator.js.map +1 -1
- package/lib/generators/DtsEmitHelpers.d.ts +6 -0
- package/lib/generators/DtsEmitHelpers.d.ts.map +1 -1
- package/lib/generators/DtsEmitHelpers.js +84 -0
- package/lib/generators/DtsEmitHelpers.js.map +1 -1
- package/lib/generators/ExcerptBuilder.d.ts +13 -8
- package/lib/generators/ExcerptBuilder.d.ts.map +1 -1
- package/lib/generators/ExcerptBuilder.js +32 -13
- package/lib/generators/ExcerptBuilder.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/api-extractor",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "7.56.1",
|
|
6
|
+
"tag": "@microsoft/api-extractor_v7.56.1",
|
|
7
|
+
"date": "Wed, 04 Feb 2026 16:13:27 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"dependency": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.2.0`"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"version": "7.56.0",
|
|
18
|
+
"tag": "@microsoft/api-extractor_v7.56.0",
|
|
19
|
+
"date": "Fri, 30 Jan 2026 01:16:12 GMT",
|
|
20
|
+
"comments": {
|
|
21
|
+
"minor": [
|
|
22
|
+
{
|
|
23
|
+
"comment": "Fix an issue where destructured parameters produced an incorrect parameter name"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
4
28
|
{
|
|
5
29
|
"version": "7.55.5",
|
|
6
30
|
"tag": "@microsoft/api-extractor_v7.55.5",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Change Log - @microsoft/api-extractor
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 04 Feb 2026 16:13:27 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 7.56.1
|
|
6
|
+
Wed, 04 Feb 2026 16:13:27 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 7.56.0
|
|
11
|
+
Fri, 30 Jan 2026 01:16:12 GMT
|
|
12
|
+
|
|
13
|
+
### Minor changes
|
|
14
|
+
|
|
15
|
+
- Fix an issue where destructured parameters produced an incorrect parameter name
|
|
4
16
|
|
|
5
17
|
## 7.55.5
|
|
6
18
|
Thu, 08 Jan 2026 01:12:30 GMT
|
|
@@ -41,7 +41,7 @@ export declare class ApiModelGenerator {
|
|
|
41
41
|
private _processApiTypeAlias;
|
|
42
42
|
private _processApiVariable;
|
|
43
43
|
/**
|
|
44
|
-
* @param
|
|
44
|
+
* @param nodeTransforms - A list of child nodes whose token ranges we want to capture
|
|
45
45
|
*/
|
|
46
46
|
private _buildExcerptTokens;
|
|
47
47
|
private _captureTypeParameters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiModelGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/ApiModelGenerator.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAER,UAAU,EAOV,UAAU,EAiBX,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiModelGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/ApiModelGenerator.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAER,UAAU,EAOV,UAAU,EAiBX,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAS9D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;CACpC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAgC;IACpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA8B;IAEjE,SAAgB,eAAe,EAAE,OAAO,CAAC;gBAEtB,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe;IAezE,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAEM,eAAe,IAAI,UAAU;IA8BpC,OAAO,CAAC,iBAAiB;IAiCzB,OAAO,CAAC,0BAA0B;IAoClC,OAAO,CAAC,mBAAmB;IAgG3B,OAAO,CAAC,2BAA2B;IAOnC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,wBAAwB;IAmDhC,OAAO,CAAC,sBAAsB;IAyC9B,OAAO,CAAC,gBAAgB;IAgExB,OAAO,CAAC,6BAA6B;IAsDrC,OAAO,CAAC,eAAe;IAiCvB,OAAO,CAAC,qBAAqB;IAsC7B,OAAO,CAAC,mBAAmB;IAwD3B,OAAO,CAAC,yBAAyB;IA6CjC,OAAO,CAAC,oBAAoB;IAyD5B,OAAO,CAAC,iBAAiB;IA6DzB,OAAO,CAAC,0BAA0B;IAyDlC,OAAO,CAAC,oBAAoB;IAgC5B,OAAO,CAAC,mBAAmB;IAiE3B,OAAO,CAAC,4BAA4B;IAgDpC,OAAO,CAAC,oBAAoB;IA4C5B,OAAO,CAAC,mBAAmB;IAkD3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,sBAAsB;IA2B9B,OAAO,CAAC,kBAAkB;IA6B1B,OAAO,CAAC,WAAW;IA+BnB,OAAO,CAAC,eAAe;CAcxB"}
|
|
@@ -46,6 +46,7 @@ const AstSymbol_1 = require("../analyzer/AstSymbol");
|
|
|
46
46
|
const DeclarationReferenceGenerator_1 = require("./DeclarationReferenceGenerator");
|
|
47
47
|
const AstNamespaceImport_1 = require("../analyzer/AstNamespaceImport");
|
|
48
48
|
const TypeScriptInternals_1 = require("../analyzer/TypeScriptInternals");
|
|
49
|
+
const DtsEmitHelpers_1 = require("./DtsEmitHelpers");
|
|
49
50
|
class ApiModelGenerator {
|
|
50
51
|
constructor(collector, extractorConfig) {
|
|
51
52
|
this._collector = collector;
|
|
@@ -238,12 +239,14 @@ class ApiModelGenerator {
|
|
|
238
239
|
let apiCallSignature = parentApiItem.tryGetMemberByKey(containerKey);
|
|
239
240
|
if (apiCallSignature === undefined) {
|
|
240
241
|
const callSignature = astDeclaration.declaration;
|
|
241
|
-
const
|
|
242
|
+
const nodeTransforms = [];
|
|
242
243
|
const returnTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const
|
|
244
|
+
if (callSignature.type) {
|
|
245
|
+
nodeTransforms.push({ node: callSignature.type, captureTokenRange: returnTypeTokenRange });
|
|
246
|
+
}
|
|
247
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, callSignature.typeParameters);
|
|
248
|
+
const parameters = this._captureParameters(nodeTransforms, callSignature.parameters);
|
|
249
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
247
250
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
248
251
|
const docComment = apiItemMetadata.tsdocComment;
|
|
249
252
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -268,9 +271,9 @@ class ApiModelGenerator {
|
|
|
268
271
|
let apiConstructor = parentApiItem.tryGetMemberByKey(containerKey);
|
|
269
272
|
if (apiConstructor === undefined) {
|
|
270
273
|
const constructorDeclaration = astDeclaration.declaration;
|
|
271
|
-
const
|
|
272
|
-
const parameters = this._captureParameters(
|
|
273
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
274
|
+
const nodeTransforms = [];
|
|
275
|
+
const parameters = this._captureParameters(nodeTransforms, constructorDeclaration.parameters);
|
|
276
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
274
277
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
275
278
|
const docComment = apiItemMetadata.tsdocComment;
|
|
276
279
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -294,26 +297,26 @@ class ApiModelGenerator {
|
|
|
294
297
|
let apiClass = parentApiItem.tryGetMemberByKey(containerKey);
|
|
295
298
|
if (apiClass === undefined) {
|
|
296
299
|
const classDeclaration = astDeclaration.declaration;
|
|
297
|
-
const
|
|
298
|
-
const typeParameters = this._captureTypeParameters(
|
|
300
|
+
const nodeTransforms = [];
|
|
301
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, classDeclaration.typeParameters);
|
|
299
302
|
let extendsTokenRange = undefined;
|
|
300
303
|
const implementsTokenRanges = [];
|
|
301
304
|
for (const heritageClause of classDeclaration.heritageClauses || []) {
|
|
302
305
|
if (heritageClause.token === ts.SyntaxKind.ExtendsKeyword) {
|
|
303
306
|
extendsTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
304
307
|
if (heritageClause.types.length > 0) {
|
|
305
|
-
|
|
308
|
+
nodeTransforms.push({ node: heritageClause.types[0], captureTokenRange: extendsTokenRange });
|
|
306
309
|
}
|
|
307
310
|
}
|
|
308
311
|
else if (heritageClause.token === ts.SyntaxKind.ImplementsKeyword) {
|
|
309
312
|
for (const heritageType of heritageClause.types) {
|
|
310
313
|
const implementsTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
311
314
|
implementsTokenRanges.push(implementsTokenRange);
|
|
312
|
-
|
|
315
|
+
nodeTransforms.push({ node: heritageType, captureTokenRange: implementsTokenRange });
|
|
313
316
|
}
|
|
314
317
|
}
|
|
315
318
|
}
|
|
316
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
319
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
317
320
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
318
321
|
const docComment = apiItemMetadata.tsdocComment;
|
|
319
322
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -345,12 +348,14 @@ class ApiModelGenerator {
|
|
|
345
348
|
let apiConstructSignature = parentApiItem.tryGetMemberByKey(containerKey);
|
|
346
349
|
if (apiConstructSignature === undefined) {
|
|
347
350
|
const constructSignature = astDeclaration.declaration;
|
|
348
|
-
const
|
|
351
|
+
const nodeTransforms = [];
|
|
349
352
|
const returnTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
353
|
+
if (constructSignature.type) {
|
|
354
|
+
nodeTransforms.push({ node: constructSignature.type, captureTokenRange: returnTypeTokenRange });
|
|
355
|
+
}
|
|
356
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, constructSignature.typeParameters);
|
|
357
|
+
const parameters = this._captureParameters(nodeTransforms, constructSignature.parameters);
|
|
358
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
354
359
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
355
360
|
const docComment = apiItemMetadata.tsdocComment;
|
|
356
361
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -401,13 +406,13 @@ class ApiModelGenerator {
|
|
|
401
406
|
let apiEnumMember = parentApiItem.tryGetMemberByKey(containerKey);
|
|
402
407
|
if (apiEnumMember === undefined) {
|
|
403
408
|
const enumMember = astDeclaration.declaration;
|
|
404
|
-
const
|
|
409
|
+
const nodeTransforms = [];
|
|
405
410
|
let initializerTokenRange = undefined;
|
|
406
411
|
if (enumMember.initializer) {
|
|
407
412
|
initializerTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
408
|
-
|
|
413
|
+
nodeTransforms.push({ node: enumMember.initializer, captureTokenRange: initializerTokenRange });
|
|
409
414
|
}
|
|
410
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
415
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
411
416
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
412
417
|
const docComment = apiItemMetadata.tsdocComment;
|
|
413
418
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -430,12 +435,14 @@ class ApiModelGenerator {
|
|
|
430
435
|
let apiFunction = parentApiItem.tryGetMemberByKey(containerKey);
|
|
431
436
|
if (apiFunction === undefined) {
|
|
432
437
|
const functionDeclaration = altFunctionDeclaration !== null && altFunctionDeclaration !== void 0 ? altFunctionDeclaration : astDeclaration.declaration;
|
|
433
|
-
const
|
|
438
|
+
const nodeTransforms = [];
|
|
434
439
|
const returnTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const
|
|
440
|
+
if (functionDeclaration.type) {
|
|
441
|
+
nodeTransforms.push({ node: functionDeclaration.type, captureTokenRange: returnTypeTokenRange });
|
|
442
|
+
}
|
|
443
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, functionDeclaration.typeParameters);
|
|
444
|
+
const parameters = this._captureParameters(nodeTransforms, functionDeclaration.parameters);
|
|
445
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
439
446
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
440
447
|
const docComment = apiItemMetadata.tsdocComment;
|
|
441
448
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -462,11 +469,11 @@ class ApiModelGenerator {
|
|
|
462
469
|
let apiIndexSignature = parentApiItem.tryGetMemberByKey(containerKey);
|
|
463
470
|
if (apiIndexSignature === undefined) {
|
|
464
471
|
const indexSignature = astDeclaration.declaration;
|
|
465
|
-
const
|
|
472
|
+
const nodeTransforms = [];
|
|
466
473
|
const returnTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
467
|
-
|
|
468
|
-
const parameters = this._captureParameters(
|
|
469
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
474
|
+
nodeTransforms.push({ node: indexSignature.type, captureTokenRange: returnTypeTokenRange });
|
|
475
|
+
const parameters = this._captureParameters(nodeTransforms, indexSignature.parameters);
|
|
476
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
470
477
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
471
478
|
const docComment = apiItemMetadata.tsdocComment;
|
|
472
479
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -491,19 +498,19 @@ class ApiModelGenerator {
|
|
|
491
498
|
let apiInterface = parentApiItem.tryGetMemberByKey(containerKey);
|
|
492
499
|
if (apiInterface === undefined) {
|
|
493
500
|
const interfaceDeclaration = astDeclaration.declaration;
|
|
494
|
-
const
|
|
495
|
-
const typeParameters = this._captureTypeParameters(
|
|
501
|
+
const nodeTransforms = [];
|
|
502
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, interfaceDeclaration.typeParameters);
|
|
496
503
|
const extendsTokenRanges = [];
|
|
497
504
|
for (const heritageClause of interfaceDeclaration.heritageClauses || []) {
|
|
498
505
|
if (heritageClause.token === ts.SyntaxKind.ExtendsKeyword) {
|
|
499
506
|
for (const heritageType of heritageClause.types) {
|
|
500
507
|
const extendsTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
501
508
|
extendsTokenRanges.push(extendsTokenRange);
|
|
502
|
-
|
|
509
|
+
nodeTransforms.push({ node: heritageType, captureTokenRange: extendsTokenRange });
|
|
503
510
|
}
|
|
504
511
|
}
|
|
505
512
|
}
|
|
506
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
513
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
507
514
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
508
515
|
const docComment = apiItemMetadata.tsdocComment;
|
|
509
516
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -533,12 +540,14 @@ class ApiModelGenerator {
|
|
|
533
540
|
let apiMethod = parentApiItem.tryGetMemberByKey(containerKey);
|
|
534
541
|
if (apiMethod === undefined) {
|
|
535
542
|
const methodDeclaration = astDeclaration.declaration;
|
|
536
|
-
const
|
|
543
|
+
const nodeTransforms = [];
|
|
537
544
|
const returnTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const
|
|
545
|
+
if (methodDeclaration.type) {
|
|
546
|
+
nodeTransforms.push({ node: methodDeclaration.type, captureTokenRange: returnTypeTokenRange });
|
|
547
|
+
}
|
|
548
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, methodDeclaration.typeParameters);
|
|
549
|
+
const parameters = this._captureParameters(nodeTransforms, methodDeclaration.parameters);
|
|
550
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
542
551
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
543
552
|
const docComment = apiItemMetadata.tsdocComment;
|
|
544
553
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -574,12 +583,14 @@ class ApiModelGenerator {
|
|
|
574
583
|
let apiMethodSignature = parentApiItem.tryGetMemberByKey(containerKey);
|
|
575
584
|
if (apiMethodSignature === undefined) {
|
|
576
585
|
const methodSignature = astDeclaration.declaration;
|
|
577
|
-
const
|
|
586
|
+
const nodeTransforms = [];
|
|
578
587
|
const returnTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
const
|
|
588
|
+
if (methodSignature.type) {
|
|
589
|
+
nodeTransforms.push({ node: methodSignature.type, captureTokenRange: returnTypeTokenRange });
|
|
590
|
+
}
|
|
591
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, methodSignature.typeParameters);
|
|
592
|
+
const parameters = this._captureParameters(nodeTransforms, methodSignature.parameters);
|
|
593
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
583
594
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
584
595
|
const docComment = apiItemMetadata.tsdocComment;
|
|
585
596
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -632,7 +643,7 @@ class ApiModelGenerator {
|
|
|
632
643
|
let apiProperty = parentApiItem.tryGetMemberByKey(containerKey);
|
|
633
644
|
if (apiProperty === undefined) {
|
|
634
645
|
const declaration = astDeclaration.declaration;
|
|
635
|
-
const
|
|
646
|
+
const nodeTransforms = [];
|
|
636
647
|
const propertyTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
637
648
|
let propertyTypeNode;
|
|
638
649
|
if (ts.isPropertyDeclaration(declaration) || ts.isGetAccessorDeclaration(declaration)) {
|
|
@@ -642,13 +653,15 @@ class ApiModelGenerator {
|
|
|
642
653
|
// Note that TypeScript always reports an error if a setter does not have exactly one parameter.
|
|
643
654
|
propertyTypeNode = declaration.parameters[0].type;
|
|
644
655
|
}
|
|
645
|
-
|
|
656
|
+
if (propertyTypeNode) {
|
|
657
|
+
nodeTransforms.push({ node: propertyTypeNode, captureTokenRange: propertyTypeTokenRange });
|
|
658
|
+
}
|
|
646
659
|
let initializerTokenRange = undefined;
|
|
647
660
|
if (ts.isPropertyDeclaration(declaration) && declaration.initializer) {
|
|
648
661
|
initializerTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
649
|
-
|
|
662
|
+
nodeTransforms.push({ node: declaration.initializer, captureTokenRange: initializerTokenRange });
|
|
650
663
|
}
|
|
651
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
664
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
652
665
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
653
666
|
const docComment = apiItemMetadata.tsdocComment;
|
|
654
667
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -684,10 +697,12 @@ class ApiModelGenerator {
|
|
|
684
697
|
let apiPropertySignature = parentApiItem.tryGetMemberByKey(containerKey);
|
|
685
698
|
if (apiPropertySignature === undefined) {
|
|
686
699
|
const propertySignature = astDeclaration.declaration;
|
|
687
|
-
const
|
|
700
|
+
const nodeTransforms = [];
|
|
688
701
|
const propertyTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
689
|
-
|
|
690
|
-
|
|
702
|
+
if (propertySignature.type) {
|
|
703
|
+
nodeTransforms.push({ node: propertySignature.type, captureTokenRange: propertyTypeTokenRange });
|
|
704
|
+
}
|
|
705
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
691
706
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
692
707
|
const docComment = apiItemMetadata.tsdocComment;
|
|
693
708
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -717,11 +732,11 @@ class ApiModelGenerator {
|
|
|
717
732
|
let apiTypeAlias = parentApiItem.tryGetMemberByKey(containerKey);
|
|
718
733
|
if (apiTypeAlias === undefined) {
|
|
719
734
|
const typeAliasDeclaration = astDeclaration.declaration;
|
|
720
|
-
const
|
|
721
|
-
const typeParameters = this._captureTypeParameters(
|
|
735
|
+
const nodeTransforms = [];
|
|
736
|
+
const typeParameters = this._captureTypeParameters(nodeTransforms, typeAliasDeclaration.typeParameters);
|
|
722
737
|
const typeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
723
|
-
|
|
724
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
738
|
+
nodeTransforms.push({ node: typeAliasDeclaration.type, captureTokenRange: typeTokenRange });
|
|
739
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
725
740
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
726
741
|
const docComment = apiItemMetadata.tsdocComment;
|
|
727
742
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -745,15 +760,20 @@ class ApiModelGenerator {
|
|
|
745
760
|
let apiVariable = parentApiItem.tryGetMemberByKey(containerKey);
|
|
746
761
|
if (apiVariable === undefined) {
|
|
747
762
|
const variableDeclaration = astDeclaration.declaration;
|
|
748
|
-
const
|
|
763
|
+
const nodeTransforms = [];
|
|
749
764
|
const variableTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
750
|
-
|
|
765
|
+
if (variableDeclaration.type) {
|
|
766
|
+
nodeTransforms.push({ node: variableDeclaration.type, captureTokenRange: variableTypeTokenRange });
|
|
767
|
+
}
|
|
751
768
|
let initializerTokenRange = undefined;
|
|
752
769
|
if (variableDeclaration.initializer) {
|
|
753
770
|
initializerTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
754
|
-
|
|
771
|
+
nodeTransforms.push({
|
|
772
|
+
node: variableDeclaration.initializer,
|
|
773
|
+
captureTokenRange: initializerTokenRange
|
|
774
|
+
});
|
|
755
775
|
}
|
|
756
|
-
const excerptTokens = this._buildExcerptTokens(astDeclaration,
|
|
776
|
+
const excerptTokens = this._buildExcerptTokens(astDeclaration, nodeTransforms);
|
|
757
777
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
758
778
|
const docComment = apiItemMetadata.tsdocComment;
|
|
759
779
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
@@ -774,28 +794,32 @@ class ApiModelGenerator {
|
|
|
774
794
|
}
|
|
775
795
|
}
|
|
776
796
|
/**
|
|
777
|
-
* @param
|
|
797
|
+
* @param nodeTransforms - A list of child nodes whose token ranges we want to capture
|
|
778
798
|
*/
|
|
779
|
-
_buildExcerptTokens(astDeclaration,
|
|
799
|
+
_buildExcerptTokens(astDeclaration, nodeTransforms) {
|
|
780
800
|
const excerptTokens = [];
|
|
781
801
|
// Build the main declaration
|
|
782
|
-
ExcerptBuilder_1.ExcerptBuilder.addDeclaration(excerptTokens, astDeclaration,
|
|
802
|
+
ExcerptBuilder_1.ExcerptBuilder.addDeclaration(excerptTokens, astDeclaration, nodeTransforms, this._referenceGenerator);
|
|
783
803
|
const declarationMetadata = this._collector.fetchDeclarationMetadata(astDeclaration);
|
|
784
804
|
// Add any ancillary declarations
|
|
785
805
|
for (const ancillaryDeclaration of declarationMetadata.ancillaryDeclarations) {
|
|
786
806
|
ExcerptBuilder_1.ExcerptBuilder.addBlankLine(excerptTokens);
|
|
787
|
-
ExcerptBuilder_1.ExcerptBuilder.addDeclaration(excerptTokens, ancillaryDeclaration,
|
|
807
|
+
ExcerptBuilder_1.ExcerptBuilder.addDeclaration(excerptTokens, ancillaryDeclaration, nodeTransforms, this._referenceGenerator);
|
|
788
808
|
}
|
|
789
809
|
return excerptTokens;
|
|
790
810
|
}
|
|
791
|
-
_captureTypeParameters(
|
|
811
|
+
_captureTypeParameters(nodeTransforms, typeParameterNodes) {
|
|
792
812
|
const typeParameters = [];
|
|
793
813
|
if (typeParameterNodes) {
|
|
794
814
|
for (const typeParameter of typeParameterNodes) {
|
|
795
815
|
const constraintTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
796
|
-
|
|
816
|
+
if (typeParameter.constraint) {
|
|
817
|
+
nodeTransforms.push({ node: typeParameter.constraint, captureTokenRange: constraintTokenRange });
|
|
818
|
+
}
|
|
797
819
|
const defaultTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
798
|
-
|
|
820
|
+
if (typeParameter.default) {
|
|
821
|
+
nodeTransforms.push({ node: typeParameter.default, captureTokenRange: defaultTypeTokenRange });
|
|
822
|
+
}
|
|
799
823
|
typeParameters.push({
|
|
800
824
|
typeParameterName: typeParameter.name.getText().trim(),
|
|
801
825
|
constraintTokenRange,
|
|
@@ -805,17 +829,23 @@ class ApiModelGenerator {
|
|
|
805
829
|
}
|
|
806
830
|
return typeParameters;
|
|
807
831
|
}
|
|
808
|
-
_captureParameters(
|
|
832
|
+
_captureParameters(nodeTransforms, parameterNodes) {
|
|
809
833
|
const parameters = [];
|
|
810
|
-
|
|
834
|
+
DtsEmitHelpers_1.DtsEmitHelpers.forEachParameterToNormalize(parameterNodes, (parameter, syntheticName) => {
|
|
811
835
|
const parameterTypeTokenRange = ExcerptBuilder_1.ExcerptBuilder.createEmptyTokenRange();
|
|
812
|
-
|
|
836
|
+
if (parameter.type) {
|
|
837
|
+
nodeTransforms.push({ node: parameter.type, captureTokenRange: parameterTypeTokenRange });
|
|
838
|
+
}
|
|
813
839
|
parameters.push({
|
|
814
|
-
parameterName: parameter.name.getText().trim(),
|
|
840
|
+
parameterName: syntheticName !== null && syntheticName !== void 0 ? syntheticName : parameter.name.getText().trim(),
|
|
815
841
|
parameterTypeTokenRange,
|
|
816
842
|
isOptional: this._collector.typeChecker.isOptionalParameter(parameter)
|
|
817
843
|
});
|
|
818
|
-
|
|
844
|
+
if (syntheticName !== undefined) {
|
|
845
|
+
// Replace the subexpression like "{ y, z }" with the synthesized parameter name
|
|
846
|
+
nodeTransforms.push({ node: parameter.name, replacementText: syntheticName });
|
|
847
|
+
}
|
|
848
|
+
});
|
|
819
849
|
return parameters;
|
|
820
850
|
}
|
|
821
851
|
_isReadonly(astDeclaration) {
|