Skip to content

Commit e7ea016

Browse files
pmvaldpkozlowski-opensource
authored andcommitted
refactor(core): more accurate types for standalone component imports in deps tracker (#51309)
The standalone components import as passed to the deps tracker will be the raw import, i.e., it is either a Type or a module with providers or a factory of these. So we use the existing type `RawScopeInfoFromDecorator` for these imports instead of the current one to be more realistic. PR Close #51309
1 parent 8156128 commit e7ea016

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/core/src/render3/deps_tracker/deps_tracker.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {RuntimeError, RuntimeErrorCode} from '../../errors';
1111
import {Type} from '../../interface/type';
1212
import {NgModuleType} from '../../metadata/ng_module_def';
1313
import {getComponentDef, getNgModuleDef, isStandalone} from '../definition';
14-
import {ComponentType, NgModuleScopeInfoFromDecorator} from '../interfaces/definition';
14+
import {ComponentType, NgModuleScopeInfoFromDecorator, RawScopeInfoFromDecorator} from '../interfaces/definition';
1515
import {isComponent, isDirective, isNgModule, isPipe, verifyStandaloneImport} from '../jit/util';
1616
import {maybeUnwrapFn} from '../util/misc_utils';
1717

@@ -60,7 +60,7 @@ class DepsTracker implements DepsTrackerApi {
6060
}
6161

6262
/** @override */
63-
getComponentDependencies(type: ComponentType<any>, rawImports?: (Type<any>|(() => Type<any>))[]):
63+
getComponentDependencies(type: ComponentType<any>, rawImports?: RawScopeInfoFromDecorator[]):
6464
ComponentDependencies {
6565
this.resolveNgModulesDecls();
6666

@@ -213,9 +213,8 @@ class DepsTracker implements DepsTrackerApi {
213213
}
214214

215215
/** @override */
216-
getStandaloneComponentScope(
217-
type: ComponentType<any>,
218-
rawImports?: (Type<any>|(() => Type<any>))[]): StandaloneComponentScope {
216+
getStandaloneComponentScope(type: ComponentType<any>, rawImports?: RawScopeInfoFromDecorator[]):
217+
StandaloneComponentScope {
219218
if (this.standaloneComponentsScopeCache.has(type)) {
220219
return this.standaloneComponentsScopeCache.get(type)!;
221220
}
@@ -228,7 +227,7 @@ class DepsTracker implements DepsTrackerApi {
228227

229228
private computeStandaloneComponentScope(
230229
type: ComponentType<any>,
231-
rawImports?: (Type<any>|(() => Type<any>))[]): StandaloneComponentScope {
230+
rawImports?: RawScopeInfoFromDecorator[]): StandaloneComponentScope {
232231
const ans: StandaloneComponentScope = {
233232
compilation: {
234233
// Standalone components are always able to self-reference.

0 commit comments

Comments
 (0)