I used history.push
to redirect to my desired url and passed an information via the included state to the next route like this:
const history = useHistory()
history.push({
pathname: '/someurl/',
state: {
foo: bar
}
})
and in JavaScript this worked absolutely as expected. Now I am migrating this file to TypeScript and I am getting the following error:
Argument of type '{ pathname: string; state: { foo: bar; }; }'
is not assignable to parameter of type 'To'.
Object literal may only specify known properties, and
'state' does not exist in type 'PartialPath'
For some reason he thinks that I only pass a pathname without a state right? Does anyone know how to fix that?