I have some code using destructuring assignment as follows:
const { values: project, setValues, submitForm } = useFormikContext();
Per the TypeScript type assertion documentation I'd like to use the as keyword to tell the TS compiler that project will always be the type Project.
What's the correct syntax for this? I've tried:
const { values: (project as Project), setValues, submitForm } = useFormikContext();
but that's invalid.
You can use the following syntax to approach this:
You can create another variable, as well: