dotansimha / dotansimha/graphql-code-generator-community

__typename is undefined from sdk while using plug in "typescript-graphql-request"

Open
#147 2 comments 0 reactions 1 assignee Claimed by @charlypoly View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

**Describe the bug**

"__typename is undefined"

```
// codegen.js
...
plugins: [
'typescript',
'typescript-operations',
'typescript-graphql-request',
],
config: {
rawRequest: false,
withInterfaceTypename: false,
skipTypename: false,
},

// schema
type Me {
id: String
}

type Query {
me: Me
}

query getMe {
me {
id
}
}

// node.js
import { GraphQLClient } from 'graphql-request'

const client = new GraphQLClient('https://graphql')
const sdk = getSdk(client)

const data = await sdk.getMe()
console.log(data.__typename) // undefined, but should me "Me"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.