{"action":"opened","issue":{"url":"https://api.github.com/repos/graphql-binding/graphql-binding/issues/126","repository_url":"https://api.github.com/repos/graphql-binding/graphql-binding","labels_url":"https://api.github.com/repos/graphql-binding/graphql-binding/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/graphql-binding/graphql-binding/issues/126/comments","events_url":"https://api.github.com/repos/graphql-binding/graphql-binding/issues/126/events","html_url":"https://github.com/graphql-binding/graphql-binding/issues/126","id":338702637,"node_id":"MDU6SXNzdWUzMzg3MDI2Mzc=","number":126,"title":"Generated binding does not export correct type","user":{"login":"jdolle","id":1841898,"node_id":"MDQ6VXNlcjE4NDE4OTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1841898?v=4","gravatar_id":"","url":"https://api.github.com/users/jdolle","html_url":"https://github.com/jdolle","followers_url":"https://api.github.com/users/jdolle/followers","following_url":"https://api.github.com/users/jdolle/following{/other_user}","gists_url":"https://api.github.com/users/jdolle/gists{/gist_id}","starred_url":"https://api.github.com/users/jdolle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdolle/subscriptions","organizations_url":"https://api.github.com/users/jdolle/orgs","repos_url":"https://api.github.com/users/jdolle/repos","events_url":"https://api.github.com/users/jdolle/events{/privacy}","received_events_url":"https://api.github.com/users/jdolle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-05T19:44:32Z","updated_at":"2018-07-05T19:44:32Z","closed_at":null,"author_association":"NONE","body":"I am generating a binding for typescript and then compiling in order to publish on NPM, but the exported type is always cast as `any`.\r\n\r\n.graphqlconfig.yml\r\n```\r\nprojects:\r\n  myapp:\r\n    schemaPath: generated/schema.graphql\r\n    extensions:\r\n      codegen:\r\n        - generator: graphql-binding\r\n          language: typescript\r\n          input: src/schema.ts\r\n          output:\r\n            binding: generated/graphql-internal-typing.ts\r\n```\r\n\r\ntsconfig.json\r\n```\r\n{\r\n  \"compilerOptions\": {\r\n    \"outDir\": \"dist\",\r\n    \"strict\": true,\r\n    \"noImplicitAny\": false,\r\n    \"target\": \"es2017\",\r\n    \"module\": \"commonjs\",\r\n    \"noUnusedLocals\": true,\r\n    \"moduleResolution\": \"node\",\r\n    \"allowSyntheticDefaultImports\": true,\r\n    \"esModuleInterop\": true,\r\n    \"experimentalDecorators\": true,\r\n    \"emitDecoratorMetadata\": true,\r\n    \"declaration\": true,\r\n    \"baseUrl\": \".\",\r\n    \"paths\": {\r\n      \"*\": [\r\n        \"*\"\r\n      ]\r\n    },\r\n    \"lib\": [\r\n      \"dom\",\r\n      \"es2015\",\r\n      \"es2016\",\r\n      \"es2017\",\r\n      \"esnext.asynciterable\"\r\n    ]\r\n  },\r\n  \"files\": [\r\n    \"generated/graphql-internal-typing.ts\",\r\n    \"src/schema.ts\"\r\n  ]\r\n}\r\n```\r\n\r\nNow whenever I import the generated module, I have to cast the binding, e.g.\r\n```\r\nimport { Binding } from '..'\r\n\r\nconst binding: Binding = new Binding()\r\n``\r\n\r\nOtherwise `binding` is type `any`.\r\n\r\nI'm struggling to figure out why this is happening, since the exported object looks correctly typed:\r\n`export const Binding = makeBindingClass<BindingConstructor<Binding>>({ schema })`\r\n\r\nbut I do see a TypeError on that line that may be the source of the issue:\r\n\r\n```\r\nArgument of type '{ schema: typeof import(\".../src/schema\"); }' is not assignable to parameter of type '{ schema: GraphQLSchema; }'. Types of property 'schema' are incompatible. Type 'typeof import(\".../src/schema\")' is not assignable to type 'GraphQLSchema'. Property 'getQueryType' is missing in type 'typeof import(\".../src/schema\")'.\r\n```\r\n\r\nLet me know if you would like a repo that reproduces the error and I can hopefully find time to put that together for you."}}
{"actor":{"display_login":"jdolle"}}