I'm building a React Native app with TypeScript and React-Redux.
I connected my component using connect:
import { addTodo } from "../../redux/actions";
export interface Props {
addTodo: (todo: Todo) => void;
}
// ... component code
handleAdd = (todo: Todo) => {
const { addTodo, ... } = this.props; // ... = more destructuring
// some code ... eventually:
addTodo(todo);
}
export default connect(
mapStateToProps,
{ addTodo }
)(MyComponent);
The problem is now, that TSLint complains about a shadowed variable:
[tslint] Shadowed name: 'addTodo'
This feels like a mistake from TypeScript not recognizing React-Redux' functionality. I mean it's taught in the Redux docs to map dispatch to props this way.
Am I doing something wrong? Or do you have to do this differently when using TypeScript?