Our title
, slug
, and markdown
currently have a TypeScript warning on them because they can be of the value FormDataEntryValue
or null
.
To handle this error, we are going to be using invariant
from tiny-invariant to throw warnings if the data being passed isn't a string.
We are also going to type our errors
down in our JSX so they aren't just of type any
.
To do this, we type the errors
variable as ActionData
which will take the title
, slug
, and markdown
as types.