Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option for default modifier for v10 types #345

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

johannessjoberg
Copy link

@johannessjoberg johannessjoberg commented May 29, 2024

If you create your contentful client with an option like contentful.createClient({ ... }).withoutUnresolvableLinks and reuse it everywhere, it would improve DX to be able to use TypeTest directly instead of explicitly stating TypeTest<'WITHOUT_UNRESOLVABLE_LINKS'> or using TypeTestWithoutUnresolvableLinksResponse.

This PR adds a default modifier option to achieve that.

@johannessjoberg johannessjoberg force-pushed the add-default-modifier-option branch from 178ef78 to dbd9ddd Compare May 29, 2024 12:37
@johannessjoberg
Copy link
Author

@marcolink What are your thoughts on these changes?

@johannessjoberg
Copy link
Author

Bump

@zkeetonev
Copy link

@marcolink Would love to see this get merged as it doesn't make sense to repeat this for every usage of the generated types.

@johannessjoberg Should WITH_ALL_LOCALES be added as an option as well? I would also like it if no value is provided to the --modifier flag, then it could just use undefined as a default (Modifiers extends ChainModifiers = undefined).

Copy link
Collaborator

@marcolink marcolink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

I have added a comment. Overall this looks straight forward and valuable 👍

@@ -31,6 +31,7 @@ class ContentfulMdg extends Command {
jsdoc: Flags.boolean({ char: 'd', description: 'add JSDoc comments' }),
typeguard: Flags.boolean({ char: 'g', description: 'add type guards' }),
response: Flags.boolean({ char: 'r', description: 'add response types' }),
modifier: Flags.string({ char: 'm', description: 'add default modifier (v10 only)' }),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we:

  • allow all possible modifiers
  • allow an array of modifiers to also support combinations?

@marcolink
Copy link
Collaborator

cc @johannessjoberg

@johannessjoberg
Copy link
Author

Thanks for feedback @marcolink ! I'm not with Milkywire now and not actively using this package. Ping @andreaspalsson @hannasctyden @ekling to take over from here :)

@marcolink
Copy link
Collaborator

TL;DR I have a branch with my suggested way forward that I will push if there is no action on this PR in the next days!

@andreaspalsson
Copy link

TL;DR I have a branch with my suggested way forward that I will push if there is no action on this PR in the next days!

@marcolink Please feel free to push it. I don't think we will have the bandwidth to update this with support for more modifiers in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants