File tree Expand file tree Collapse file tree 3 files changed +26
-13
lines changed
Expand file tree Collapse file tree 3 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -290,19 +290,24 @@ export function getTypeNamespaces(type: ts.Type): string[] {
290290 return [ ] ;
291291 }
292292
293+ if ( symbol . name === '__function' || symbol . name === '__type' ) {
294+ return [ ] ;
295+ }
296+
297+ const declaration = symbol . valueDeclaration ?? symbol . declarations ?. [ 0 ] ;
298+ if ( ! declaration ) {
299+ return [ ] ;
300+ }
301+
293302 const namespaces : string [ ] = [ ] ;
294- let currentSymbol : ts . Symbol | undefined = symbol . parent ;
303+ let currentDeclaration : ts . Node = declaration . parent ;
295304
296- while ( currentSymbol ) {
297- if (
298- currentSymbol &&
299- currentSymbol . valueDeclaration &&
300- ts . isModuleDeclaration ( currentSymbol . valueDeclaration )
301- ) {
302- namespaces . unshift ( currentSymbol . name ) ;
305+ while ( currentDeclaration != null && ! ts . isSourceFile ( currentDeclaration ) ) {
306+ if ( ts . isModuleDeclaration ( currentDeclaration ) ) {
307+ namespaces . unshift ( currentDeclaration . name . getText ( ) ) ;
303308 }
304309
305- currentSymbol = currentSymbol . parent ;
310+ currentDeclaration = currentDeclaration . parent ;
306311 }
307312
308313 return namespaces ;
Original file line number Diff line number Diff line change 111111 "type" : {
112112 "kind" : " object" ,
113113 "name" : " State" ,
114- "parentNamespaces" : [],
114+ "parentNamespaces" : [
115+ " BaseUIComponent"
116+ ],
115117 "properties" : [
116118 {
117119 "name" : " state" ,
243245 "type" : {
244246 "kind" : " object" ,
245247 "name" : " State" ,
246- "parentNamespaces" : [],
248+ "parentNamespaces" : [
249+ " BaseUIComponent"
250+ ],
247251 "properties" : [
248252 {
249253 "name" : " state" ,
Original file line number Diff line number Diff line change 152152 "type" : {
153153 "kind" : " object" ,
154154 "name" : " Params" ,
155- "parentNamespaces" : [],
155+ "parentNamespaces" : [
156+ " functionAndNamespaceDeclaration"
157+ ],
156158 "properties" : [
157159 {
158160 "name" : " a" ,
183185 "returnValueType" : {
184186 "kind" : " reference" ,
185187 "name" : " Element" ,
186- "parentNamespaces" : []
188+ "parentNamespaces" : [
189+ " JSX"
190+ ]
187191 }
188192 }
189193 ]
You can’t perform that action at this time.
0 commit comments