Skip to content
This repository was archived by the owner on May 10, 2018. It is now read-only.

Commit 9658f3e

Browse files
committed
feat(ts): generate type instead of enum for GraphQL enums
1 parent 6e71cb7 commit 9658f3e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-static-binding",
3-
"version": "0.2.1",
3+
"version": "0.3.1",
44
"description": "Generate static binding files for a GraphQL schema",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/generators/graphcool-ts.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ ${type.description}
8282
}
8383

8484
function renderEnumType(type: GraphQLEnumType): string {
85-
return `${renderDescription(type.description)}export enum ${type.name} {
86-
${type.getValues().map(e => ` ${e.name} = '${e.value}'`).join(',\n')}
87-
}`
85+
return `${renderDescription(type.description)}export type ${type.name} =
86+
${type.getValues().map(e => ` '${e.name}'`).join(' |\n')}`
8887
}
8988

9089
function renderRootType(type: GraphQLObjectType): string {

0 commit comments

Comments
 (0)