Skip to content

Ignore property types - #28

Open
imaximix wants to merge 2 commits into
joarwilk:masterfrom
imaximix:master
Open

Ignore property types #28
imaximix wants to merge 2 commits into
joarwilk:masterfrom
imaximix:master

Conversation

@imaximix

@imaximix imaximix commented Jul 3, 2017

Copy link
Copy Markdown

With these changes you can now ignore properties that have specific types instead of the whole type.

I'm not that familiar with the spec, so I might have missed some use cases. This just works well enough for me since I'm just using regular ol' types.

E.g.
schema

type Role {
  name: String!
}

type User {
  email: String!,
  roles: [Role]!
}

gql2flow --ignore-property-types "Role"

type User = {
  email: string
}

type Role = {
  name: string
}

gql2flow

type User = {
  email: string,
  roles: Array<Role>
}

type Role = {
  name: string
}

The reason is that I needed these types to annotate my resolver functions in apollo.

imaximix added 2 commits July 3, 2017 12:30
You can now ignore properties that have specific types instead of the whole type.

E.g. 
schema
```
type Role {
  name: String!
}

type User {
  email: String!,
  roles: [Role]!
}
```

gql2flow --ignore-property-types "Role"
```
type User = {
  email: string
}

type Role = {
  name: string
}
```

gql2flow
```
type User = {
  email: string,
  roles: Array<Role>
}

type Role = {
  name: string
}
```

The reason is that I needed these types to annotate my resolver functions in apollo.
Comment thread util/interface.js

let fields = f
.filter(field => filterField(field, ignoredTypes))
.filter(field => filterField(field, ignoredPropertyTypes))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is this correct? Shouldn't it filter for both?

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.

2 participants