apollographql / apollographql/apollo-tooling

Use const enums in TS generator

Open
#610 1 comment 6 reactions 0 assignees View on GitHub
:tada: feature 🙏 help-wanted
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

Currently graphql enums are modelled in TS using normal enums. In order to not have any runtime consequences we can switch to `const enum` (https://www.typescriptlang.org/docs/handbook/enums.html#const-enums)

- https://github.com/apollographql/apollo-cli/pull/247
- https://github.com/apollographql/apollo-cli/issues/193

Contributor guide

Open the contributing guide

Research direction

Start by locating the TypeScript generator that models GraphQL enums and review the linked pull request 247 and issue 193 for prior context. Done means generated GraphQL enums use const enum rather than normal enums, avoiding the stated runtime consequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.