eddeee888 / graphql-code-generator-plugins

List of GraphQL Code Generator plugins that complements the official plugins.
MIT License
51 stars 12 forks source link

feat: add support for typescript types-prefix opt #78

Closed polRk closed 4 months ago

polRk commented 1 year ago

Fix: #77, #76

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 38a065788aa6efab98e37058e20e088ff2453731

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

polRk commented 1 year ago

/release-snapshot

github-actions[bot] commented 1 year ago

❌ No permission to release snapshot

eddeee888 commented 1 year ago

Hi @polRk, thanks for the PR.

Can you help me understand why you'd like this feature implemented please? :)

polRk commented 1 year ago

Hi @polRk, thanks for the PR.

Can you help me understand why you'd like this feature implemented please? :)

For typescript. Nothing works without the right types

eddeee888 commented 1 year ago

Sorry, I should have been clearer here.

What about the default interfaces/types naming does not work for you? Is the type prefix needed because of your code standard? e.g. all interfaces must have I prefix

I'm thinking to limit the options that can be passed in through typesPluginsConfig to keep the preset lean. Especially options around interfaces/types naming. typesPrefix is one of them.

polRk commented 1 year ago

All our types use the prefix I. We have many identical by name entities and prefix generation is the only right option to solve typescripts issues

eddeee888 commented 1 year ago

All our types use the prefix I

Does this apply to just the generation types or all types in your project?

We have many identical by name entities

One of the main goal of this project is to do all the heavy lifting with types so you don't have to do any manual imports. One way to think about it is the generated types are internal. Do you find yourself needing to import from the generated types file? Would it be possible to give me an example please?

eddeee888 commented 4 months ago

This is now fixed in v0.10