developit / developit/unistore

Type check error in Class based component

Open
#138 1 comment 0 reactions 0 assignees View on GitHub
question types
Dominant language
JavaScript
Stars
2.8k
Forks
134
PR merge metrics
No merged PRs in 30d

Description

This might be a basic Typescript question but I'm not sure.

I have a container component that is declared like this:
```
class Container extends Component {
// something
}

const mapStateToProps = ({ search }, { fieldType }) => ({
fieldSelected: search[fieldType],
});

const mapActionToProps = {
setSearchField: searchActions().setField,
};

export default connect(
mapStateToProps,
mapActionToProps
)(Container);
```

If I import it with extra props like this:
``
It throws a type error. I've noticed that changing to this works:
`connect<{}, {}, {}, {}>`

When using this format:
`const Container: ComponentClass = class extends Component`
the type error occurred here:
```
export default connect(
mapStateToProps,
mapActionToProps
)(Container) // <--
```

Feel free to close this if it is not related.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.