File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,22 @@ export function parse(opts: DocsParseOptions) {
45
45
} ) ;
46
46
47
47
return ( api : string ) => {
48
- const apiInterface = interfaces . find ( i => i . name === api ) || null ;
48
+ let apiInterface = interfaces . find ( i => i . name === api ) || null ;
49
+
50
+ /**
51
+ * Add methods of import(many is used in `extends`)
52
+ */
53
+ const allImportObject = interfaces
54
+ . filter ( i => apiInterface ?. importObject . includes ( i . name ) && i . name !== api )
55
+ . map ( i => i . importObject ) ;
56
+
57
+ const otherMethod = interfaces
58
+ . filter ( i => [ ...new Set ( allImportObject . flat ( ) ) ] . includes ( i . name ) )
59
+ . map ( d => d . methods ) || null ;
60
+
61
+ if ( apiInterface !== null && otherMethod && otherMethod . length > 0 ) {
62
+ apiInterface . methods = [ ...new Set ( apiInterface ?. methods . concat ( otherMethod . flat ( 1 ) ) ) ] ;
63
+ }
49
64
50
65
const data : DocsData = {
51
66
api : apiInterface ,
@@ -173,13 +188,17 @@ function getInterface(
173
188
const symbol = typeChecker . getSymbolAtLocation ( node . name ) ;
174
189
const docs = symbol ? serializeSymbol ( typeChecker , symbol ) : null ;
175
190
191
+ // @ts -ignore
192
+ const importObject = node . parent ?. locals ?. keys ( ) || [ ]
193
+
176
194
const i : DocsInterface = {
177
195
name : interfaceName ,
178
196
slug : slugify ( interfaceName ) ,
179
197
docs : docs ?. docs || '' ,
180
198
tags : docs ?. tags || [ ] ,
181
199
methods,
182
200
properties,
201
+ importObject : [ ...importObject ] . filter ( ( d : string ) => d !== interfaceName )
183
202
} ;
184
203
185
204
return i ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export interface DocsInterface {
20
20
tags : DocsTagInfo [ ] ;
21
21
methods : DocsInterfaceMethod [ ] ;
22
22
properties : DocsInterfaceProperty [ ] ;
23
+ importObject : string [ ] ;
23
24
}
24
25
25
26
export interface DocsEnum {
You can’t perform that action at this time.
0 commit comments