I\'m creating a generic function to change the state.
The error message:
TS2345: Argument of type \'() => { [x:string]: string }\' is not assignable
Using types won't prevent the errors property from being changed as the type checking applies at compile time only. This will still run as plain old dynamic JavaScript when it gets to the browser where anything goes.
If you want to restrict the properties the change function acts on you need to check the property name e.g. against an array of allowed values.
As a side note your inputs are missing the name
property.
render() {
const { url, errors } = this.state;
return (