store: 🐞[BUG]: Cannot assign @Select to private property

Affected Package

The issue is caused by package @ngxs/5.6.2

Is this a regression?

Yes, it worked just fine in 3.4.3

Description

A clear and concise description of the problem...

Using the @Select decorator to assign to private properties of another class results in this error:

Argument of type 'HelloComponent' is not assignable to parameter of type 'ComponentClass<any> & Record<"_name", Observable<string>>'.
  Type 'HelloComponent' is not assignable to type 'Record<"_name", Observable<string>>'.
    Property '_name' is private in type 'HelloComponent' but not in type 'Record<"_name", Observable<string>>'.

🔬 Minimal Reproduction

https://stackblitz.com/edit/ngxs-at-select-private-property?file=src%2Fapp%2Fhello.component.ts

Environment


Libs:
- @angular/core version: 8.2.4
- @ngxs/store version: 5.6.2
- Typescript version: 3.7.5

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Good news this has been addressed in NGXS v3.7, released last week. ( see https://dev.to/ngxs/announcing-ngxs-3-7-1kbk for release notes )

I will close this issue. Please let us know if it is not resolved.

While this is a difficult time, I will get to this problem soon

I have now completely concentrated my efforts on a new plugin that will improve working with states: https://github.com/ngxs-labs/data

Any update? I’ve got a large codebase that I’d like to upgrade to Angular 9, but this issue is blocking.

It is planned to implement a lot of functionality yet, but I hope to make a release at the end of this month

Thanks for the update! ngxs-labs/data looks very promising! Is there a release planned for the near future?