@@ -31,7 +31,7 @@ import {ArrayLiteralExpressionCodeGenerator} from "./code-generation/array-liter
3131import { ArrayLiteralExpression } from "typescript" ;
3232import { IfStatementCodeGenerator } from "./code-generation/if-statement" ;
3333import { CallExpressionCodeGenerator } from "./code-generation/call-expression" ;
34- import { StringLiteral } from "typescript " ;
34+ import { PropertyAccessExpressionCodeGenerator } from "./code-generation/property-access-expression " ;
3535
3636export function emitCondition (
3737 condition : ts . Expression ,
@@ -223,6 +223,19 @@ function buildFromPostfixUnaryExpression(
223223 }
224224}
225225
226+ function extractNameFromObjectType (
227+ type : ts . ObjectType
228+ ) : string {
229+ const name = < string > type . symbol . escapedName ;
230+
231+ if ( type . isClassOrInterface ( ) && type . typeParameters ) {
232+ return name + type . typeParameters . map ( ( typeParameter : ts . TypeParameter ) => {
233+ return < string > typeParameter . symbol . escapedName ;
234+ } ) . join ( '' ) ;
235+ }
236+
237+ return name ;
238+ }
226239
227240function mangleNameFromDeclaration (
228241 declaration : ts . SignatureDeclaration ,
@@ -233,7 +246,7 @@ function mangleNameFromDeclaration(
233246 const left = ctx . typeChecker . getTypeAtLocation ( declaration . parent ! ) as ts . ObjectType ;
234247
235248 return mangler . getMethodName (
236- < string > left . symbol . escapedName ,
249+ extractNameFromObjectType ( left ) ,
237250 < string > ( < ts . Identifier > declaration . name ) . escapedText ,
238251 declaration . parameters
239252 ) ;
@@ -243,7 +256,7 @@ function mangleNameFromDeclaration(
243256 const left = ctx . typeChecker . getTypeAtLocation ( declaration . parent ! ) as ts . ObjectType ;
244257
245258 return mangler . getMethodName (
246- < string > left . symbol . escapedName ,
259+ extractNameFromObjectType ( left ) ,
247260 < string > ( < any > declaration . name ) ,
248261 declaration . parameters
249262 ) ;
@@ -376,6 +389,8 @@ export function buildFromExpression(block: ts.Expression, ctx: Context, builder:
376389 switch ( block . kind ) {
377390 case ts . SyntaxKind . NewExpression :
378391 return new NewExpressionGenerator ( ) . generate ( < any > block , ctx , builder ) ;
392+ case ts . SyntaxKind . PropertyAccessExpression :
393+ return new PropertyAccessExpressionCodeGenerator ( ) . generate ( < any > block , ctx , builder ) ;
379394 case ts . SyntaxKind . Identifier :
380395 return buildFromIdentifier ( < any > block , ctx , builder ) ;
381396 case ts . SyntaxKind . NumericLiteral :
0 commit comments