prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
153 stars 40 forks source link

fix: resolve TypeScript build error in projects using `--isolatedModules` #198

Closed alexandrutasica closed 7 months ago

alexandrutasica commented 7 months ago

Types of changes

Description

Fixing issue when using Next.JS with Typescript with the mandatory --isolatedModule set to true. This requires having all type exports as export type. The change also keeps the type export consistent with the index.ts type exports. Fixes: Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

Checklist:

🚘

alexandrutasica commented 7 months ago

@angeloashmore Noticed in a project of mine with Next.js, which requires --isolatedModule set to true, after updating to @prismicio/client v7. After the Migration Guide changes, Eslint returns errors for @prismicio/react:

Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

The change also keeps it consistent with index.ts for exporting types. Not a groundbreaking bugs, but surely will help others with the same issue.

angeloashmore commented 7 months ago

Thanks for the fix, @alexandrutasica!

This has been released in v2.7.3.