Skip to content

@select decorator error: property has no initializer and is not definitely assigned in the constructor. #560

@ildar-icoosoft

Description

@ildar-icoosoft

This is a...

  • feature request
  • [*] bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • [*] @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

Environment

NodeJS Version: v8.12.0
Typescript Version: 3.1.6
Angular Version: 7.2.7
@angular-redux/store version: 9.0.0
@angular/cli version: (if applicable) 7.2.4
OS: windows 7

I have tsconfig with the following settings

{
  ...
  "compilerOptions": {
    ...
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    ...
  }
  ...
}

these are very useful settings, but they don't work with @select() decorator.
For example:

@Component({
  selector: "app-root",
  templateUrl: "app.component.html"
})
export class AppComponent {
  @select()
  private entities$: Observable<IReduxEntities>;
}

This code causes error:
Property 'entities$' has no initializer and is not definitely assigned in the constructor.

I know that I can use ngRedux.select(['entities']); instead of @select decorator. But it would be great if @select() decorator worked with my tsconfig

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions