dotansimha / dotansimha/graphql-code-generator-community

defaultBaseOptions value is not exported in generated file

Open
#618 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### Which packages are impacted by your issue?

@graphql-codegen/typescript-react-apollo

### Describe the bug

In the generator config file, setting config options `defaultBaseOptions` and having `noExport` set to false produces the following output. Notice the value isn't exported.

```javascript
{
...
plugins: ["typescript-operations", "typescript-react-apollo"],
config: {
...
reactApolloVersion: 3,
defaultBaseOptions: {
context: {
headers: { test: 'hello world' }
}
},
...
}
}
```

Generated Output:
```typescript
const defaultOptions = { context: { headers: { test: 'hello world' } } } as const;
```

### Your Example Website or App

na

### Steps to Reproduce the Bug or Issue

na

### Expected behavior

As a user, I expected that the defaultOptions to be exported when noExport value is false.

### Screenshots or Videos

_No response_

### Platform

OS: All of them
NodeJS: 18.16.1
graphql version: 16.8.0
@graphql-codegen/typescript-react-apollo version: 3.3.7

### Codegen Config File

_No response_

### Additional context

_No response_

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.