Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

Commit ab41c39

Browse files
koenpuntJason Kuhrt
authored andcommitted
export enums to allow implementations conforming to them (#306)
1 parent 3b24034 commit ab41c39

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

packages/graphqlgen/src/generators/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export const getDistinctInputTypes = (
321321
export function renderEnums(args: GenerateArgs): string {
322322
return args.enums
323323
.map(enumObject => {
324-
return `type ${enumObject.name} = ${enumObject.values
324+
return `export type ${enumObject.name} = ${enumObject.values
325325
.map(value => `'${value}'`)
326326
.join(' | ')}`
327327
})

packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import type { GraphQLResolveInfo } from \\"graphql\\";
88
import type { User } from \\"../../fixtures/enum/types-flow\\";
99
type Context = any;
1010
11-
type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\";
12-
type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\";
11+
export type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\";
12+
export type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\";
1313
1414
// Types for Query
1515
export const Query_defaultResolvers = {};

packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import type {
3737
} from \\"../../fixtures/prisma/flow-types\\";
3838
type Context = any;
3939

40-
type PLACE_SIZES =
40+
export type PLACE_SIZES =
4141
| \\"ENTIRE_HOUSE\\"
4242
| \\"ENTIRE_APARTMENT\\"
4343
| \\"ENTIRE_EARTH_HOUSE\\"
@@ -46,9 +46,9 @@ type PLACE_SIZES =
4646
| \\"ENTIRE_PLACE\\"
4747
| \\"ENTIRE_BOAT\\"
4848
| \\"PRIVATE_ROOM\\";
49-
type CURRENCY = \\"CAD\\" | \\"CHF\\" | \\"EUR\\" | \\"JPY\\" | \\"USD\\" | \\"ZAR\\";
50-
type PAYMENT_PROVIDER = \\"PAYPAL\\" | \\"CREDIT_CARD\\";
51-
type NOTIFICATION_TYPE =
49+
export type CURRENCY = \\"CAD\\" | \\"CHF\\" | \\"EUR\\" | \\"JPY\\" | \\"USD\\" | \\"ZAR\\";
50+
export type PAYMENT_PROVIDER = \\"PAYPAL\\" | \\"CREDIT_CARD\\";
51+
export type NOTIFICATION_TYPE =
5252
| \\"OFFER\\"
5353
| \\"INSTANT_BOOK\\"
5454
| \\"RESPONSIVENESS\\"

packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { GraphQLResolveInfo } from \\"graphql\\";
77
import { User } from \\"../../fixtures/enum/types\\";
88
type Context = any;
99

10-
type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\";
11-
type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\";
10+
export type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\";
11+
export type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\";
1212

1313
export namespace QueryResolvers {
1414
export const defaultResolvers = {};

packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
} from \\"../../fixtures/prisma/types\\";
3737
type Context = any;
3838

39-
type PLACE_SIZES =
39+
export type PLACE_SIZES =
4040
| \\"ENTIRE_HOUSE\\"
4141
| \\"ENTIRE_APARTMENT\\"
4242
| \\"ENTIRE_EARTH_HOUSE\\"
@@ -45,9 +45,9 @@ type PLACE_SIZES =
4545
| \\"ENTIRE_PLACE\\"
4646
| \\"ENTIRE_BOAT\\"
4747
| \\"PRIVATE_ROOM\\";
48-
type CURRENCY = \\"CAD\\" | \\"CHF\\" | \\"EUR\\" | \\"JPY\\" | \\"USD\\" | \\"ZAR\\";
49-
type PAYMENT_PROVIDER = \\"PAYPAL\\" | \\"CREDIT_CARD\\";
50-
type NOTIFICATION_TYPE =
48+
export type CURRENCY = \\"CAD\\" | \\"CHF\\" | \\"EUR\\" | \\"JPY\\" | \\"USD\\" | \\"ZAR\\";
49+
export type PAYMENT_PROVIDER = \\"PAYPAL\\" | \\"CREDIT_CARD\\";
50+
export type NOTIFICATION_TYPE =
5151
| \\"OFFER\\"
5252
| \\"INSTANT_BOOK\\"
5353
| \\"RESPONSIVENESS\\"

0 commit comments

Comments
 (0)