{"action":"created","issue":{"url":"https://api.github.com/repos/graphql/express-graphql/issues/353","repository_url":"https://api.github.com/repos/graphql/express-graphql","labels_url":"https://api.github.com/repos/graphql/express-graphql/issues/353/labels{/name}","comments_url":"https://api.github.com/repos/graphql/express-graphql/issues/353/comments","events_url":"https://api.github.com/repos/graphql/express-graphql/issues/353/events","html_url":"https://github.com/graphql/express-graphql/issues/353","id":244531216,"number":353,"title":"type definitions when used with Restify","user":{"login":"chemdrew","id":8684337,"avatar_url":"https://avatars0.githubusercontent.com/u/8684337?v=4","gravatar_id":"","url":"https://api.github.com/users/chemdrew","html_url":"https://github.com/chemdrew","followers_url":"https://api.github.com/users/chemdrew/followers","following_url":"https://api.github.com/users/chemdrew/following{/other_user}","gists_url":"https://api.github.com/users/chemdrew/gists{/gist_id}","starred_url":"https://api.github.com/users/chemdrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemdrew/subscriptions","organizations_url":"https://api.github.com/users/chemdrew/orgs","repos_url":"https://api.github.com/users/chemdrew/repos","events_url":"https://api.github.com/users/chemdrew/events{/privacy}","received_events_url":"https://api.github.com/users/chemdrew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-21T00:15:07Z","updated_at":"2017-08-08T16:20:38Z","closed_at":null,"body":"When using this module in typescript with a restify server backing it, it won't transpile due to type issues.\r\n\r\n*server code:*\r\n```\r\nimport * as graphqlHTTP from 'express-graphql';\r\nimport * as restify from 'restify';\r\n\r\nimport * as schema from './schema';\r\n\r\nconst port: number = 3000;\r\n\r\nconst app: restify.Server = restify.createServer();\r\n\r\napp.get('/graphql', graphqlHTTP({\r\n  schema: schema,\r\n  graphiql: nconf.get('env') !== 'e3'\r\n}));\r\n\r\napp.listen(port, () => {\r\n  debug(`started on http://localhost:${port}`);\r\n});\r\n\r\n```\r\n\r\n*error output:*\r\n```\r\nArgument of type 'Middleware' is not assignable to parameter of type 'RequestHandlerType'.\r\n  Type 'Middleware' is not assignable to type 'RequestHandler[]'.\r\n    Property 'includes' is missing in type 'Middleware'.\r\n```\r\n\r\nI attempted to make a new interface that extended the current middleware with mappings between the two but that quickly became a deep rabbit hole...\r\n\r\nMy current thoughts to fix this would be to make the Middleware interface a bit more dynamic so it conforms to both restify and express, but not 100% sure if this would work:\r\n```\r\ntype Middleware = (request: $Request | restify.Request, response: $Response | restify.Response, next? restify.Next) => Promise<void> | void;\r\n```\r\n\r\nI will attempt to make a PR for this later if I have some free time tonight :)\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/graphql/express-graphql/issues/comments/321007206","html_url":"https://github.com/graphql/express-graphql/issues/353#issuecomment-321007206","issue_url":"https://api.github.com/repos/graphql/express-graphql/issues/353","id":321007206,"user":{"login":"chemdrew","id":8684337,"avatar_url":"https://avatars0.githubusercontent.com/u/8684337?v=4","gravatar_id":"","url":"https://api.github.com/users/chemdrew","html_url":"https://github.com/chemdrew","followers_url":"https://api.github.com/users/chemdrew/followers","following_url":"https://api.github.com/users/chemdrew/following{/other_user}","gists_url":"https://api.github.com/users/chemdrew/gists{/gist_id}","starred_url":"https://api.github.com/users/chemdrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemdrew/subscriptions","organizations_url":"https://api.github.com/users/chemdrew/orgs","repos_url":"https://api.github.com/users/chemdrew/repos","events_url":"https://api.github.com/users/chemdrew/events{/privacy}","received_events_url":"https://api.github.com/users/chemdrew/received_events","type":"User","site_admin":false},"created_at":"2017-08-08T16:20:38Z","updated_at":"2017-08-08T16:20:38Z","body":"created custom type definition to resolve this - makes more sense to handle it that way so closing this issue"}}
{"actor":{"display_login":"chemdrew"}}