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

Generated fragment-masking.ts is not compatible with noUncheckedIndexedAccess on upcoming RC #9383

Closed
2snEM6 opened this issue May 10, 2023 · 1 comment
Labels
stage/5-alpha-release-testing The pull request is merged, an alpha release is available, to be tested

Comments

@2snEM6
Copy link

2snEM6 commented May 10, 2023

Which packages are impacted by your issue?

No response

Describe the bug

As I mentioned here: #9196 (comment) (#9196)

if an user has noUncheckedIndexedAccess set to true on their tsconfig, then fields might be undefined, causing type checking to fail.

Code is here: https://github.com/dotansimha/graphql-code-generator/pull/9196/files/7ad08f56be5ff8d0ee7c93250c5988cb3fed2ea4#diff-f6309550f61b610a24949b53525e396490f4af6dbcc264d82cb6bfd3ea9ea8a8R51

Your Example Website or App

https://github.com/dotansimha/graphql-code-generator/pull/9196/files/7ad08f56be5ff8d0ee7c93250c5988cb3fed2ea4#diff-f6309550f61b610a24949b53525e396490f4af6dbcc264d82cb6bfd3ea9ea8a8R51

Steps to Reproduce the Bug or Issue

  1. Run type checking with tsconfig noUncheckedIndexedAccess on against Add @defer directive support #9196 (comment)
  2. Watch TS complain about possible undefined index access for the fields variable

Expected behavior

fields variable should be checked for undefined/null values

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • NodeJS: [e.g. 18.5.0]
  • graphql version: [e.g. 16.3.0]
  • @graphql-codegen/* version(s): [e.g. 2.6.2]

Codegen Config File

No response

Additional context

No response

@saihaj saihaj added the stage/5-alpha-release-testing The pull request is merged, an alpha release is available, to be tested label May 12, 2023
@beerose
Copy link
Contributor

beerose commented May 15, 2023

Fixed in #9385

@beerose beerose closed this as completed May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/5-alpha-release-testing The pull request is merged, an alpha release is available, to be tested
Projects
None yet
Development

No branches or pull requests

3 participants