Skip to content

Commit 7352cf2

Browse files
committed
[typescript-operations] Generate enums referenced in operation Variables (#10508)
* Collect used enums * Use enum converter for Enum * Add changeset * Add doc * Update dev tests * Fix return type issue
1 parent f561b78 commit 7352cf2

24 files changed

Lines changed: 460 additions & 32 deletions

.changeset/curly-trees-lead.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/typescript-operations': major
3+
---
4+
5+
BREAKING CHANGE: typescript-operations plugin now generates enum if it is used in operation.

dev-test/githunt/typed-document-nodes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,18 @@ export enum VoteType {
174174
Up = 'UP',
175175
}
176176

177+
/** A list of options for the sort order of the feed */
178+
export type FeedType =
179+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
180+
| 'HOT'
181+
/** Newest entries first */
182+
| 'NEW'
183+
/** Highest score entries first */
184+
| 'TOP';
185+
186+
/** The type of vote to record, when submitting a vote */
187+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
188+
177189
export type OnCommentAddedSubscriptionVariables = Exact<{
178190
repoFullName: string;
179191
}>;

dev-test/githunt/types.avoidOptionals.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ export enum VoteType {
172172
Up = 'UP',
173173
}
174174

175+
/** A list of options for the sort order of the feed */
176+
export type FeedType =
177+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
178+
| 'HOT'
179+
/** Newest entries first */
180+
| 'NEW'
181+
/** Highest score entries first */
182+
| 'TOP';
183+
184+
/** The type of vote to record, when submitting a vote */
185+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
186+
175187
export type OnCommentAddedSubscriptionVariables = Exact<{
176188
repoFullName: string;
177189
}>;

dev-test/githunt/types.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,18 @@ export type Vote = {
167167
/** The type of vote to record, when submitting a vote */
168168
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
169169

170+
/** A list of options for the sort order of the feed */
171+
export type FeedType =
172+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
173+
| 'HOT'
174+
/** Newest entries first */
175+
| 'NEW'
176+
/** Highest score entries first */
177+
| 'TOP';
178+
179+
/** The type of vote to record, when submitting a vote */
180+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
181+
170182
export type OnCommentAddedSubscriptionVariables = Exact<{
171183
repoFullName: string;
172184
}>;

dev-test/githunt/types.enumsAsTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,18 @@ export type Vote = {
167167
/** The type of vote to record, when submitting a vote */
168168
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
169169

170+
/** A list of options for the sort order of the feed */
171+
export type FeedType =
172+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
173+
| 'HOT'
174+
/** Newest entries first */
175+
| 'NEW'
176+
/** Highest score entries first */
177+
| 'TOP';
178+
179+
/** The type of vote to record, when submitting a vote */
180+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
181+
170182
export type OnCommentAddedSubscriptionVariables = Exact<{
171183
repoFullName: string;
172184
}>;

dev-test/githunt/types.flatten.preResolveTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ export enum VoteType {
172172
Up = 'UP',
173173
}
174174

175+
/** A list of options for the sort order of the feed */
176+
export type FeedType =
177+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
178+
| 'HOT'
179+
/** Newest entries first */
180+
| 'NEW'
181+
/** Highest score entries first */
182+
| 'TOP';
183+
184+
/** The type of vote to record, when submitting a vote */
185+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
186+
175187
export type OnCommentAddedSubscriptionVariables = Exact<{
176188
repoFullName: string;
177189
}>;

dev-test/githunt/types.immutableTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ export enum VoteType {
172172
Up = 'UP',
173173
}
174174

175+
/** A list of options for the sort order of the feed */
176+
export type FeedType =
177+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
178+
| 'HOT'
179+
/** Newest entries first */
180+
| 'NEW'
181+
/** Highest score entries first */
182+
| 'TOP';
183+
184+
/** The type of vote to record, when submitting a vote */
185+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
186+
175187
export type OnCommentAddedSubscriptionVariables = Exact<{
176188
repoFullName: string;
177189
}>;

dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ export enum VoteType {
3535
Up = 'UP',
3636
}
3737

38+
/** A list of options for the sort order of the feed */
39+
export type FeedType =
40+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
41+
| 'HOT'
42+
/** Newest entries first */
43+
| 'NEW'
44+
/** Highest score entries first */
45+
| 'TOP';
46+
47+
/** The type of vote to record, when submitting a vote */
48+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
49+
3850
export type OnCommentAddedSubscriptionVariables = Exact<{
3951
repoFullName: string;
4052
}>;

dev-test/githunt/types.preResolveTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ export enum VoteType {
172172
Up = 'UP',
173173
}
174174

175+
/** A list of options for the sort order of the feed */
176+
export type FeedType =
177+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
178+
| 'HOT'
179+
/** Newest entries first */
180+
| 'NEW'
181+
/** Highest score entries first */
182+
| 'TOP';
183+
184+
/** The type of vote to record, when submitting a vote */
185+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
186+
175187
export type OnCommentAddedSubscriptionVariables = Exact<{
176188
repoFullName: string;
177189
}>;

dev-test/githunt/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ export enum VoteType {
172172
Up = 'UP',
173173
}
174174

175+
/** A list of options for the sort order of the feed */
176+
export type FeedType =
177+
/** Sort by a combination of freshness and score, using Reddit's algorithm */
178+
| 'HOT'
179+
/** Newest entries first */
180+
| 'NEW'
181+
/** Highest score entries first */
182+
| 'TOP';
183+
184+
/** The type of vote to record, when submitting a vote */
185+
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';
186+
175187
export type OnCommentAddedSubscriptionVariables = Exact<{
176188
repoFullName: string;
177189
}>;

0 commit comments

Comments
 (0)