For sanity types create first the schema in the Sanity Studio with:
npx sanity schema extract --enforce-required-fields
copy it into this project and then run the following command for creating the types including the groq queries:
npx sanity typegen generate