Skip to content

Commit aa43fec

Browse files
authored
Narrow the return type of astFromValue (#3864)
1 parent 265513d commit aa43fec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utilities/astFromValue.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isIterableObject } from '../jsutils/isIterableObject.js';
44
import { isObjectLike } from '../jsutils/isObjectLike.js';
55
import type { Maybe } from '../jsutils/Maybe.js';
66

7-
import type { ObjectFieldNode, ValueNode } from '../language/ast.js';
7+
import type { ConstObjectFieldNode, ConstValueNode } from '../language/ast.js';
88
import { Kind } from '../language/kinds.js';
99

1010
import type { GraphQLInputType } from '../type/definition.js';
@@ -41,7 +41,7 @@ import { GraphQLID } from '../type/scalars.js';
4141
export function astFromValue(
4242
value: unknown,
4343
type: GraphQLInputType,
44-
): Maybe<ValueNode> {
44+
): Maybe<ConstValueNode> {
4545
if (isNonNullType(type)) {
4646
const astValue = astFromValue(value, type.ofType);
4747
if (astValue?.kind === Kind.NULL) {
@@ -83,7 +83,7 @@ export function astFromValue(
8383
if (!isObjectLike(value)) {
8484
return null;
8585
}
86-
const fieldNodes: Array<ObjectFieldNode> = [];
86+
const fieldNodes: Array<ConstObjectFieldNode> = [];
8787
for (const field of Object.values(type.getFields())) {
8888
const fieldValue = astFromValue(value[field.name], field.type);
8989
if (fieldValue) {

0 commit comments

Comments
 (0)