Skip to content

Commit fe212a4

Browse files
authored
chore(enum-array): plugin is sync (dotansimha#7917)
* chore(enum-array): plugin can be sync * Update index.ts * Update index.ts * add changeset
1 parent 8eb5ad8 commit fe212a4

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.changeset/early-waves-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/typescript-enum-array': patch
3+
---
4+
5+
chore: remove async from a plugin, as it's never was async

packages/plugins/typescript/enum-array/src/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,16 @@ function buildImportStatement(enums: GraphQLEnumType[], importFrom: string): str
3030
return [`import { ${names.join(', ')} } from "${importFrom}";`];
3131
}
3232

33-
export const plugin: PluginFunction<EnumArrayPluginConfig> = async (
33+
export const plugin: PluginFunction<EnumArrayPluginConfig> = (
3434
schema: GraphQLSchema,
3535
_documents: Types.DocumentFile[],
3636
config: EnumArrayPluginConfig
37-
): Promise<Types.PluginOutput> => {
38-
const importFrom: EnumArrayPluginConfig['importFrom'] = config.importFrom;
37+
): Types.PluginOutput => {
3938
const enums = getEnumTypeMap(schema);
4039
const content = enums.map(buildArrayDefinition).join('\n');
41-
4240
const result: Types.PluginOutput = { content };
43-
if (importFrom) {
44-
result['prepend'] = buildImportStatement(enums, importFrom);
41+
if (config.importFrom) {
42+
result['prepend'] = buildImportStatement(enums, config.importFrom);
4543
}
4644
return result;
4745
};

0 commit comments

Comments
 (0)