{"action":"created","issue":{"url":"https://api.github.com/repos/dotansimha/graphql-code-generator/issues/170","repository_url":"https://api.github.com/repos/dotansimha/graphql-code-generator","labels_url":"https://api.github.com/repos/dotansimha/graphql-code-generator/issues/170/labels{/name}","comments_url":"https://api.github.com/repos/dotansimha/graphql-code-generator/issues/170/comments","events_url":"https://api.github.com/repos/dotansimha/graphql-code-generator/issues/170/events","html_url":"https://github.com/dotansimha/graphql-code-generator/issues/170","id":281431219,"number":170,"title":"How does the --export flag work?","user":{"login":"jonaskello","id":664076,"avatar_url":"https://avatars0.githubusercontent.com/u/664076?v=4","gravatar_id":"","url":"https://api.github.com/users/jonaskello","html_url":"https://github.com/jonaskello","followers_url":"https://api.github.com/users/jonaskello/followers","following_url":"https://api.github.com/users/jonaskello/following{/other_user}","gists_url":"https://api.github.com/users/jonaskello/gists{/gist_id}","starred_url":"https://api.github.com/users/jonaskello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonaskello/subscriptions","organizations_url":"https://api.github.com/users/jonaskello/orgs","repos_url":"https://api.github.com/users/jonaskello/repos","events_url":"https://api.github.com/users/jonaskello/events{/privacy}","received_events_url":"https://api.github.com/users/jonaskello/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-12-12T15:43:32Z","updated_at":"2017-12-12T15:58:48Z","closed_at":null,"author_association":"NONE","body":"I cannot find docs about exactly how to use it.\r\n\r\nI tried with a file that exports a schema like this:\r\n\r\n**schema.ts**\r\n\r\n```ts\r\nimport gql from \"graphql-tag\";\r\n\r\nexport const schema = gql`\r\n  type User {\r\n    id: ID!\r\n    first_name: String!\r\n    last_name: String!\r\n  }\r\n`\r\n```\r\n\r\nAnd I run this:\r\n\r\n```\r\ngql-gen --export schema.js --template typescript --out ./types.ts ./src/**/*.ts\r\n```\r\n\r\nAnd I get this error:\r\n\r\n```\r\nLoading GraphQL Introspection from JavaScript ES6 export: schema.js...\r\nTypeError: schema.getTypeMap is not a function\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dotansimha/graphql-code-generator/issues/comments/351095365","html_url":"https://github.com/dotansimha/graphql-code-generator/issues/170#issuecomment-351095365","issue_url":"https://api.github.com/repos/dotansimha/graphql-code-generator/issues/170","id":351095365,"user":{"login":"jonaskello","id":664076,"avatar_url":"https://avatars0.githubusercontent.com/u/664076?v=4","gravatar_id":"","url":"https://api.github.com/users/jonaskello","html_url":"https://github.com/jonaskello","followers_url":"https://api.github.com/users/jonaskello/followers","following_url":"https://api.github.com/users/jonaskello/following{/other_user}","gists_url":"https://api.github.com/users/jonaskello/gists{/gist_id}","starred_url":"https://api.github.com/users/jonaskello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonaskello/subscriptions","organizations_url":"https://api.github.com/users/jonaskello/orgs","repos_url":"https://api.github.com/users/jonaskello/repos","events_url":"https://api.github.com/users/jonaskello/events{/privacy}","received_events_url":"https://api.github.com/users/jonaskello/received_events","type":"User","site_admin":false},"created_at":"2017-12-12T15:58:48Z","updated_at":"2017-12-12T15:58:48Z","author_association":"NONE","body":"Yes, I tried that but still the same error. (When I omit export I get an error messages saying it needs either default export or \"schema\" export so I guess both are supported, although the named export is not in the readme.)\r\n\r\nI think maybe the `gql` tag don't convert the string to the correct type. From what I understand codegen needs an object of type `GraphQLSchema`. I think what is generated is something called TypeDefs that are then used as input to apollo's `makeExecutableSchema()` function, which then in turn will finally generate an object of type `GraphQLSchema`. However I cannot run  `makeExecutableSchema()` without also providing resolvers, and I don't want them in the schema.js file..."}}
{"actor":{"display_login":"jonaskello"}}