`possible-type-extension` erroring when extending types defined in separate files.
See original GitHub issueDescribe the bug
possible-type-extension
erroring when extending types defined in separate files.
Error:
Cannot extend type "Query" because it is not defined @graphql-eslint/possible-type-extension
Additionally, if this error triggers for any file, an error shows up in lint results for every file in which a type was extended. Also, I notice messaging is slightly different when extending known types likeQuery
vs custom types like NotQuery
.
To Reproduce Steps to reproduce the behavior:
Run yarn lint
in below repo.
https://github.com/JustinTRoss/graphql-eslint-issue-repro
Expected behavior
Ideally, no errors would be thrown when extending a type defined in another file.
Environment:
- OS: MacOS 11.4
@graphql-eslint/...
: 2.5- NodeJS: 14.17.5
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (10 by maintainers)
Top Results From Across the Web
[SR-631] Extensions in different files do not recognize ... - GitHub
SR-4568 Extension of a nested type defined in a separate source file fails to compile; SR-4798 Trying to extend a subclass defined in...
Read more >How do I extend a TypeScript class definition in a separate ...
I wish to use a plugin which extends some of the objects in leaflet with an extra function. In the existing TypeScript definition...
Read more >Extending various TypeScript type declarations
Extending types of a 3rd party library is usually no different than extending any global type declaration. The three-step process defined in the ......
Read more >Extending object-like types with interfaces in TypeScript
Extending object-like types with interfaces in TypeScript · Option 1: Declaration merging · Declaration merging to wrangle disparate user ...
Read more >Extension Types — Cython 3.0.0a11 documentation
If the base type is defined in another Cython module, it must either be declared as an extern extension type or imported using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this is expected behavior, we can’t build a schema that contains validation errors like duplicated fields, in this case, we aren’t able to provide a GraphQL schema for rules that require it.
Fixed in
3.4.0-alpha-735b6ae.0
. Please not you’ll get an erroneouspossible-type-extension
error in another file because the errorUnion type ... can only include ...
goes fromvalidate()
function and not frompossible-type-extension
rule.It’s related to how
graphql
validate SDL, I can’t do anything hereYou’re quick! Those two scenarios look mitigated. I come bearing another 🙌 . 😛
If you define a duplicate version of the same type with violations in it, like duplicate conflicting fields, depending the order of loaded files, it will report either as an error merging types or an error defining type. At the same time, it errors out and inaccurately conveys that the eslint
parserOptions.schema
is not set, but is required for the possible-type-extension rule.Try running
yarn lint
on this branch.Offending type/field def here.