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

Add |undefined in the TypedDocumentString constructor to make it work with --isolatedDeclarations #10160

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

jyasskin
Copy link
Contributor

@jyasskin jyasskin commented Oct 3, 2024

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

(Sorry, this seemed simple enough that the discussion may as well happen here. Feel free to reject it if this is the wrong fix or you don't want to support --isolatedDeclarations.)

Description

Without this, building the generated types into a project that uses --isolatedDeclarations fails with

Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.

Type of change

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

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

  • yarn build && yarn test
  • Manually made this change in the generated code in my project and checked that it fixed the error.

I haven't rebuilt my code with the updated library to make sure that this change makes the change I expect to the generated code.

Test Environment:

  • OS: https://en.wikipedia.org/wiki/GLinux
  • "@graphql-codegen/client-preset": "^4.3.3",
  • "@graphql-codegen/typescript": "^4.0.9",
  • "@graphql-codegen/typescript-document-nodes": "^4.0.9",
  • "typescript": "^5.6.2"
  • NodeJS: 22

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

… with --isolatedDeclarations

Without this, tsc gives the error:
"Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations."
Copy link

changeset-bot bot commented Oct 3, 2024

🦋 Changeset detected

Latest commit: 69562a4

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/typed-document-node 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

jyasskin added a commit to w3ctag/w3ctagbot that referenced this pull request Oct 3, 2024
This also fixes most of the issues for passing --isolatedDeclarations except for
dotansimha/graphql-code-generator#10160 and
microsoft/TypeScript#58262.
.changeset/twenty-spiders-sell.md Outdated Show resolved Hide resolved
@saihaj saihaj added the waiting-for-answer Waiting for answer from author label Oct 8, 2024
Co-authored-by: Denis Badurina <badurinadenis@gmail.com>
@jyasskin
Copy link
Contributor Author

I made that change.

@enisdenjo enisdenjo merged commit c7af639 into dotansimha:master Oct 11, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-answer Waiting for answer from author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants