apollographql / apollographql/apollo-tooling
code generator should not generate empty global-types
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
continuation of https://github.com/apollographql/apollo-tooling/issues/1179#issuecomment-616496523
**Intended outcome:**
`global-types.ts` cannot be empty as this breaks typescript compiler when `--isolatedModules` is set. This option can not be disabled for nextjs users
**Actual outcome:**
if there is nothing to put into `global-types.ts`, apollo generates an empty file. This throws an error on build `Type error: All files must be modules when the '--isolatedModules' flag is provided.`
**How to reproduce the issue:**
set `isolatedModules` and run a build
**Versions**
apollo 2.28.3
Contributor guide
Research direction
Reproduce the issue by enabling TypeScript's isolatedModules option and running a build that generates global-types.ts. Start by locating the code-generator entry point responsible for that file. Done means the generator no longer produces an empty global-types.ts and the build completes without the isolatedModules error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100