Skip to content

[Suggestion] Improve SelectSignature with 'keyof T' #20

@ribizli

Description

@ribizli
export interface SelectSignature<T = any> {
  <R>(key: keyof T, ...paths: string[]): Observable<R>;
  <R>(mapFn: (state: T) => R): Observable<R>;
}

So TypeScript can check for using the correct key at least on the top level:

export interface MyState {
  myKey: any
}

...

Store<MyState> store;

store.select('myKey'); // fine
store.select('invalidKey'); // type error

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