fix(ivy): ngcc - properly handle aliases class expressions (#29119)
In ES2015, classes could have been emitted as a variable declaration initialized with a class expression. In certain situations, an intermediary variable suffixed with `_1` is present such that the variable declaration's initializer becomes a binary expression with its rhs being the class expression, and its lhs being the identifier of the intermediate variable. This structure was not recognized, resulting in such classes not being considered as a class in `Esm2015ReflectionHost`. As a consequence, the analysis of functions/methods that return a `ModuleWithProviders` object did not take the methods of such classes into account. Another edge-case with such intermediate variable was that static properties would not be considered as class members. A testcase was added to prevent regressions. Fixes #29078 PR Close #29119
This commit is contained in:
@ -317,11 +317,11 @@ export interface Import {
|
||||
* The declaration of a symbol, along with information about how it was imported into the
|
||||
* application.
|
||||
*/
|
||||
export interface Declaration {
|
||||
export interface Declaration<T extends ts.Declaration = ts.Declaration> {
|
||||
/**
|
||||
* TypeScript reference to the declaration itself.
|
||||
*/
|
||||
node: ts.Declaration;
|
||||
node: T;
|
||||
|
||||
/**
|
||||
* The absolute module path from which the symbol was imported into the application, if the symbol
|
||||
|
@ -25,7 +25,7 @@ export function isFromDtsFile(node: ts.Node): boolean {
|
||||
if (sf === undefined) {
|
||||
sf = ts.getOriginalNode(node).getSourceFile();
|
||||
}
|
||||
return sf !== undefined && D_TS.test(sf.fileName);
|
||||
return sf !== undefined && sf.isDeclarationFile;
|
||||
}
|
||||
|
||||
export function nodeNameForError(node: ts.Node & {name?: ts.Node}): string {
|
||||
|
Reference in New Issue
Block a user