dotansimha / dotansimha/graphql-code-generator-community

New spelling of ObjectID type not working for DbObject types

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

Description

**Describe the bug**
Our `DbObject` types are not updating to use the new syntax added in https://github.com/dotansimha/graphql-code-generator/pull/6831

```typescript
import { ObjectId } from 'mongodb';
export type CommunityDbObject = {
_id: ObjectID,
name: string,
access: string,
// ...
}
```

This causes type errors on build because `ObjectID` is not defined anywhere.

**To Reproduce**

Sandbox: https://codesandbox.io/s/affectionate-driscoll-0mjsq

(it stopped working when I tried to set it up so I can't see if it's actually working or not)

**Expected behavior**
The new `ObjectId` spelling of the type should be used in place of `ObjectID`.

**Environment:**

- OS: macOS 12.1 / `ubuntu-latest` from GitHub (happens everywhere)
```
@graphql-codegen/cli | 1.21.8 -> 2.6.1
@graphql-codegen/fragment-matcher | 2.0.1 -> 3.2.1
@graphql-codegen/introspection | 1.18.2 -> 2.1.1  
@graphql-codegen/typescript | 1.23.0 -> 2.4.3  
@graphql-codegen/typescript-document-nodes | 1.17.16 -> 2.2.3  
@graphql-codegen/typescript-graphql-files-modules | 1.18.1 -> 2.1.1 
@graphql-codegen/typescript-mongodb | 1.19.5 -> 2.3.1 
@graphql-codegen/typescript-operations | 1.18.4 -> 2.3.0  
@graphql-codegen/typescript-react-apollo | 2.3.1 -> 3.2.5  
@graphql-codegen/typescript-resolvers | 1.20.0 -> 2.5.0 
```
- NodeJS: v14

**Additional context**

We are using a workaround where we stuff `import { ObjectID } from 'mongodb'` at the top of the file.

Related: https://github.com/dotansimha/graphql-code-generator/issues/6830

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.