graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

Declare fieldNodes always has at least 1 FieldNode

Open mattkrick opened this issue 3 years ago • 2 comments

fieldNodes will never be an empty array.

// Before
const node = info.fieldNodes[0] // undefined | FieldNode

// After
const node = info.fieldNodes[0] // FieldNode

This is helpful when noUncheckedIndexAccess is turned on.

mattkrick avatar Feb 17 '22 23:02 mattkrick

CLA Signed

The committers are authorized under a signed CLA.

  • :white_check_mark: Matt Krick (c61e65575380a087ee8c17496e65c29a9135d742)

The latest changes of this PR are available on NPM as graphql@16.3.0-canary.pr.3504.7c7b6ed1e17e6cf5e114f1a89a24d289fb969aff Note: no gurantees provided so please use your own discretion.

Also you can depend on latest version built from this PR: npm install --save graphql@canary-pr-3504

github-actions[bot] avatar Feb 18 '22 19:02 github-actions[bot]