Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing interfaces and unions in docs #568

Merged
merged 4 commits into from
Mar 27, 2018
Merged

Fixing interfaces and unions in docs #568

merged 4 commits into from
Mar 27, 2018

Conversation

huv1k
Copy link
Collaborator

@huv1k huv1k commented Feb 12, 2018

Fixes #322 #171.

Changes proposed in this pull request:

Added link to unions, renamed details for enums etc and added interfaces

@@ -53,6 +58,13 @@ export default class FieldDoc extends React.Component<Props, State> {
const implementationsOffset =
obj.fields.length + obj.interfaces.length + obj.args.length

const typeInstance =
Copy link
Collaborator Author

@huv1k huv1k Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not happy with this style of coding, but was trying to follow lint rules. I can change it to something like this:

if (type instanceof GraphQLInterfaceType) {
  typeInstance = 'interface'
} else if (type instanceof GraphQLUnionType) {
  typeInstance = 'union'
} else if (type instanceof GraphQLEnumType) {
  typeInstance = 'enum'
} else {
  typeInstance = 'type'
}

What looks better in my eyes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that look definitely better! You can also identify that linting rule and ignore it in the tslint config.
I already had a lot of cases where this rule forced you to do this ugly ternary stuff.

@timsuchanek timsuchanek merged commit 5b31743 into master Mar 27, 2018
@huv1k huv1k deleted the interface branch March 28, 2018 12:15
cgxxv pushed a commit to cgxxv/graphql-playground that referenced this pull request Mar 25, 2022
* Fixing interfaces and unions in docs

* Change linting and conditions

* Prettier not working correctly?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants