prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

Mark deprecated fields as deprecated #12

Closed seanlail closed 2 years ago

seanlail commented 2 years ago

Is your feature request related to a problem? Please describe.

I just noticed that some of the data that is returned is actually deprecated. e.g. "slugs" https://community.prismic.io/t/what-are-slugs/6493

Describe the solution you'd like

I don't know the full list of what is / is not deprecated but I think a @deprecated comment should be added to those fields.

Describe alternatives you've considered

Would be great to omit these deprecated types and adding a legacy: true flag in the config could include them?

angeloashmore commented 2 years ago

Hey @seanlail, great suggestion!

The slugs property is managed in @prismicio/types rather than this package. I updated @prismicio/types with a deprecation notice on the slugs property in this PR: https://github.com/prismicio/prismic-types/pull/36

I have not published the PR yet as I would like to bundle it with another fix in that package, but I will do so soon.

Once the updated version of @prismicio/types is published and updated in your project, the @deprecated tag should appear when using types generated by prismic-ts-codegen.

You can update to the latest version of @prismicio/types with the following command:

npm i --save-dev @prismicio/types@latest

I'll post here once the updated version is published.

Thanks again for the suggestion! 🙂

seanlail commented 2 years ago

Thanks @angeloashmore 👏

angeloashmore commented 2 years ago

The fix has been published in @prismicio/types@v0.1.28. For more details, see: https://github.com/prismicio/prismic-types/pull/36

You can update to the latest version of @prismicio/types (used by prismic-ts-codegen) with the following command:

npm i --save-dev @prismicio/types@latest/

Thanks!