@@ -14,6 +14,13 @@ namespace ts {
1414 NoOriginalNode = 1 << 3 ,
1515 }
1616
17+ const nodeFactoryPatchers : ( ( factory : NodeFactory ) => void ) [ ] = [ ] ;
18+
19+ /* @internal */
20+ export function addNodeFactoryPatcher ( fn : ( factory : NodeFactory ) => void ) {
21+ nodeFactoryPatchers . push ( fn ) ;
22+ }
23+
1724 /**
1825 * Creates a `NodeFactory` that can be used to create and update a syntax tree.
1926 * @param flags Flags that control factory behavior.
@@ -161,11 +168,11 @@ namespace ts {
161168 createObjectLiteralExpression,
162169 updateObjectLiteralExpression,
163170 createPropertyAccessExpression : flags & NodeFactoryFlags . NoIndentationOnFreshPropertyAccess ?
164- ( expression , name ) => setEmitFlags ( createPropertyAccessExpression ( expression , name ) , EmitFlags . NoIndentation ) :
171+ ( expression : Expression , name : string | MemberName ) => setEmitFlags ( createPropertyAccessExpression ( expression , name ) , EmitFlags . NoIndentation ) :
165172 createPropertyAccessExpression ,
166173 updatePropertyAccessExpression,
167174 createPropertyAccessChain : flags & NodeFactoryFlags . NoIndentationOnFreshPropertyAccess ?
168- ( expression , questionDotToken , name ) => setEmitFlags ( createPropertyAccessChain ( expression , questionDotToken , name ) , EmitFlags . NoIndentation ) :
175+ ( expression : Expression , questionDotToken : QuestionDotToken | undefined , name : string | MemberName ) => setEmitFlags ( createPropertyAccessChain ( expression , questionDotToken , name ) , EmitFlags . NoIndentation ) :
169176 createPropertyAccessChain ,
170177 updatePropertyAccessChain,
171178 createElementAccessExpression,
@@ -534,7 +541,9 @@ namespace ts {
534541 liftToBlock,
535542 mergeLexicalEnvironment,
536543 updateModifiers,
537- } ;
544+ } as any ;
545+
546+ forEach ( nodeFactoryPatchers , fn => fn ( factory ) ) ;
538547
539548 return factory ;
540549
0 commit comments