I expect
gql-gen --file schema.json --template typescript --out ./index.d.ts \"**/*.graphql.ts\"
to the parse the local introspection information and all query and fragment strings tagged with gql in files matching **/*.graphql.ts Including those with string arguments. e.g:
export const articleDetailQuery = gql`
query ArticleDetail {
Article(id: "thisisnotarealID") {
title
}
}
`;
and output a typescript file with all types from the local graphQL schema and from queries and fragments.
gql-gen --file schema.json --template typescript --out ./index.d.ts \"**/*.graphql.ts\" errors when trying to pass any gql tagged string which includes quotation marks.
Error: Syntax Error: Unterminated string.
query.graphql.ts (3:18)
2: query ArticleDetail {
3: Article(id: "
^
Which prevents the output file being produced.
npm init a new project.npm install --save-dev graphql-code-generator graphqlschema.json file at the root of the project.query.graphql.ts file at the root of the project."gql": "gql-gen --file schema.json --template typescript --out ./index.d.ts \"**/*.graphql.ts\"" into the package.json scripts array.npm run gqlYou should receive an Unterminated string error due to the string variable.
An Angular CLI, typescript and Apollo project.
I upgraded from 0.8.14 to 0.8.21 and I am getting the same issue.
I found the issue, will release a soon fix :)
See changes here: https://github.com/dotansimha/graphql-code-generator/pull/265
Related: https://github.com/dotansimha/graphql-code-generator/pull/216
@jonaskello @jackhkmatthews
Done in 0.9.0 :)