Skip to content

Commit 1d46220

Browse files
committed
Reduce any usage
1 parent f778e68 commit 1d46220

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import * as graphql from "graphql";
2323
type Maybe<T> = null | undefined | T;
2424

2525
// If GraphQL doesn't have this helper function, then it doesn't natively support GraphQLSemanticNonNull
26-
const isSemanticNonNullType =
26+
const isSemanticNonNullType: (
27+
t: unknown,
28+
) => t is { ofType: GraphQLNullableType } =
29+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2730
(graphql as any).isSemanticNonNullType ?? (() => false);
2831

2932
function convertSchema(schema: GraphQLSchema, toStrict: boolean) {
@@ -103,9 +106,7 @@ function makeConvertType(toStrict: boolean) {
103106
return type;
104107
}
105108
if (isSemanticNonNullType(type)) {
106-
const unwrapped = convertType(
107-
(type as any).ofType as GraphQLNullableType,
108-
);
109+
const unwrapped = convertType(type.ofType);
109110
// Here's where we do our thing!
110111
if (toStrict) {
111112
return new GraphQLNonNull(unwrapped);
@@ -195,10 +196,7 @@ export function convertFieldConfig(
195196
// Strip semantic-non-null types; this should never happen but if someone
196197
// uses both semantic-non-null and the `@semanticNonNull` directive, we
197198
// want the directive to win (I guess?)
198-
return recurse(
199-
(type as any).ofType as GraphQLNullableType & GraphQLOutputType,
200-
level,
201-
);
199+
return recurse(type.ofType, level);
202200
} else if (isNonNullType(type)) {
203201
const inner = recurse(type.ofType, level);
204202
if (isNonNullType(inner)) {

0 commit comments

Comments
 (0)