Skip to content

[app-state] Make typing support selecting from optional objects #91

@eric-simonton-sama

Description

@eric-simonton-sama

E.g.

interface State {
  currentUser?: {
    name: string
  };
}

store('currentUser')('name');

Currently that causes a typescript error saying something like "never does not have a property 'name'". Instead make it work, and have the return type be Store<string | undefined>.

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