Repository navigation
chore: enable strict: true in root tsconfig (#4683) - #10985
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 47073b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
1 task done
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
September 25, 2026 00:19
266a52f to
21ea63c
Compare
1 task done
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
September 25, 2026 00:41
21ea63c to
1d0201e
Compare
1 task done
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
September 25, 2026 04:42
1d0201e to
9ff658e
Compare
This was referenced Sep 25, 2026
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
2 times, most recently
from
September 27, 2026 01:16
7ba78a6 to
1d22471
Compare
This was referenced Sep 27, 2026
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
September 30, 2026 13:38
1d22471 to
5109be7
Compare
1 task done
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
October 1, 2026 14:44
5109be7 to
0823873
Compare
This was referenced Oct 1, 2026
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
October 3, 2026 14:28
0823873 to
b235510
Compare
4 tasks done
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
October 5, 2026 15:16
b235510 to
c957623
Compare
Merged
4 tasks done
Replace the individual strictness flags (`alwaysStrict`, `noImplicitThis`, `noImplicitAny: false`, `strictNullChecks: false`) with `strict: true`. `tsc --noEmit` now reports 351 type errors across packages/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PjJDfAYR1JPdgiQRvvZZy eddeee888:oss:issue-verify
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
October 5, 2026 22:17
c957623 to
f5bf60b
Compare
Contributor
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/cli |
7.4.6-alpha-20261008132314-47073b09d2e11862a2b11d2ea790789b5f32c7be |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.2.10-alpha-20261008132314-47073b09d2e11862a2b11d2ea790789b5f32c7be |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.1.2-alpha-20261008132314-47073b09d2e11862a2b11d2ea790789b5f32c7be |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.2.3-alpha-20261008132314-47073b09d2e11862a2b11d2ea790789b5f32c7be |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
6.1.3-alpha-20261008132314-47073b09d2e11862a2b11d2ea790789b5f32c7be |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/testing |
5.0.6-alpha-20261008132314-47073b09d2e11862a2b11d2ea790789b5f32c7be |
npm ↗︎ unpkg ↗︎ |
eddeee888
force-pushed
the
claude/eager-lovelace-zw9wiy
branch
from
October 8, 2026 13:07
2b2c169 to
be0e44c
Compare
strict: true in root tsconfig (failing) (#4683)strict: true in root tsconfig (#4683)
graphql 15 types Maybe<T> as T | null | undefined, so the CI matrix's graphql 15 build hits three strict errors that 16/17 don't: - getPossibleTypes accepts null, which schema.getType() returns on 15 - includeIntrospectionTypesDefinitions skips getNamedType when the field type is missing - graphql-modules preset checks schemaAst.extensions before reading sources Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR turns on
strict: truein the roottsconfig.json, sotypes:checkandpnpm buildnow compile every package understrictNullChecks,noImplicitAnyandstrictPropertyInitialization. The per-package PRs listed below fixed the strict errors onmasterfirst, ending with #11039. The only source changes here are three small fixes for graphql 15: its typings makeMaybe<T>T | null | undefined, so CI's graphql 15 unit-test jobs hit strict errors that 16 and 17 don't.strict: truecompiler option #4683 that was expected to fail typechecking (351 errors at the start), and tracked the per-package fix PRs. All of them have merged, so it's now mergeable.stricton in the root config stops new code from reintroducing the errors.Changes:
tsconfig.json: addedstrict: true; removedalwaysStrict: trueandnoImplicitThis: true, whichstrictalready turns on; removednoImplicitAny: falseandstrictNullChecks: false, which opted out of strict checks.noImplicitAny,strictNullChecks, andstrictPropertyInitialization(which only takes effect oncestrictNullChecksis on). TypeScript 6 already turns the otherstrictflags on by default.getPossibleTypes(visitor-plugin-common) acceptsnull, whichschema.getType()returns on graphql 15. It already returned[]for it.includeIntrospectionTypesDefinitions(typescript) only callsgetNamedTypewhen the field has a type.graphql-modulespreset checksschemaAst.extensionsbefore readingsources, since it's nullable on graphql 15..changeset/strict-root-tsconfig.md:patchfor the 6 packages whose published declarations or behavior change. Compiling withstrictNullCheckschanges some inferred types in the published declarations:@graphql-codegen/cli:mkdirpreturnsPromise<string | undefined>; therequire(-r) option'sdefaultis typednever[]instead ofany[].@graphql-codegen/visitor-plugin-common:SchemaDefinition()/SchemaExtension()onBaseResolversVisitorandBaseTypesVisitorreturnnullinstead ofany;BaseSelectionSetProcessor.typeCacheis keyed byLocation | undefined;SelectionSetToObject.buildSelectionSet'stypeInfocan benull;getPossibleTypesacceptsnull;removeDescriptionreturns nodes withdescription: undefinedinstead ofany.@graphql-codegen/typescript:TsIntrospectionVisitor's constructor takespluginConfigasTypeScriptPluginConfig | undefined,DirectiveDefinition()returnsnull, andObjectTypeDefinition()returnsstring | null.@graphql-codegen/client-preset: the babel preset acceptsoptionsasClientBabelPresetOptions | null | undefined.@graphql-codegen/testing:mockGraphQLServerreturnsnock.Scope | null.@graphql-codegen/graphql-modules-preset: a schema withoutextensions(graphql 15) throws the "requires to use GraphQL SDL" error instead of aTypeError.Related #4683
Type of change
Tooling/config, plus three small source fixes for graphql 15 typings. The published changes are the types and the one error message listed above.
How Has This Been Tested?
Run on this branch (
master@ 5078faf plus this PR):pnpm exec tsc --noEmit -p tsconfig.json(types:check): 0 errors (351 at the start), with graphql 17 and with graphql 15scripts/match-graphql.js 15); ESM/CJS exports integrity (bob check) passes.d.tsfiles between amasterbuild and a strict build: 10 files in 5 packages differ, all listed abovegraphql.org,initsnapshots of the interactive prompt's❯symbol, and one snapshot that embeds the checkout's folder name)tsconfig.spec.json(tests) is not part of this PR, and CI doesn't typecheck it. It has 182 errors onmasterand 406 with strict on (702 at the start).Test Environment:
@graphql-codegen/...:master@ 5078fafPer-package checklist
All fix PRs have merged. Error counts are from the start:
plugins/other/visitor-plugin-common(211 errors)base-resolvers-visitor(46 errors): [visitor-plugin-common] fix: satisfy strict mode in base-resolvers-visitor (#4683) #11030selection-set-to-object,client-side-base-visitor,base-documents-visitor(53 errors when split): [visitor-plugin-common] fix: satisfy strict mode in selection-set-to-object, client-side-base-visitor and base-documents-visitor (#4683) #11031base-types-visitor,utils, and the rest) is split in two:base-types-visitor(27 errors): [visitor-plugin-common] fix: satisfy strict mode in base-types-visitor (#4683) #11037utilsand the rest (imports,naming,mappers,types,variables-to-object,optimize-operations,convert-schema-enum-to-declaration-block-string,selection-set-processor/base; 46 errors, including the 4 inenum-valuesthat thetypeschange clears): [visitor-plugin-common] fix: satisfy strict mode in utils and the remaining files (#4683) #11039graphql-codegen-cli(32 errors): [cli] fix: satisfy strict mode in cli (#4683) #11020utils/plugins-helpers(23 errors): [plugin-helpers] fix: satisfy strict mode in plugin-helpers (#4683) #11019plugins/typescript/typescript(20 errors): [typescript] fix: satisfy strict mode in typescript (#4683) #11014plugins/other/fragment-matcher(13 errors): [fragment-matcher] fix: satisfy strict mode in fragment-matcher (#4683) #11012plugins/typescript/operations(11 errors): [typescript-operations] fix: satisfy strict mode in typescript-operations (#4683) #11009presets/client(10 errors): [client-preset] fix: satisfy strict mode in the client preset (#4683) #10995plugins/typescript/typed-document-node(9 errors): [plugin-helpers] feat: type oldVisit's return value and fix typed-document-node under strict mode (#4683) #10994presets/graphql-modules(7 errors): [graphql-modules-preset] fix: skip sources without a location or document under strict mode (#4683) #10993utils/graphql-codegen-testing(5 errors): [graphql-codegen-testing] fix: satisfy strict mode in validateTs/compileTs (#4683) #10992graphql-codegen-core(4 errors): [core] fix: skip files without a document and narrow validate/hash types under strict mode (#4683) #10991plugins/typescript/document-nodes(2 errors): [document-nodes] fix: skip files without a document and annotate filter param under strict mode (#4683) #10990plugins/other/time(2 errors): [time] fix: handle optional info and unset format under strict mode (#4683) #10989plugins/typescript/resolvers(1 error): [resolvers] fix: annotate definitions filter param under strict mode (#4683) #10988plugins/other/add(1 error): [add] fix: return empty string for content under strict mode (#4683) #10986Further comments
Summary of the already-merged per-package PRs
None of this is in this PR's diff. It records the choices the per-package PRs made across the series, for reference:
oldVisit()inplugin-helpersnow returnsOldVisitDocumentResultinstead ofanyfor aDocumentNode(#10994), sodefinitions.filter(d => ...)callbacks no longer need their params annotated.Types.DocumentFile.documentis optional, sodocuments.map(v => v.document)fails TS2345 in document-nodes, typed-document-node and presets/graphql-modules. Each package skips files without a document locally, like core does (for exampleflatMap(d => (d.document ? [d.document] : []))), instead of assertingv.document!.getConfigValue(value, default)invisitor-plugin-commonnow typesvalueasT | null | undefined, so the result is non-nullable when a default is given (#10993).Typing a method's params can give it an inferred return type. A bare
return;then failednoImplicitReturnswhilestrictNullCheckswas still off (TS7030), so those PRs usereturn undefined;(#10994). A callback whose type is already set by its context, such as a graphqlvisitcallback, can keep the barereturn;because that type allowsvoid(#10995).#11009 widened shared types instead of adding defaults at call sites:
DeclarationBlock.withCommentacceptsundefined, sowithComment(node.description?.value)needs no?? null.Types.ComplexPluginOutput.prepend/appendacceptnullitems.parseEnumValues'smapOrStrandoptimizeOperations'sincludeFragmentsare optional.ImportSource.namespaceacceptsnull.#11014 typed the shared
BaseTypesVisitormethods thatTsVisitoroverrides, instead of patching each override:ParsedTypesConfig.declarationKindisNormalizedDeclarationKindConfig(Required<DeclarationKindConfig>), since normalizing always fills every kind.FieldDefinition,InputValueDefinitionandUnionTypeDefinitiontakekey: string | numberandparent: anyas required, since oldVisit always passes them.NamedTypeandListTypehave typedkey/parent/path/ancestorsparams.ObjectTypeDefinition,EnumTypeDefinitionandDirectiveDefinitionreturnstring | null, so overrides that drop a type can returnnull.#11019 typed
oldVisit's visitor and changed two exportedplugin-helperstypes:oldVisit'svisitorparam is the exportedOldVisitorinstead ofany:enter/leavemaps keyed by AST node kind, so callbacks get a typednode. The callbacks use method syntax, so visitor classes passed as{ leave: visitor }can keep narrower params such asancestors: ASTNode[].InputValueDefinitionoverrides in typescript and operations takepath(ReadonlyArray<string | number>) andancestorsas required, since oldVisit always passes them.ProfilerEvent.catis optional.FederationMeta'sReferenceSelectionSetis{ [field: string]: true | ReferenceSelectionSet }, matching nested selections such ascompany { taxCode }.#11030 changed these
visitor-plugin-commontypes:BaseResolversVisitor's constructor takesadditionalConfigasPartial<TPluginConfig>, which clears its TS2783 errors.ScalarTypeDefinition,DirectiveDefinitionandEnumTypeDefinitionreturnstring | null.getAbstractMembersType'sisTypenameNonOptionalis optional.defaultMapperTypethrows whendefaultMapperisn't set.#11031 changed these
visitor-plugin-commontypes:BaseDocumentsVisitor._selectionSetToObjectis optional;FragmentDefinitionandOperationDefinitionthrow when it isn't set, andFragmentDefinitionthrows when its type condition isn't in the schema.BaseDocumentsVisitor.FragmentDefinitionandClientSideBaseVisitor.buildOperationreturnstring | null.LinkField.aliasis optional, andBaseSelectionSetProcessor.typeCacheis keyed byLocation | undefined.getPossibleTypestakesGraphQLType | undefined, andOperationVariablesToObject.transformacceptsundefined.SelectionSetToObject.transformSelectionSetthrows when there's no selection set, andflattenSelectionSetthrows when there's no parent type.#11037 changed these
visitor-plugin-commontypes:BaseTypesVisitor's constructor takesadditionalConfigasPartial<TPluginConfig>.getScalarsImportsusesreduce<string[]>.getDirectiveArgumentAndInputFieldMappingsImportsnarrows its.filterwith ana is stringtype guard, so it returnsstring[].fields/types/values/descriptionare treated as empty instead of throwing.#11039 changed these
visitor-plugin-commontypes:transformCommentandblockacceptnull/undefined, andbuildScalarsaccepts anundefinedscalars mapping; each already handled these.DeclarationBlock's fields are typedstring | null, andwithBlockacceptsnull, which renders the same as no block.ParsedEnumValuesMap'smappedValues,sourceIdentifier,sourceFileandimportIdentifieracceptnull, whichparseEnumValuesalready emits.OperationVariablesToObject.getName,OperationVariablesToObject.transformandBaseSelectionSetProcessor.buildSelectionSetFromStringsreturnstring | null.buildTypeImport(missingidentifierorsource),buildEnumValuesBlock(enum value not on the schema's enum) andoptimizeOperations(document file with no parsed document) throw descriptive errors.OperationVariablesToObjectemits''instead of the textundefined/nullwhen a variable has no name or no type identifier.values, a fragment import withoutidentifiers, a@deprecatedwithout arguments and aDeclarationBlockwithout ablockTransformerare treated as empty or default instead of throwing.transformMappersdefaultsrawMappersto{}.isOneOfInputObjectTypereturnsfalseinstead ofundefined.isOneOfinisOneOfInputObjectType) has a comment saying why.🤖 Generated with Claude Code