Skip to content

Commit 3b84d3f

Browse files
simonljusCode-Hex
authored andcommitted
support InterfaceTypeDefinitionNode
1 parent 21dce0e commit 3b84d3f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/visitor.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { TsVisitor } from '@graphql-codegen/typescript';
2-
import type { FieldDefinitionNode, GraphQLSchema, NameNode, ObjectTypeDefinitionNode } from 'graphql';
3-
import { specifiedScalarTypes } from 'graphql';
2+
import {
3+
FieldDefinitionNode,
4+
GraphQLSchema,
5+
InterfaceTypeDefinitionNode,
6+
NameNode,
7+
ObjectTypeDefinitionNode,
8+
specifiedScalarTypes,
9+
} from 'graphql';
410

511
import type { ValidationSchemaPluginConfig } from './config';
612

@@ -53,8 +59,8 @@ export class Visitor extends TsVisitor {
5359
}
5460

5561
public buildArgumentsSchemaBlock(
56-
node: ObjectTypeDefinitionNode,
57-
callback: (typeName: string, field: FieldDefinitionNode) => string,
62+
node: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode,
63+
callback: (typeName: string, field: FieldDefinitionNode) => string
5864
) {
5965
const fieldsWithArguments = node.fields?.filter(field => field.arguments && field.arguments.length > 0) ?? [];
6066
if (fieldsWithArguments.length === 0)

0 commit comments

Comments
 (0)