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

typescript@4.7 readiness (refine generic typings via extends) #4382

Merged
merged 5 commits into from Apr 13, 2022

Conversation

trevor-scheer
Copy link
Contributor

@trevor-scheer trevor-scheer commented Apr 11, 2022

Description

This PR was initially intended to be a reproduction of build errors caused by upgrading the TS version (to typescript@4.7.0-beta). This is now intended to be merged as-is, having resolved the build errors caused by upgrading to typescript@4.7.0-beta (followed by reverting the upgrade with no breakage).

The changes introduced in this PR bring this repo to typescript@4.7 compatible while maintaining the existing typescript version for now. In doing so, a lot of the generic typings have been refined, so this seems like a win-win.

I've gone through and resolved the build errors (seemed to mostly all be of the class of error mentioned in microsoft/TypeScript#48366). This seems ready to go if the maintainers agree with these changes.

Related #4381

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

This is possibly breaking if my changes affect the public API and if users are misusing the generics. To that end I would call this a patch/bug fix, but it's worth noting. Maybe this change is deserving of a changeset?

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Install typescript@4.7.0-beta on main, note build failures
  • Install typescript@4.7.0-beta on this branch, build succeeds
  • Revert typescript update on this branch, build succeeds

Test Environment:

  • OS: MacOS 12.12.1
  • @graphql-tools/...: latest
  • NodeJS: v16.5.0

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 and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@changeset-bot
Copy link

changeset-bot bot commented Apr 11, 2022

🦋 Changeset detected

Latest commit: cf00ff8

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

This PR includes changesets to release 28 packages
Name Type
@graphql-tools/delegate Patch
@graphql-tools/links Patch
@graphql-tools/git-loader Patch
@graphql-tools/url-loader Patch
@graphql-tools/stitch Patch
@graphql-tools/utils Patch
@graphql-tools/wrap Patch
@graphql-tools/batch-delegate Patch
@graphql-tools/stitching-directives Patch
@graphql-tools/prisma-loader Patch
federation-benchmark Patch
@graphql-tools/batch-execute Patch
@graphql-tools/graphql-tag-pluck Patch
@graphql-tools/import Patch
@graphql-tools/load Patch
@graphql-tools/merge Patch
@graphql-tools/mock Patch
@graphql-tools/node-require Patch
@graphql-tools/relay-operation-optimizer Patch
@graphql-tools/resolvers-composition Patch
@graphql-tools/schema Patch
@graphql-tools/apollo-engine-loader Patch
@graphql-tools/code-file-loader Patch
@graphql-tools/github-loader Patch
@graphql-tools/graphql-file-loader Patch
@graphql-tools/json-file-loader Patch
@graphql-tools/module-loader Patch
graphql-tools 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

@vercel
Copy link

vercel bot commented Apr 11, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/theguild/graphql-tools/FkhYnh7xkSnFGkwXpd6db7U6FGKt
✅ Preview: Failed

[Deployment for cf00ff8 failed]

@trevor-scheer trevor-scheer changed the title Attempt to install typescript@4.7.0-beta typescript@4.7 readiness (refine generic typings via extends) Apr 11, 2022
@ardatan
Copy link
Owner

ardatan commented Apr 13, 2022

Thank you @trevor-scheer!
Could you add changesets with yarn changeset so we can bump the versions?

@trevor-scheer
Copy link
Contributor Author

@ardatan done! Thanks 😄

@ardatan
Copy link
Owner

ardatan commented Apr 13, 2022

Thanks @trevor-scheer 🙏

@ardatan ardatan merged commit 0bbb176 into ardatan:master Apr 13, 2022
@trevor-scheer trevor-scheer deleted the typescript-4.7 branch April 13, 2022 16:45
trevor-scheer added a commit to apollographql/apollo-server that referenced this pull request Sep 23, 2022
…rs (#6940)

Similar to ardatan/graphql-tools#4382, but these
didn't turn up in the 4.7 upgrade.
Likely related to microsoft/TypeScript#49489.

Solution is to constrain our generics appropriately.
<!--
First, 🌠 thank you 🌠 for taking the time to consider a contribution to
Apollo!

Here are some important details to follow:

* ⏰ Your time is important
To save your precious time, if the contribution you are making will take
more
than an hour, please make sure it has been discussed in an issue first.
          This is especially true for feature requests!
* 💡 Features
Feature requests can be created and discussed within a GitHub Issue. Be
sure to search for existing feature requests (and related issues!) prior
to
opening a new request. If an existing issue covers the need, please
upvote
that issue by using the 👍 emote, rather than opening a new issue.
* 🔌 Integrations
Apollo Server has many web-framework integrations including Express,
Koa,
Hapi and more. When adding a new feature, or fixing a bug, please take a
peak and see if other integrations are also affected. In most cases, the
fix can be applied to the other frameworks as well. Please note that,
since new web-frameworks have a high maintenance cost, pull-requests for
new web-frameworks should be discussed with a project maintainer first.
* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.
* 📖 Contribution guidelines
Follow
https://github.com/apollographql/apollo-server/blob/main/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
          tests for all new behavior.
* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
your
pull request is meant to accomplish. Provide 🔗 links 🔗 to associated
issues!

We hope you will find this to be a positive experience! Open source
contribution can be intimidating and we hope to alleviate that pain as
much as possible. Without following these guidelines, you may be missing
context that can help you succeed with your contribution, which is why
we encourage discussion first. Ultimately, there is no guarantee that we
will be able to merge your pull-request, but by following these
guidelines we can try to avoid disappointment.
-->
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.

None yet

2 participants