Skip to content

Provider API breaks strict typing #290

Closed
@mohsen1

Description

@mohsen1

The Provider API magically provides props for a component that requires those props. For example if we have a regular React code before provider is used like this:

const todos = [];
render(<App todos={todos} />, document.body)

After using Provider we change it to following:

render(<Provider store={store}><App /></Provider>, document.body)

this is not a problem in regular JS or JSX, but when I use TypeScript, the compiler complains that App requires required prop todos. Of course I can make it an optional property but that's not optimal.

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