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

fix(typescript-react-apollo): loosen defaultBaseOptions type #464

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

namoscato
Copy link
Contributor

Description

TypeScript React Apollo's defaultBaseOptions object values are currently restricted to string:

defaultBaseOptions?: { [key: string]: string };

but they can be any number of data types, i.e. ignoreResults is a boolean.

This loosens the type from string ➡️ any.

Related #463

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  1. configure an option with a non-string data type, i.e. ignoreResults:

    const config = {
        // ...
        defaultBaseOptions: {
            ignoreResults: true,
        }
    }
  2. see that this passes TypeScript compilation

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2023

🦋 Changeset detected

Latest commit: 8849976

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/typescript-react-apollo Patch

Not sure what this means? Click here to learn what changesets are.

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

@namoscato

This comment was marked as resolved.

@saihaj
Copy link
Collaborator

saihaj commented Oct 24, 2023

should we explicitly define the properties that can exist? and if not then we do any? example

defaultBaseOptions?: { ignoreResults?: boolean } & { [key: string]: any }; 

@saihaj
Copy link
Collaborator

saihaj commented Oct 24, 2023

I'm happy to add a changeset but not able to even install dependencies on this project at the moment, i.e.

we use yarn not npm

@namoscato

This comment was marked as outdated.

@namoscato
Copy link
Contributor Author

8849976 adds a few primitive options that seem like they could be overridden globally – open to suggestions on including more or less.

@dotansimha dotansimha requested a review from saihaj October 30, 2023 06:49
Copy link
Collaborator

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

thank you and sorry the delay

@saihaj saihaj merged commit fa53f8f into dotansimha:main Feb 2, 2024
@github-actions github-actions bot mentioned this pull request Feb 2, 2024
@namoscato namoscato deleted the loosen-defaultBaseOptions branch February 2, 2024 16:35
@saihaj
Copy link
Collaborator

saihaj commented Feb 2, 2024

Published @graphql-codegen/[email protected]

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.

2 participants