prismicio / prismic-ts-codegen

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

Allow to disable `prismicio-types.d.ts` file generation via slicemachine options #52

Closed psoaresbj closed 1 year ago

psoaresbj commented 1 year ago

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

Not using TS in one of my projects (and there's a lot of customTypes and slices), however, prismicio-types.d.ts it's being created, which makes me delete the file every opened PR or ignore him in .gitignore, .eslintignore, etc. But the major problem is that's taking too long to save to file system. I know there's already being addressed the performance issue in #51 however, should be perfect, just to allow an option on slicemachine.config.json to not create the prismicio-types.d.ts file.

Locally, we have to fork and add an early return in the generation function.

Describe the solution you'd like

angeloashmore commented 1 year ago

Hi @psoaresbj, we would prefer keeping type generation enabled for all projects, even ones not using TypeScript. The types will continue to work in JavaScript projects since language server-enabled editors, like VS Code, use the TypeScript server to handle autocomplete.

Since you opened this issue, we changed how types are generated, resulting in 1000x-4600x faster type generation (see this PR).

Could you update to the latest version of Slice Machine and @slicemachine/adapter-next and try it again?

If the type generation is still a blocker for you, please let us know and we can reconsider.