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:
JoostK
2019-04-13 18:28:27 +02:00
committed by Ben Lesh
parent 725148a44d
commit 83291f01b0
2 changed files with 7 additions and 0 deletions

View File

@ -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', () => {