-
Notifications
You must be signed in to change notification settings - Fork 5
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add typings to package. #9
base: master
Are you sure you want to change the base?
Conversation
@b1f6c1c4 It seems work well in my project. I think you can make a PR on DefinitelyTyped, so that we can use it conveniently by |
@mathieutu Your opinion is right. |
type gqlProjection = (config: RawConfig) => { project: ProjectMethod, resolvers: Resolver }; | ||
type prepareConfig = (config: RawConfig) => PreparedConfig; | ||
type genProjection = (config: PreparedConfig) => ProjectMethod; | ||
type genResolvers = (config: PreparedConfig) => Resolver[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genResolvers
does NOT give GraphQLFieldResolver<,>
.
It produces:
{
User: {
userId: (parent, args, context, info) => parent._id,
field1: (parent, args, context, info) => parent.mongoA,
},
}
while GraphQLFieldResolver<,>
is essentially the type of (parent, args, context, info) => any
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I've missed a level.
@@ -0,0 +1,20 @@ | |||
import { GraphQLFieldResolver, GraphQLResolveInfo } from 'graphql'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mathieutu Would you please use a linter (such as tslint
) to lint the code, enforcing a consistant coding style? I found that there are inconsistent spaces and semicolons.
3caf3c3
to
e167389
Compare
Hi,
Here are some typescript typing to resolve #7.
This is my first typings, and I'm a total noob in TS, so it's totally opened for expertise, to learn.
The only thing I can say is, like it's done, it works! 馃槄
I'm using TS on my project, and it correctly recognize all the types.
Thanks for your work on this package!