fix(ngcc): support ModuleWithProviders functions that delegate (#36948)
In #36892 the `ModuleWithProviders` type parameter becomes required. This exposes a bug in ngcc, where it can only handle functions that have a specific form: ``` function forRoot() { return { ... }; } ``` In other words, it only accepts functions that return an object literal. In some libraries, the function instead returns a call to another function. For example in `angular-in-memory-web-api`: ``` InMemoryWebApiModule.forFeature = function (dbCreator, options) { return InMemoryWebApiModule_1.forRoot(dbCreator, options); }; ``` This commit changes the parsing of such functions to use the `PartialEvaluator`, which can evaluate these more complex function bodies. PR Close #36948
This commit is contained in:

committed by
Alex Rickabaugh

parent
e010f2ca54
commit
fafa50d97f
@ -78,7 +78,8 @@ function createTestRenderer(
|
||||
const decorationAnalyses =
|
||||
new DecorationAnalyzer(fs, bundle, host, referencesRegistry).analyzeProgram();
|
||||
const moduleWithProvidersAnalyses =
|
||||
new ModuleWithProvidersAnalyzer(host, referencesRegistry, true)
|
||||
new ModuleWithProvidersAnalyzer(
|
||||
host, bundle.src.program.getTypeChecker(), referencesRegistry, true)
|
||||
.analyzeProgram(bundle.src.program);
|
||||
const privateDeclarationsAnalyses =
|
||||
new PrivateDeclarationsAnalyzer(host, referencesRegistry).analyzeProgram(bundle.src.program);
|
||||
|
Reference in New Issue
Block a user