import React, { Component } from \'react\';
import PropTypes from \'prop-types\';
import axios from \'axios\';
import { connect } from \'react-redux\';
IllusionMH posted this solution in this GitHub thread. You can add
/** @param {Record} props */
above the constructor function as follows:
class Example extends React.Component {
/** @param {Record} props */
constructor(props) {
super(props);
console.log(props.message);
console.log(this.props.message);
}
// ...
}
I am not a TypeScript expert so cannot explain exactly why it works, I assume there is a type definition somewhere that is not handling the constructor or super function correctly and the comment overrides it and tells Typescript to allow the super function to override it and accept the props parameter, similar to how !important
tells CSS to give a style precedence or //prettier-ignore
tells prettier to ignore the next line of code though I am sure someone more knowledgeable than myself can give a more detailed or accurate explanation.