Skip to content

Commit

Permalink
make test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian committed Aug 21, 2024
1 parent 12971e2 commit 79e823c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/utils/should-consolidate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ function typesAreEquivalent(
const matchingInputField = inputNode.astNode?.fields?.find(
(inputField) => inputField.name.value === typeField.name.value,
);
if (!matchingInputField?.type) return false;
if (
!matchingInputField?.type ||
typeField.type.kind !== matchingInputField.type.kind
) {
return false;
}

const baseTypeName = getBaseTypeNode(typeField.type).name.value;
const baseInputTypeName = getBaseTypeNode(matchingInputField.type).name
.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,9 @@ data class MyNullabilityType(

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])
data class MyNullabilityTypeInput(
val field1: MyNestedNullabilityTypeInput
val field1: MyNestedNullabilityType? = null
)

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT])
data class MyNestedNullabilityType(
val field2: String
)

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])
data class MyNestedNullabilityTypeInput(
val field2: String
)

0 comments on commit 79e823c

Please sign in to comment.