Closed capaj closed 6 years ago
Could you paste some example code that is throwing?
@ObjectType({ description: 'Simple product object type' })
class Product {
@Field()
get throws(): number {
return 10
}
}
the error is:
Error: Expected undefined to be a GraphQL nullable type.
at invariant (/home/capaj/git_projects/tests/type-gql/node_modules/graphql/jsutils/invariant.js:19:11)
at assertNullableType (/home/capaj/git_projects/tests/type-gql/node_modules/graphql/type/definition.js:327:51)
at new GraphQLNonNull (/home/capaj/git_projects/tests/type-gql/node_modules/graphql/type/definition.js:294:19)
at enhanceType (/home/capaj/git_projects/tests/type-gql/node_modules/typegql/lib/index.js:444:21)
at /home/capaj/git_projects/tests/type-gql/node_modules/typegql/lib/index.js:463:25
at Array.forEach (<anonymous>)
at convertArgsArrayToArgsMap (/home/capaj/git_projects/tests/type-gql/node_modules/typegql/lib/index.js:456:14)
at compileFieldArgs (/home/capaj/git_projects/tests/type-gql/node_modules/typegql/lib/index.js:482:12)
at compileFieldConfig$$1 (/home/capaj/git_projects/tests/type-gql/node_modules/typegql/lib/index.js:624:16)
at /home/capaj/git_projects/tests/type-gql/node_modules/typegql/lib/index.js:658:39
I tried to specify the type using {type: Number}
but that does not help.
Ok I think I've found something. It's treating it as function and trying to find arguments list, while it's getter. I'll hopefully fix it today.
I've added support for getter based fields together with needed test: https://github.com/prismake/typegql/commit/85d017e98d0c8d216e70dcff484b05d4acfb301f
Try to update to 0.5.2
and let me know if it's working now. If not - I'll re-open.
@pie6k awesome :tada: so fast :tornado: As soon as NPM let's me install that version I'll try it out. Been having issues whole day.
works :+1:
I've been using typegql with objection.js for a little while now and I have couple of getters in my codebase. Would it be possible to support them? Currently typegql is throwing when I try to put
@Field
on a getter.