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
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there!
I tried to use
zeus-graphqlwith interfaces like thisI wanted to check the
__typenameand then get the body ofTextMessageBut the result type doesn't contain
__typenamefield, it event does't containbodyfieldOnly non-fragment types was inferred:
id,createdAt,senderDoes typing works correctly for result types of queries with the fragments?
PS I have checked the same case with

genqllibrary and it works as expectedBeta Was this translation helpful? Give feedback.
All reactions