-
Notifications
You must be signed in to change notification settings - Fork 4
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
TypeError: Cannot read property 'filter' of undefined
when generating flow/typescript file from schema
#219
Comments
huh, that's pretty strange. I'll take a look and see if i can reproduce/fix. thanks for the report @andiwinata edit: would it be possible to get a small reproduction case? are there any types that implement it seems like |
this is a simple interface Error {
message: String!
type: ErrorType!
}
type RuleError implements Error {
message: String!
type: ErrorType!
}
type RuleResponse {
error: RuleError
rule: [String!]!
}
type Query {
Rule(story: String): RuleResponse!
} |
I think we found the issue, the above sample case probably won't replicate the issue. The issue is we are declaring interface Error {
message: String!
type: ErrorType!
}
type RuleError {
message: String!
type: ErrorType!
}
type RuleResponse {
error: RuleError
rule: [String!]!
}
type Query {
Rule(story: String): RuleResponse!
} |
I saw that error when our schema had an interface but it was not used/implemented, basically there is no Basically we need to exit sooner than:
doing a check on |
So I guess it is up to whether declaring |
IMO i think it's an issue to have an interface that isn't being implemented. when we do interfaces we also generate a union type, i.e. type Product = ProductA | ProductB; so I'm unsure what we'd do in this case |
Hello guys, first of all, thanks for creating the library!
However, just recently we are unable to generate flow type from our
schema.graphql
file.I think this is because we recently added an interface type in our schema file. This is the part that is just recently added:
If I debug this, it is happening from this code:
When the error happens, the value of
type
isError
, andposs
isundefined
, thetype
correlates with the newly addedinterface Error
in the schema.graphql, that's why I suspect it causes the problem.If I wrap the
.filter
part withtry catch
, the file is generated again and it seems the content is correct (need to double check).So are you guys aware of any issue related to
interface
declaration in schema file?This is the stacktrace:
This is the command (both typescript and flow have the same error)
The text was updated successfully, but these errors were encountered: