Typescript with useFomik error on initialValues

Viewed 23

I'm new with typescript.

I cannot understand how to properly type my const formik. It cause an Error TS2322

What i'm missing?

  interface MyValues {
          initialValues: {
              id: number
          }
      }
      const formik: FormikProps<MyValues> = useFormik<MyValues>({
          initialValues:{id:1} // TS2322: Type '{ id: number; }' is not assignable to type 'MyValues'.
      });


0 Answers
Related