diff --git a/src/execution/values.ts b/src/execution/values.ts index 5b2a1ceee2..623060203b 100644 --- a/src/execution/values.ts +++ b/src/execution/values.ts @@ -205,8 +205,8 @@ export function getArgumentValues( variableValues?: Maybe, fragmentVariableValues?: Maybe, hideSuggestions?: Maybe, -): { [argument: string]: unknown } { - const coercedValues: { [argument: string]: unknown } = {}; +): ObjMap { + const coercedValues: ObjMap = Object.create(null); const argumentNodes = node.arguments ?? []; const argNodeMap = new Map(argumentNodes.map((arg) => [arg.name.value, arg])); diff --git a/src/utilities/coerceInputValue.ts b/src/utilities/coerceInputValue.ts index 87895c2262..7be15ef677 100644 --- a/src/utilities/coerceInputValue.ts +++ b/src/utilities/coerceInputValue.ts @@ -2,6 +2,7 @@ import { invariant } from '../jsutils/invariant.js'; import { isIterableObject } from '../jsutils/isIterableObject.js'; import { isObjectLike } from '../jsutils/isObjectLike.js'; import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; import type { ValueNode, VariableNode } from '../language/ast.js'; import { Kind } from '../language/kinds.js'; @@ -69,7 +70,7 @@ export function coerceInputValue( return; // Invalid: intentionally return no value. } - const coercedValue: any = {}; + const coercedValue: ObjMap = Object.create(null); const fieldDefs = type.getFields(); const hasUndefinedField = Object.keys(inputValue).some( (name) => !Object.hasOwn(fieldDefs, name), @@ -211,7 +212,7 @@ export function coerceInputLiteral( return; // Invalid: intentionally return no value. } - const coercedValue: { [field: string]: unknown } = {}; + const coercedValue: ObjMap = Object.create(null); const fieldDefs = type.getFields(); const hasUndefinedField = valueNode.fields.some( (field) => !Object.hasOwn(fieldDefs, field.name.value),