codelyzer: no-access-missing-member and async pipe

Hello,

I have no-access-missing-member error in my project when linting this template:

<div class="main-section" 
  [class.actionBarDisplayed]="(actionBarState$ | async).buttons.length > 0">
  <div class="main-content top-ease-in-out">
    <dashboard *ngIf="(context$ | async) == contextWrapper.dashboard"></dashboard>
    <command
      [init]="(onCommandPageStatus$ | async)" 
      *ngIf="(context$ | async) == contextWrapper.command">
    </command>
    <comp *ngIf="(context$ | async) == contextWrapper.comp"></comp>
  </div>
  <side-bar class="right-transition hidden">
  </side-bar>
</div>

I have error only when accessing async pipe in inputs (ngif is working fine). packages: “codelyzer”: “^2.0.0-beta.3”, “tslint”: “~4.0.0”, “typescript”: “2.0.3”

Do you have any idea?

Thanks,

Pierre

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

I will take a look at the issue today. Until then, let’s reopen it.

Having the exact same problem, something that made the error go away was changing things like this

(actionBarState$ | async).buttons.length

to

(actionBarState$ | async)?.buttons?.length

Though I think this might just be hiding the problem, or just preventing the rule from checking properly, so not really a long-term or good solution

Yes, I haven’t published the changes yet because they require a bit more work. I need to migrate to latest version of ngast and align to the changes in the template compiler of Angular.

Minko, I’m using 3.0.1. Should this issue be fixed with that version, or was this something you were waiting to tackle in 4.x? I ask because I’m still getting errors related to async pipe, as well as properties in a component superclass not being found:

ERROR: C:/Developer/Projects/app/user.component.html[14, 45]: The method "toggleSettings" that you're trying to access does not exist in the class declaration.
ERROR: C:/Developer/Projects/app/user.component.html[10, 32]: The property "async" that you're trying to access does not exist in the class declaration.
ERROR: C:/Developer/Projects/app/user.component.html[11, 37]: The property "async" that you're trying to access does not exist in the class declaration.

If you think this shouldn’t be happening, I can try to come up with a repro case.