File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -138,17 +138,21 @@ export class Context
138138 * @returns The type declaration of the given node.
139139 */
140140 getTypeAtLocation ( node :ts . Node ) :ts . Type {
141+ var nodeType :ts . Type ;
141142 try {
142- return this . checker . getTypeAtLocation ( node ) ;
143- } catch ( error ) {
144- try {
145- if ( node . symbol ) {
146- return this . checker . getDeclaredTypeOfSymbol ( node . symbol ) ;
147- }
148- } catch ( error ) { }
143+ nodeType = this . checker . getTypeAtLocation ( node ) ;
144+ } catch ( error ) {
149145 }
150-
151- return null ;
146+ if ( ! nodeType ) {
147+ if ( node . symbol ) {
148+ nodeType = this . checker . getDeclaredTypeOfSymbol ( node . symbol ) ;
149+ } else if ( node . parent && node . parent . symbol ) {
150+ nodeType = this . checker . getDeclaredTypeOfSymbol ( node . parent . symbol ) ;
151+ } else if ( node . parent && node . parent . parent && node . parent . parent . symbol ) {
152+ nodeType = this . checker . getDeclaredTypeOfSymbol ( node . parent . parent . symbol ) ;
153+ }
154+ }
155+ return nodeType ;
152156 }
153157
154158
You can’t perform that action at this time.
0 commit comments