Skip to content

Commit 0461021

Browse files
authored
[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 8babe46 commit 0461021

25 files changed

+466
-29
lines changed

.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
@@ -169,6 +169,18 @@ export enum VoteType {
169169
Up = 'UP',
170170
}
171171

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

dev-test/githunt/types.avoidOptionals.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ export enum VoteType {
168168
Up = 'UP',
169169
}
170170

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

dev-test/githunt/types.d.ts

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

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

dev-test/githunt/types.enumsAsTypes.ts

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

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

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ export enum VoteType {
168168
Up = 'UP',
169169
}
170170

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

dev-test/githunt/types.immutableTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ export enum VoteType {
168168
Up = 'UP',
169169
}
170170

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

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ export enum VoteType {
3131
Up = 'UP',
3232
}
3333

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

dev-test/githunt/types.preResolveTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ export enum VoteType {
168168
Up = 'UP',
169169
}
170170

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

dev-test/githunt/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ export enum VoteType {
168168
Up = 'UP',
169169
}
170170

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

0 commit comments

Comments
 (0)