Replies: 4 comments
-
Check the example in examples/typescript-node/index.ts I can't help seeing part of the schema and part of the code |
Beta Was this translation helpful? Give feedback.
0 replies
-
I tested interfaces right now and they work as as expected @dqunbp please provide schema URL to test your case |
Beta Was this translation helpful? Give feedback.
0 replies
-
@aexol Sorry for the long answer interface Node {
id: ID!
}
interface Message {
createdAt: String!
}
type TextMessage implements Node & Message {
id: ID!
createdAt: String!
body: String!
}
type MessageEdge {
cursor: String!
node: Message
}
type MessageConnection {
edges: [MessageEdge]!
}
type Query {
messages: MessageConnection
} Then import { Chain } from "./generated/zeus/index";
const chain = Chain("url");
const query = await chain("query")({
messages: {
edges: {
node: {
__typename: true,
id: true,
createdAt: true,
"...on TextMessage": { body: true },
},
},
},
});
query.messages?.edges.map(({ node }) => {
node?.id; //exists
node?.createdAt; //exists
node?.__typename; // <= Property '__typename' does not exist on type '{ id: unknown; createdAt: string; }'.
}); zeus --version |
Beta Was this translation helpful? Give feedback.
0 replies
-
@aexol Any updates? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I tried to use
zeus-graphql
with interfaces like thisI wanted to check the
__typename
and then get the body ofTextMessage
But the result type doesn't contain
__typename
field, it event does't containbody
fieldOnly non-fragment types was inferred:
id
,createdAt
,sender
Does typing works correctly for result types of queries with the fragments?
PS I have checked the same case with
genql
library and it works as expectedBeta Was this translation helpful? Give feedback.
All reactions