Skip to content

Commit 731e3ea

Browse files
crisbetothePunderWoman
authored andcommitted
refactor(compiler-cli): broaden type of getPotentialImportsFor (angular#58627)
Currently the `getPotentialImportsFor` only accepts a `ClassDeclaration` as the context for generating an import, but that's not necessary because it doesn't require any class-specific information. These changes expand it to any `Node` so that it can be used when generating imports in testing declarations. PR Close angular#58627
1 parent 579f613 commit 731e3ea

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/compiler-cli/src/ngtsc/typecheck/api/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export interface TemplateTypeChecker {
169169
*/
170170
getPotentialImportsFor(
171171
toImport: Reference<ClassDeclaration>,
172-
inComponent: ts.ClassDeclaration,
172+
inContext: ts.Node,
173173
importMode: PotentialImportMode,
174174
): ReadonlyArray<PotentialImport>;
175175

packages/compiler-cli/src/ngtsc/typecheck/src/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker {
846846
private emit(
847847
kind: PotentialImportKind,
848848
refTo: Reference<ClassDeclaration>,
849-
inContext: ts.ClassDeclaration,
849+
inContext: ts.Node,
850850
): PotentialImport | null {
851851
const emittedRef = this.refEmitter.emit(refTo, inContext.getSourceFile());
852852
if (emittedRef.kind === ReferenceEmitKind.Failed) {
@@ -889,7 +889,7 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker {
889889

890890
getPotentialImportsFor(
891891
toImport: Reference<ClassDeclaration>,
892-
inContext: ts.ClassDeclaration,
892+
inContext: ts.Node,
893893
importMode: PotentialImportMode,
894894
): ReadonlyArray<PotentialImport> {
895895
const imports: PotentialImport[] = [];

0 commit comments

Comments
 (0)