Strange GraphQL type mismatch for non-plain fields in queryable interface #39208
Unanswered
seven-mile
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have two types of documents to generate posts in my website. They are provided from two separate source plugins. So I declare them as 2 node types:
MarkdownRemark
andTypst
. Both of them have the fieldfrontmatter: Frontmatter
. To be specific, this is the simplified version of the schema:Naturally I want to use queryable interface to model these common fields (
frontmatter
here). So I abstact out a new interfacePost
:But when I execute the query
allPost
, there are errors about incompatible types offrontmatter
:That's really weird. I already explicitly declared the field. However, the type of
MarkdownRemark.frontmatter
isMarkdownRemarkFrontmatter
, which never shows in schema. I guess it is generated but have no clue in the large codebase.Note that the difference between my usecase and the one documented is that I have a field with non-plain type. If I switch it to a plain type like
String
, it works well indeed.Beta Was this translation helpful? Give feedback.
All reactions