@@ -2,7 +2,7 @@ import * as ts from 'typescript';
22import { GetDescriptor } from '../descriptor/descriptor' ;
33import { TypescriptHelper } from '../descriptor/helper/helper' ;
44import { TypescriptCreator } from '../helper/creator' ;
5- import { MockIdentifierGenericParameterIds , MockIdentifierGenericParameterValue } from '../mockIdentifier/mockIdentifier' ;
5+ import { MockIdentifierGenericCircularReference , MockIdentifierGenericParameterIds , MockIdentifierGenericParameterValue } from '../mockIdentifier/mockIdentifier' ;
66import { Scope } from '../scope/scope' ;
77import { IGenericDeclaration } from './genericDeclaration.interface' ;
88import { GenericDeclarationSupported } from './genericDeclarationSupported' ;
@@ -64,23 +64,33 @@ export function GenericDeclaration(scope: Scope): IGenericDeclaration {
6464 genericDescriptor ? TypescriptCreator . createFunctionExpression (
6565 ts . createBlock (
6666 [
67+ TypescriptCreator . createVariableStatement ( [
68+ TypescriptCreator . createVariableDeclaration ( MockIdentifierGenericCircularReference , ts . createIdentifier ( 'this' ) ) ,
69+ ] ) ,
6770 ts . createExpressionStatement (
6871 ts . createCall (
6972 ts . createPropertyAccess (
7073 ts . createIdentifier ( 'Object' ) ,
71- ts . createIdentifier ( 'assign ' ) ,
74+ ts . createIdentifier ( 'defineProperties ' ) ,
7275 ) ,
7376 undefined ,
7477 [
7578 ts . createIdentifier ( 'this' ) ,
76- genericDescriptor ,
79+ ts . createCall (
80+ ts . createPropertyAccess (
81+ ts . createIdentifier ( 'Object' ) ,
82+ ts . createIdentifier ( 'getOwnPropertyDescriptors' ) ,
83+ ) ,
84+ undefined ,
85+ [ genericDescriptor ]
86+ ) ,
7787 ]
7888 ) ,
7989 ) ,
8090 ] ,
8191 ) ,
8292 ) : ts . createPropertyAccess (
83- ts . createIdentifier ( 'this' ) ,
93+ MockIdentifierGenericCircularReference ,
8494 ts . createIdentifier ( 'constructor' ) ,
8595 ) ,
8696 undefined ,
0 commit comments