apollographql / apollographql/apollo-tooling
client:codegen emits warnings for commented-out Typescript code
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
I have queries in a commented-out section of typescript code. This is not ideal, but it's the world I live in at the moment. The comment uses block-style comments, like this:
```
/*
export const myMutation = gql`
mutation myMutation($payload: Thingy) {
mutateThingy(input: $payload) { yep }
}`;
*/
```
The queries refer to things that don't exist in the schema yet. When I invoke `apollo client:codegen --target typescript --outputFlat --config apollo.config.js gen` with an `apollo.config.js` that does nothing but set `localSchemaFile`, I see errors relating to types inside the commented-out section of code:
.../src/helpers/queries/mutations.ts: Unknown type "Thingy". Did you mean "blah blah blah"?
.../src/helpers/queries/mutations.ts: Cannot query field "mutateThingy" on type "Mutations". Did you mean "blah blah blah"?
My apollo version is `apollo/2.1.9 linux-x64 node-v10.14.2`.
Contributor guide
Research direction
Reproduce the issue with the shown apollo client:codegen command, apollo.config.js, and commented query in mutations.ts. Trace how the codegen entry point extracts queries from TypeScript and verify that block-commented queries are ignored while active queries still generate without diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100