@@ -9,6 +9,10 @@ const currentDirectoryPath = process.cwd();
99const currentDirectoryParts = currentDirectoryPath . split ( path . sep ) ;
1010const currentDirectoryName =
1111 currentDirectoryParts [ currentDirectoryParts . length - 1 ] ;
12+
13+ type InterfaceOrTypeAliasDeclaration =
14+ | ts . TypeAliasDeclaration
15+ | ts . InterfaceDeclaration ;
1216export interface StringIndexedObject < T > {
1317 [ key : string ] : T ;
1418}
@@ -30,7 +34,7 @@ export interface PropItem {
3034 description : string ;
3135 defaultValue : any ;
3236 parent ?: ParentType ;
33- parents ?: ParentType [ ] ;
37+ declarations ?: ParentType [ ] ;
3438}
3539
3640export interface Method {
@@ -642,7 +646,7 @@ export class Parser {
642646 }
643647
644648 const parent = getParentType ( prop ) ;
645- const parents = getParentsType ( prop ) ;
649+ const parents = getDeclarations ( prop ) ;
646650 const declarations = prop . declarations || [ ] ;
647651 const baseProp = baseProps . find ( p => p . getName ( ) === propName ) ;
648652
@@ -665,7 +669,7 @@ export class Parser {
665669 description : jsDocComment . fullComment ,
666670 name : propName ,
667671 parent,
668- parents,
672+ declarations : parents ,
669673 required,
670674 type
671675 } ;
@@ -1142,7 +1146,7 @@ function isTypeLiteral(node: ts.Node): node is ts.TypeLiteralNode {
11421146 return node . kind === ts . SyntaxKind . TypeLiteral ;
11431147}
11441148
1145- function getParentsType ( prop : ts . Symbol ) : ParentType [ ] | undefined {
1149+ function getDeclarations ( prop : ts . Symbol ) : ParentType [ ] | undefined {
11461150 const declarations = prop . getDeclarations ( ) ;
11471151
11481152 if ( declarations === undefined || declarations . length === 0 ) {
@@ -1158,16 +1162,13 @@ function getParentsType(prop: ts.Symbol): ParentType[] | undefined {
11581162 continue ;
11591163 }
11601164
1161- type InterfaceOrTypeAlias =
1162- | ts . TypeAliasDeclaration
1163- | ts . InterfaceDeclaration ;
1164-
11651165 const parentName =
11661166 'name' in parent
1167- ? ( parent as InterfaceOrTypeAlias ) . name . text
1167+ ? ( parent as InterfaceOrTypeAliasDeclaration ) . name . text
11681168 : 'TypeLiteral' ;
1169+
11691170 const { fileName } = ( parent as
1170- | InterfaceOrTypeAlias
1171+ | InterfaceOrTypeAliasDeclaration
11711172 | ts . TypeLiteralNode ) . getSourceFile ( ) ;
11721173
11731174 parents . push ( {
@@ -1199,9 +1200,6 @@ function trimFileName(fileName: string) {
11991200 return trimmedFileName ;
12001201}
12011202
1202- /**
1203- * @deprecated
1204- */
12051203function getParentType ( prop : ts . Symbol ) : ParentType | undefined {
12061204 const declarations = prop . getDeclarations ( ) ;
12071205
0 commit comments