Platform: createFeatureSelector expects 1 type argument, documentation and example app show 2.

Created on 9 Jul 2018  路  2Comments  路  Source: ngrx/platform

Following the documentation here to use createFeatureSelector here:

https://github.com/ngrx/platform/blob/master/docs/store/selectors.md#createfeatureselector

I get an error:

ERROR in src/app/admin/reducers/index.ts(20,33): error TS2558: Expected 1 type arguments, but got 2.

But in the documention, we do have 2 type arguments being supplied:

export const selectFeature = createFeatureSelector<AppState, FeatureState>(
'feature'
);

Expected behavior:

I would expect that code present in the documenation and the example app to work fine.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

ngrx/store version: 6.0.1

Angular CLI: 6.0.8
Node: 8.11.3
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package Version

@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3

Other information:

I would be willing to submit a PR to fix this issue

[x] Yes (But I wouldn't know where to start)
[ ] No

Most helpful comment

Hi, this will be added in the next release of NgRx.
The documentation is based on the master branch.

To use createFeatureSelector now, you should do:

export const selectFeature = createFeatureSelector<FeatureState>('feature');

All 2 comments

Hi, this will be added in the next release of NgRx.
The documentation is based on the master branch.

To use createFeatureSelector now, you should do:

export const selectFeature = createFeatureSelector<FeatureState>('feature');

@tdeschryver thanks for the quick response !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shyamal890 picture shyamal890  路  3Comments

alvipeo picture alvipeo  路  3Comments

oxiumio picture oxiumio  路  3Comments

NathanWalker picture NathanWalker  路  3Comments

smorandi picture smorandi  路  3Comments