Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS] Use Typescript string enum for enums #193

Closed
clayne11 opened this issue Jul 27, 2017 · 0 comments
Closed

[TS] Use Typescript string enum for enums #193

clayne11 opened this issue Jul 27, 2017 · 0 comments
Labels
🎉 feature New addition or enhancement to existing solutions
Milestone

Comments

@clayne11
Copy link

As of Typescript 2.4 Typescript supports string enums. Use these instead of union string types for enums.

Example:

// old
export type Test = "FOO" | "BAR" | "FOOBAR"

// suggested
export enum Test = {
  FOO = "FOO",
  BAR = "BAR",
  FOOBAR = "FOOBAR"
}

This will allow us to import and use the enums within our apps rather than having to create an identical enum.

@rricard rricard added this to the Codegen 1.0 milestone Aug 2, 2017
JasonBerry added a commit to JasonBerry/apollo-codegen that referenced this issue Sep 12, 2017
lewisf pushed a commit that referenced this issue Sep 26, 2017
ecstasy2 added a commit to ecstasy2/apollo-codegen that referenced this issue Dec 22, 2017
@shadaj shadaj added the 🎉 feature New addition or enhancement to existing solutions label Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 feature New addition or enhancement to existing solutions
Projects
None yet
Development

No branches or pull requests

3 participants