# Update custom types and legacy slices in a nextjs repository

**URL:** <https://community.prismic.io/t/update-custom-types-and-legacy-slices-in-a-nextjs-repository/16515>\
**Category:** Developing with Prismic\
**Tags:** nextjs, slice-machine\
**Created:** [August 17, 2024, 7:53am UTC](https://community.prismic.io/t/update-custom-types-and-legacy-slices-in-a-nextjs-repository/16515 "2024-08-17T07:53:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tudor2004](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tudor2004](https://community.prismic.io/u/tudor2004)\
**Post date:** [August 17, 2024, 7:53am UTC](https://community.prismic.io/t/update-custom-types-and-legacy-slices-in-a-nextjs-repository/16515/1 "2024-08-17T07:53:12Z")

</div>

I'm currently migrating a (pretty big) website from gatsby to nextjs using typescript. While this process is taking a few weeks/months I also have to maintain new feature requests on the old platform. Meaning, I need to modify existing slices that are still integrated with gatsby. This means I can not use the new slices and I need to keep the legacy slices until I finish with the next js migration.

My problem is that after updating an existing legacy slice inside a custom type I don't know how to pull the changes in the nextjs project.

1. I've tried to re-run `npx @slicemachine/init@latest` but the modified slices do not appear
2. Do I need to manually change the json structure in the `customtypes/article/index.json` file?
3. If I need to manually change the json, how can I regenerate the `prismicio-types.d.ts` file so that I use the changes in my typescript code?

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [August 20, 2024, 4:18pm UTC](https://community.prismic.io/t/update-custom-types-and-legacy-slices-in-a-nextjs-repository/16515/2 "2024-08-20T16:18:54Z")

</div>

Hello,

To address your issue, here are the steps you need to follow:

1. **Manually Update JSON Structure** :

2. **Regenerate TypeScript Types** :

This will load your models, convert them to TypeScript types, and save them to a TypeScript file in your project. By default, the output is saved to `types.generated.ts`.

For more detailed instructions, you can refer to the [prismic-ts-codegen Technical Reference - Documentation - Prismic](https://prismic.io/docs/technical-reference/prismic-ts-codegen).

If you have any further questions or need additional assistance, feel free to ask!
