-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
113 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 54 additions & 49 deletions
103
packages/graphql-zeus-core/TreeToTS/templates/returnedTypes/enum.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/graphql-zeus-core/TreeToTS/templates/returnedTypes/enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { plusDescription } from '@/TreeToTS/templates/shared/description'; | ||
import { ParserField } from 'graphql-js-tree'; | ||
|
||
export const resolveEnum = (i: ParserField): string => { | ||
export const resolveEnum = (i: ParserField, constEnum?: boolean): string => { | ||
if (!i.args) { | ||
throw new Error('Empty enum error'); | ||
} | ||
return `${plusDescription(i.description)}export const enum ${i.name} {\n${i.args | ||
return `${plusDescription(i.description)}export ${constEnum ? 'const ' : ''}enum ${i.name} {\n${i.args | ||
.map((f) => `\t${f.name} = "${f.name}"`) | ||
.join(',\n')}\n}`; | ||
}; |
Oops, something went wrong.