@@ -627,7 +627,7 @@ export class ApiModelGenerator {
627
627
if ( ! docComment && parent ) {
628
628
this . _collector . messageRouter . addAnalyzerIssue (
629
629
ExtractorMessageId . DjsMissingJSDoc ,
630
- `The symbol ${ parentApiItem . displayName } #constrcutor () has no matching jsdoc equivalent in the JavaScript source files.` ,
630
+ `The constructor ${ parentApiItem . displayName } () has no matching jsdoc equivalent in the JavaScript source files.` ,
631
631
astDeclaration ,
632
632
) ;
633
633
}
@@ -726,7 +726,7 @@ export class ApiModelGenerator {
726
726
if ( ! docComment && parent ) {
727
727
this . _collector . messageRouter . addAnalyzerIssue (
728
728
ExtractorMessageId . DjsMissingJSDoc ,
729
- `The symbol ${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
729
+ `The class ${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
730
730
astDeclaration ,
731
731
) ;
732
732
}
@@ -805,7 +805,7 @@ export class ApiModelGenerator {
805
805
if ( ! docComment && parent ) {
806
806
this . _collector . messageRouter . addAnalyzerIssue (
807
807
ExtractorMessageId . DjsMissingJSDoc ,
808
- `The symbol ${ parentApiItem . displayName } #constructor () has no matching jsdoc equivalent in the JavaScript source files.` ,
808
+ `The constructor signature ${ parentApiItem . displayName } () has no matching jsdoc equivalent in the JavaScript source files.` ,
809
809
astDeclaration ,
810
810
) ;
811
811
}
@@ -961,7 +961,7 @@ export class ApiModelGenerator {
961
961
if ( ! docComment && parent ) {
962
962
this . _collector . messageRouter . addAnalyzerIssue (
963
963
ExtractorMessageId . DjsMissingJSDoc ,
964
- `The symbol ${ name } () has no matching jsdoc equivalent in the JavaScript source files.` ,
964
+ `The function ${ name } () has no matching jsdoc equivalent in the JavaScript source files.` ,
965
965
astDeclaration ,
966
966
) ;
967
967
}
@@ -1092,7 +1092,7 @@ export class ApiModelGenerator {
1092
1092
if ( ! docComment && parent ) {
1093
1093
this . _collector . messageRouter . addAnalyzerIssue (
1094
1094
ExtractorMessageId . DjsMissingJSDoc ,
1095
- `The symbol ${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1095
+ `The interface ${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1096
1096
astDeclaration ,
1097
1097
) ;
1098
1098
}
@@ -1182,7 +1182,7 @@ export class ApiModelGenerator {
1182
1182
if ( ! docComment && parent ) {
1183
1183
this . _collector . messageRouter . addAnalyzerIssue (
1184
1184
ExtractorMessageId . DjsMissingJSDoc ,
1185
- `The symbol ${ parentApiItem . displayName } #${ name } () has no matching jsdoc equivalent in the JavaScript source files.` ,
1185
+ `The method ${ parentApiItem . displayName } #${ name } () has no matching jsdoc equivalent in the JavaScript source files.` ,
1186
1186
astDeclaration ,
1187
1187
) ;
1188
1188
}
@@ -1221,7 +1221,7 @@ export class ApiModelGenerator {
1221
1221
1222
1222
this . _collector . messageRouter . addAnalyzerIssueForPosition (
1223
1223
ExtractorMessageId . DjsMissingTypeScriptType ,
1224
- `The JSDoc comment for ${ parentApiItem . displayName } #${ name } () has no matching type equivalent in the TypeScript declaration file.` ,
1224
+ `The JSDoc comment for method ${ parentApiItem . displayName } #${ name } () has no matching type equivalent in the TypeScript declaration file.` ,
1225
1225
this . _mainSourceFile ! ,
1226
1226
0 ,
1227
1227
) ;
@@ -1294,7 +1294,7 @@ export class ApiModelGenerator {
1294
1294
if ( ! docComment && parent ) {
1295
1295
this . _collector . messageRouter . addAnalyzerIssue (
1296
1296
ExtractorMessageId . DjsMissingJSDoc ,
1297
- `The symbol ${ parentApiItem . displayName } #${ name } () has no matching jsdoc equivalent in the JavaScript source files.` ,
1297
+ `The method signature ${ parentApiItem . displayName } #${ name } () has no matching jsdoc equivalent in the JavaScript source files.` ,
1298
1298
astDeclaration ,
1299
1299
) ;
1300
1300
}
@@ -1320,7 +1320,7 @@ export class ApiModelGenerator {
1320
1320
} else if ( jsDoc ) {
1321
1321
this . _collector . messageRouter . addAnalyzerIssueForPosition (
1322
1322
ExtractorMessageId . DjsMissingTypeScriptType ,
1323
- `The JSDoc comment for ${ parentApiItem . displayName } #${ name } () has no matching type equivalent in the TypeScript declaration file.` ,
1323
+ `The JSDoc comment for method signature ${ parentApiItem . displayName } #${ name } () has no matching type equivalent in the TypeScript declaration file.` ,
1324
1324
this . _mainSourceFile ! ,
1325
1325
0 ,
1326
1326
) ;
@@ -1366,7 +1366,8 @@ export class ApiModelGenerator {
1366
1366
private _processApiProperty ( astDeclaration : AstDeclaration | null , context : IProcessAstEntityContext ) : void {
1367
1367
const { name, parentApiItem } = context ;
1368
1368
const parent = context . parentDocgenJson as DocgenClassJson | DocgenInterfaceJson | DocgenTypedefJson | undefined ;
1369
- const jsDoc = parent ?. props ?. find ( ( prop ) => prop . name === name ) ;
1369
+ const inherited = parent && 'extends' in parent ? this . _isInherited ( parent , name , parentApiItem . kind ) : undefined ;
1370
+ const jsDoc = parent ?. props ?. find ( ( prop ) => prop . name === name ) ?? inherited ;
1370
1371
const isStatic : boolean = astDeclaration
1371
1372
? ( astDeclaration . modifierFlags & ts . ModifierFlags . Static ) !== 0
1372
1373
: parentApiItem . kind === ApiItemKind . Class || parentApiItem . kind === ApiItemKind . Interface
@@ -1376,11 +1377,7 @@ export class ApiModelGenerator {
1376
1377
1377
1378
let apiProperty : ApiProperty | undefined = parentApiItem . tryGetMemberByKey ( containerKey ) as ApiProperty ;
1378
1379
1379
- if (
1380
- apiProperty === undefined &&
1381
- ( astDeclaration ||
1382
- ! this . _isInherited ( parent as DocgenClassJson | DocgenInterfaceJson , jsDoc ! , parentApiItem . kind ) )
1383
- ) {
1380
+ if ( apiProperty === undefined && ( astDeclaration || ! inherited ) ) {
1384
1381
if ( astDeclaration ) {
1385
1382
const declaration : ts . Declaration = astDeclaration . declaration ;
1386
1383
const nodesToCapture : IExcerptBuilderNodeToCapture [ ] = [ ] ;
@@ -1424,7 +1421,7 @@ export class ApiModelGenerator {
1424
1421
if ( ! docComment && parent ) {
1425
1422
this . _collector . messageRouter . addAnalyzerIssue (
1426
1423
ExtractorMessageId . DjsMissingJSDoc ,
1427
- `The symbol ${ parentApiItem . displayName } #${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1424
+ `The property ${ parentApiItem . displayName } #${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1428
1425
astDeclaration ,
1429
1426
) ;
1430
1427
}
@@ -1455,7 +1452,7 @@ export class ApiModelGenerator {
1455
1452
} else if ( parentApiItem . kind === ApiItemKind . Class || parentApiItem . kind === ApiItemKind . Interface ) {
1456
1453
this . _collector . messageRouter . addAnalyzerIssueForPosition (
1457
1454
ExtractorMessageId . DjsMissingTypeScriptType ,
1458
- `The JSDoc comment for ${ parentApiItem . displayName } #${ name } has no matching type equivalent in the TypeScript declaration file.` ,
1455
+ `The JSDoc comment for property ${ parentApiItem . displayName } #${ name } has no matching type equivalent in the TypeScript declaration file.` ,
1459
1456
this . _mainSourceFile ! ,
1460
1457
0 ,
1461
1458
) ;
@@ -1484,11 +1481,13 @@ export class ApiModelGenerator {
1484
1481
containerKey ,
1485
1482
) as ApiPropertySignature ;
1486
1483
const parent = context . parentDocgenJson as DocgenInterfaceJson | DocgenPropertyJson | DocgenTypedefJson | undefined ;
1487
- const jsDoc = parent ?. props ?. find ( ( prop ) => prop . name === name ) ;
1484
+ const inherited = parent && 'extends' in parent ? this . _isInherited ( parent , name , parentApiItem . kind ) : undefined ;
1485
+ const jsDoc = parent ?. props ?. find ( ( prop ) => prop . name === name ) ?? inherited ;
1488
1486
1489
1487
if (
1490
1488
apiPropertySignature === undefined &&
1491
- ( astDeclaration || ! this . _isInherited ( parent as DocgenInterfaceJson , jsDoc ! , parentApiItem . kind ) )
1489
+ ( astDeclaration || ! inherited ) &&
1490
+ parentApiItem . kind !== ApiItemKind . Class
1492
1491
) {
1493
1492
if ( astDeclaration ) {
1494
1493
const propertySignature : ts . PropertySignature = astDeclaration . declaration as ts . PropertySignature ;
@@ -1517,7 +1516,7 @@ export class ApiModelGenerator {
1517
1516
if ( ! docComment && parent ) {
1518
1517
this . _collector . messageRouter . addAnalyzerIssue (
1519
1518
ExtractorMessageId . DjsMissingJSDoc ,
1520
- `The symbol ${ parentApiItem . displayName } #${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1519
+ `The property signature ${ parentApiItem . displayName } #${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1521
1520
astDeclaration ,
1522
1521
) ;
1523
1522
}
@@ -1539,10 +1538,10 @@ export class ApiModelGenerator {
1539
1538
fileLine : jsDoc && 'meta' in jsDoc ? jsDoc . meta . line : sourceLocation . sourceFileLine ,
1540
1539
fileColumn : sourceLocation . sourceFileColumn ,
1541
1540
} ) ;
1542
- } else if ( parentApiItem . kind === ApiItemKind . Class || parentApiItem . kind === ApiItemKind . Interface ) {
1541
+ } else if ( parentApiItem . kind === ApiItemKind . Interface ) {
1543
1542
this . _collector . messageRouter . addAnalyzerIssueForPosition (
1544
1543
ExtractorMessageId . DjsMissingTypeScriptType ,
1545
- `The JSDoc comment for ${ parentApiItem . displayName } #${ name } has no matching type equivalent in the TypeScript declaration file.` ,
1544
+ `The JSDoc comment for property signature ${ parentApiItem . displayName } #${ name } has no matching type equivalent in the TypeScript declaration file.` ,
1546
1545
this . _mainSourceFile ! ,
1547
1546
0 ,
1548
1547
) ;
@@ -1610,7 +1609,7 @@ export class ApiModelGenerator {
1610
1609
if ( ! docComment && parent ) {
1611
1610
this . _collector . messageRouter . addAnalyzerIssue (
1612
1611
ExtractorMessageId . DjsMissingJSDoc ,
1613
- `The symbol ${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1612
+ `The type alias ${ name } has no matching jsdoc equivalent in the JavaScript source files.` ,
1614
1613
astDeclaration ,
1615
1614
) ;
1616
1615
}
@@ -1848,20 +1847,19 @@ export class ApiModelGenerator {
1848
1847
1849
1848
private _isInherited (
1850
1849
container : DocgenClassJson | DocgenInterfaceJson ,
1851
- jsDoc : DocgenParamJson | DocgenPropertyJson ,
1850
+ propertyName : string ,
1852
1851
containerKind : ApiItemKind ,
1853
- ) : boolean {
1852
+ ) : DocgenPropertyJson | undefined {
1854
1853
switch ( containerKind ) {
1855
1854
case ApiItemKind . Class : {
1856
1855
const token = ( container as DocgenClassJson ) . extends ;
1857
1856
const parentName = Array . isArray ( token ) ? token [ 0 ] ?. [ 0 ] ?. [ 0 ] : token ?. types ?. [ 0 ] ?. [ 0 ] ?. [ 0 ] ;
1858
1857
const parentJson = this . _jsDocJson ?. classes . find ( ( clas ) => clas . name === parentName ) ;
1859
1858
if ( parentJson ) {
1860
- if ( parentJson . props ?. find ( ( prop ) => prop . name === jsDoc . name ) ) {
1861
- return true ;
1862
- } else {
1863
- return this . _isInherited ( parentJson , jsDoc , containerKind ) ;
1864
- }
1859
+ return (
1860
+ parentJson . props ?. find ( ( prop ) => prop . name === propertyName ) ??
1861
+ this . _isInherited ( parentJson , propertyName , containerKind )
1862
+ ) ;
1865
1863
}
1866
1864
1867
1865
break ;
@@ -1873,13 +1871,15 @@ export class ApiModelGenerator {
1873
1871
const parentJsons = parentNames ?. map ( ( name ) =>
1874
1872
this . _jsDocJson ?. interfaces . find ( ( inter ) => inter . name === name ) ,
1875
1873
) ;
1874
+ if ( propertyName === 'content' ) console . log ( container . name , parentNames , parentJsons ) ;
1876
1875
if ( parentJsons ?. length ) {
1877
1876
for ( const parentJson of parentJsons ) {
1878
- if (
1879
- parentJson ?. props ?. find ( ( prop ) => prop . name === jsDoc . name ) ||
1880
- this . _isInherited ( parentJson as DocgenInterfaceJson , jsDoc , containerKind )
1881
- ) {
1882
- return true ;
1877
+ const result =
1878
+ parentJson ?. props ?. find ( ( prop ) => prop . name === propertyName ) ??
1879
+ this . _isInherited ( parentJson as DocgenInterfaceJson , propertyName , containerKind ) ;
1880
+
1881
+ if ( result ) {
1882
+ return result ;
1883
1883
}
1884
1884
}
1885
1885
}
@@ -1888,10 +1888,10 @@ export class ApiModelGenerator {
1888
1888
}
1889
1889
1890
1890
default :
1891
- console . log ( `Unexpected parent of type ${ containerKind } (${ container . name } ) of ${ jsDoc ?. name } ` ) ;
1891
+ console . log ( `Unexpected parent of type ${ containerKind } (${ container . name } ) of ${ propertyName } ` ) ;
1892
1892
}
1893
1893
1894
- return false ;
1894
+ return undefined ;
1895
1895
}
1896
1896
1897
1897
private _isReadonly ( astDeclaration : AstDeclaration ) : boolean {
0 commit comments