* Produce a `ts.Diagnostic` for a collision in re-export names between two directives/pipes.
( module: ClassDeclaration, refA: Reference<ClassDeclaration>, refB: Reference<ClassDeclaration>, )
| 789 | * Produce a `ts.Diagnostic` for a collision in re-export names between two directives/pipes. |
| 790 | */ |
| 791 | function reexportCollision( |
| 792 | module: ClassDeclaration, |
| 793 | refA: Reference<ClassDeclaration>, |
| 794 | refB: Reference<ClassDeclaration>, |
| 795 | ): ts.Diagnostic { |
| 796 | const childMessageText = `This directive/pipe is part of the exports of '${module.name.text}' and shares the same name as another exported directive/pipe.`; |
| 797 | return makeDiagnostic( |
| 798 | ErrorCode.NGMODULE_REEXPORT_NAME_COLLISION, |
| 799 | module.name, |
| 800 | ` |
| 801 | There was a name collision between two classes named '${refA.node.name.text}', which are both part of the exports of '${module.name.text}'. |
| 802 | |
| 803 | Angular generates re-exports of an NgModule's exported directives/pipes from the module's source file in certain cases, using the declared name of the class. If two classes of the same name are exported, this automatic naming does not work. |
| 804 | |
| 805 | To fix this problem please re-export one or both classes directly from this file. |
| 806 | `.trim(), |
| 807 | [ |
| 808 | makeRelatedInformation(refA.node.name, childMessageText), |
| 809 | makeRelatedInformation(refB.node.name, childMessageText), |
| 810 | ], |
| 811 | ); |
| 812 | } |
| 813 | |
| 814 | export interface DeclarationData { |
| 815 | ngModule: ClassDeclaration; |
no test coverage detected