Skip to content

createSelector type error with selectIds from .adapter.getSelectors() #525

@herkulano

Description

@herkulano

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

What is the current behavior?

Adding a selector with selectIds from .adapter.getSelectors() throws a type error.

Using the example-app:

export const {
  selectIds: getBookIds,
  selectEntities: getBookEntities,
  selectAll: getAllBooks,
  selectTotal: getTotalBooks
} = fromBooks.adapter.getSelectors(getBookEntitiesState)

const selectTest = createSelector(
  getBookIds,
  getBookEntities,
  (ids, entities) => {
    return { ids, entities }
  }
)

Error:

/platform-master/example-app/app/books/reducers/index.ts (97,3): Argument of type '((state: object) => number[]) | ((state: object) => string[])' is not assignable to parameter of type 'Selector<object, number[]>'.
  Type '(state: object) => string[]' is not assignable to type 'Selector<object, number[]>'.
    Type 'string[]' is not assignable to type 'number[]'.
      Type 'string' is not assignable to type 'number'.

Version of affected browser(s),operating system(s), npm, node and ngrx:

@ngrx/entity 4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions