documentationjs / documentationjs/documentation

TypeError: Cannot read property 'name' of undefined (graphql codegen with flow)

Open
#1,350 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.8k
Forks
481
PR merge metrics
No merged PRs in 30d

Description

Hi, i am experiencing the following error with graphql codegenerator tool with flow. Generated code looks fine, but documentation returns an Error.

test.flow.js
```javascript
// @flow

/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {|
ID: string,
String: string,
Boolean: boolean,
Int: number,
Float: number,
|};

/** Some description */
export type EpisodeAggregation = {|
...Aggregation,
...{|
__typename?: 'EpisodeAggregation',
/** The ID of an object */
id: $ElementType,
|}
|};

export type Aggregation = {|
__typename?: 'Aggregation',
/** The ID of an object */
id: $ElementType,
|};
```

`$ documentation lint test.flow.js`

```
TypeError: Cannot read property 'name' of undefined
at isObjectSpreadAndExactUtilTypeProperty (/usr/local/lib/node_modules/documentation/src/infer/properties.js:15:26)
at /usr/local/lib/node_modules/documentation/src/infer/properties.js:87:13
at Array.forEach ()
at inferProperties (/usr/local/lib/node_modules/documentation/src/infer/properties.js:79:18)
at Array.inferProperties (/usr/local/lib/node_modules/documentation/src/infer/properties.js:104:7)
at /usr/local/lib/node_modules/documentation/src/index.js:40:25
at Array.map ()
at /usr/local/lib/node_modules/documentation/src/index.js:149:48
at arrayMap (/usr/local/lib/node_modules/documentation/node_modules/lodash/lodash.js:639:23)
at map (/usr/local/lib/node_modules/documentation/node_modules/lodash/lodash.js:9580:14)
```

My code is autogenerated by https://graphql-code-generator.com from this query
```
"Some description"
type EpisodeAggregation implements Aggregation {
"The ID of an object"
id: ID!
}

type Aggregation {
"The ID of an object"
id: ID!
}
```

* What version of documentation.js are you using?: documentation@13.1.0
* How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): CLI

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.