-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add Typescript typings #14
Comments
Thanks for the idea! Can you share some pain points where adding TypeScript would have helped you with this library? |
It's not that painful since the functionality offered by the library isn't that complex and there's only a handful of functions but it's still nice to have. With typings:
Like I've said, these aren't very outstanding issues, but it's pretty standard nowadays to offer TS support |
Checking in now that #23 was merged to see if this issue can be closed or if there's more work to do. Thanks!! |
#23 is certainly a good start but I'd say there's still more work to be done to close this issue. #23 provides basic types that export function createGraphQLHandler(graphQLSchema: any | string, mirageSchema: any, { context, resolvers, root }?: {
context: any;
resolvers: any;
root: any;
}): graphQLHandler; While its certainly much better than nothing, the typings could be improved. In general, any There's also one issue I see introduced with this PR, when I try to provide custom resolvers to the handler, I now also need to pass const graphQLHandler = createGraphQLHandler(graphQLSchema, this.schema, {
resolvers: {
Mutation: {
// Coerce the record returned from the default resolver to a Boolean
deletePerson: (obj, args, context, info) =>
!!mirageGraphQLFieldResolver(...arguments)
}
}
}) |
Thanks for the feedback! |
It has taken years to find the time to work on a TypeScript version of this library but I finally got around to it. I have released version There should be not breaking changes when it comes to creating a request handler (the main functionality) but there are some breaking changes to a few functions that I would be surprised to see anyone use. Thanks in advance for any feedback! |
As the title says, it'd be great to have typings for this library. Seeing Typescript on the rise and in use in many projects (including one I'm working on), it'd make developer experience better.
The text was updated successfully, but these errors were encountered: