File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ export const handleGet = (
88 transformList : Map < ts . Node , ts . Node >
99) => {
1010 // hash and move type argument to argument
11- const symbol = globalTypeChecker . getTypeAtLocation ( node . typeArguments ! [ 0 ] ) . getSymbol ( )
11+ const symbol = globalTypeChecker
12+ . getTypeAtLocation ( node . typeArguments ! [ 0 ] )
13+ . getSymbol ( ) ;
1214 const argument = ts . factory . createStringLiteral (
13- symbol ? hashSymbol (
14- symbol
15- ) : hashNode ( node . typeArguments ! [ 0 ] )
15+ symbol ? hashSymbol ( symbol ) : hashNode ( node . typeArguments ! [ 0 ] )
1616 ) ;
1717 const newNode = ts . factory . updateCallExpression (
1818 node ,
@@ -38,9 +38,12 @@ export const getFactoryDependencies = (factory: ts.Expression) => {
3838 . getSymbol ( ) ;
3939 if ( symbol && symbol === getSymbol ) {
4040 const classOrInterface = node . typeArguments ! [ 0 ] ;
41- const hash = hashSymbol (
42- globalTypeChecker . getTypeAtLocation ( classOrInterface ) . getSymbol ( ) !
43- ) ;
41+ const symbol = globalTypeChecker
42+ . getTypeAtLocation ( classOrInterface )
43+ . getSymbol ( ) ;
44+ const hash = symbol
45+ ? hashSymbol ( symbol )
46+ : hashNode ( node . typeArguments ! [ 0 ] ) ;
4447 dependencies . push ( hash ) ;
4548 }
4649 }
Original file line number Diff line number Diff line change 11import ts from "typescript" ;
22import { globalContext , globalTypeChecker } from "." ;
3- import { hashSymbol } from "./utils" ;
3+ import { hashNode , hashSymbol } from "./utils" ;
44
55export const defaultFactoryTemplate = (
66 className : string ,
@@ -132,9 +132,10 @@ export const factoryWrapperTemplate = (factory: ts.Expression) => {
132132 . getSymbol ( ) ;
133133 if ( symbol && symbol === getSymbol ) {
134134 const classOrInterface = node . typeArguments ! [ 0 ] ;
135- const hash = hashSymbol (
136- globalTypeChecker . getTypeAtLocation ( classOrInterface ) . getSymbol ( ) !
137- ) ;
135+ const classOrInterfaceSymbol = globalTypeChecker . getTypeAtLocation ( classOrInterface ) . getSymbol ( )
136+ const hash = classOrInterfaceSymbol
137+ ? hashSymbol ( classOrInterfaceSymbol )
138+ : hashNode ( classOrInterface ) ;
138139 const newNode = ts . factory . createCallExpression (
139140 ts . factory . createIdentifier ( "get" ) ,
140141 undefined ,
You can’t perform that action at this time.
0 commit comments