[Fixed] Angular: Unclear Why Intellij Produces Unresolved Variable Warning


I’m having a problem understanding why Intellij is producing an unresolved variable warning. I was hoping someone could explain why it happens.

I have an interface:

export interface Foo {
 property: string;

And an observable of that type in my component:

foo$: Observable<Foo>

ngOnInit() {
  this.foo$ = this._fooSvc.foo$;

The observable is retrieved from a service. The service declares the return type:

private _fooSubject: ReplaySubject<Foo>;

get foo$(): Observable<Foo> => {
  return _fooSubject.asObservable();

And i unwrap the observable in the template using the async pipe, where i get the warning:

[ngClass]="{my-class: (foo$ | async)?.fileName === null}"

So, i define a type and get an observable of that type in the component. I assign the component variable using a service method that declares a proper return type. Still get the warning.

What am i missing? Why do i get the "Unresolved variable fileName" warning in the template?


The issue is tracked at WEB-45419, please follow it for updates

Leave a Reply

(*) Required, Your email will not be published