Typescript + React/Redux: Property "XXX" does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes Typescript + React/Redux: Property "XXX" does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes reactjs reactjs

Typescript + React/Redux: Property "XXX" does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes


So after reading through some related answers (specifically this one and this one and looking at @basarat's answer to the question, I managed to find something that works for me. It looks (to my relatively new React eyes) like Connect was not supplying an explicit interface to the container component, so it was confused by the prop that it was trying to pass.

So the container component stayed the same, but the child component changed a bit:

interface IChildComponentProps extends React.Props<any> {  ... (other props needed by component)}interface PassedProps extends React.Props<any> {  propToPass: any}class ChildComponent extends React.Component<IChildComponentProps & PassedProps, any> {  ...}....export default connect<{}, {}, PassedProps>(mapStateToProps, mapDispatchToProps)    (ChildComponent);

The above managed to work for me. Passing explicitly the props that the component is expecting from the container seemed to work and both components rendered properly.

NOTE: I know this is a very simplistic answer and I'm not exactly sure WHY this works, so if a more experienced React ninja wants to drop some knowledge on this answer I'd be happy to amend it.


Double check the newly added object types. When object type is not exactly as expected such error is thrown.

Ex. Type of props mentioned in component must match with type of props which are passed to that component.


Make your child Component extend React.Component with the type you want or "any" type. ex: "extends React.Component<any> {...}"

export class ChildComponent extends React.Component<T> { render() {  return (    <button className="square">      {this.props.value}    </button>  ); }}

In Parent component you could then pass the value, ex:

renderSquare(i: Number) { return <ChildComponent value={i}/>; }

Check https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/class_components/ for more info