Skip to content

createStore should perhaps accept preloadedState: PreloadedState<S> | S #3672

Closed
@abirmingham

Description

@abirmingham

At least as of 4.0.5, createStore accepts preloadedState: PreloadedState<S>. One imagines that one can pass S to preloadedState, and in most cases this is correct. However, there are cases in which S is not assignable to PreloadedState<S>, at least since typescript@3.6.3. See microsoft/TypeScript#35992 for more information on this issue. It's unclear to me whether microsoft/TypeScript#35992 is a typescript bug, but I'm wondering if createStore should accept preloadedState: PreloadedState<S> | S, which would mitigate the issue of branded types being mapped to never.

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