fix(compiler): don’t lower property accesses of exported symbols (#19301)
E.g. this allows the following to work: ``` @Decorator({ useValue: MyClass.someMethod }) class MyClass { static someMethod() {} } ``` PR Close #19301
This commit is contained in:
@ -54,6 +54,20 @@ describe('Expression lowering', () => {
|
||||
.toBeTruthy('did not find the useValue');
|
||||
});
|
||||
|
||||
it('should not request a lowering for useValue with a reference to a static property', () => {
|
||||
const collected = collect(`
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
provider: [{provide: 'someToken', useValue:◊value: MyClass.someMethod◊}]
|
||||
})
|
||||
export class MyClass {
|
||||
static someMethod() {}
|
||||
}
|
||||
`);
|
||||
expect(collected.requests.size).toBe(0);
|
||||
});
|
||||
|
||||
it('should request a lowering for useFactory', () => {
|
||||
const collected = collect(`
|
||||
import {Component} from '@angular/core';
|
||||
|
Reference in New Issue
Block a user