fix(ivy): let ngtsc unwrap expressions when resolving forwardRef
(#29886)
Previously, ngtsc would fail to resolve `forwardRef` calls if they contained additional parenthesis or casts. This commit changes the behavior to first unwrap the AST nodes to see past such insignificant nodes, resolving the issue. Fixes #29639 PR Close #29886
This commit is contained in:
@ -1570,6 +1570,8 @@ describe('ngtsc behavioral tests', () => {
|
||||
@ContentChild(forwardRef(() => TemplateRef)) child: any;
|
||||
|
||||
@ContentChild(forwardRef(function() { return ViewContainerRef; })) child2: any;
|
||||
|
||||
@ContentChild((forwardRef((function() { return 'parens'; }) as any))) childInParens: any;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -1579,6 +1581,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toMatch(contentQueryRegExp('TemplateRef', true));
|
||||
// match `i0.ɵɵcontentQuery(dirIndex, ViewContainerRef, true, null)`
|
||||
expect(jsContents).toMatch(contentQueryRegExp('ViewContainerRef', true));
|
||||
// match `i0.ɵɵcontentQuery(dirIndex, _c0, true, null)`
|
||||
expect(jsContents).toContain('_c0 = ["parens"];');
|
||||
expect(jsContents).toMatch(contentQueryRegExp('_c0', true));
|
||||
});
|
||||
|
||||
it('should compile expressions that write keys', () => {
|
||||
|
Reference in New Issue
Block a user