Similar to this in Javascript.
I have a React component that has an interface:
interface IState {
email: string,
passwordOne: string,
passwordTwo: string,
error: {}
}
class SignUpForm extends React.Component<{}, IState> {
constructor(props) {
super(props)
}
...
onChange = event => {
this.setState({ [event.target.name]: event.target.value });
};
...
<input type="email" placeholder="Your email address" name="email"
value={email} onChange={this.onChange}/>
...
The setState is complaining that Argument of type is not assignable to IState.
Is there a way to fix this, or is this not possible in TS?