@@ -58,9 +58,8 @@ type VariableValuesOrErrors =
5858 * provided variable definitions and arbitrary input. If the input cannot be
5959 * parsed to match the variable definitions, a GraphQLError will be thrown.
6060 *
61- * Note: The returned value is a plain Object with a prototype, since it is
62- * exposed to user code. Care should be taken to not pull values from the
63- * Object prototype.
61+ * Note: The `coerced` and `sources` properties of VariableValues use null
62+ * prototype to avoid collisions with JavaScript's own property names.
6463 */
6564export function getVariableValues (
6665 schema : GraphQLSchema ,
@@ -195,9 +194,8 @@ export function getFragmentVariableValues(
195194 * Prepares an object map of argument values given a list of argument
196195 * definitions and list of argument AST nodes.
197196 *
198- * Note: The returned value is a plain Object with a prototype, since it is
199- * exposed to user code. Care should be taken to not pull values from the
200- * Object prototype.
197+ * Note: The returned value uses a null prototype to avoid collisions with
198+ * JavaScript's own property names.
201199 */
202200export function getArgumentValues (
203201 def : GraphQLField < unknown , unknown > | GraphQLDirective ,
@@ -316,17 +314,16 @@ function coerceArgument(
316314 *
317315 * If the directive does not exist on the node, returns undefined.
318316 *
319- * Note: The returned value is a plain Object with a prototype, since it is
320- * exposed to user code. Care should be taken to not pull values from the
321- * Object prototype.
317+ * Note: The returned value uses a null prototype to avoid collisions with
318+ * JavaScript's own property names.
322319 */
323320export function getDirectiveValues (
324321 directiveDef : GraphQLDirective ,
325322 node : { readonly directives ?: ReadonlyArray < DirectiveNode > | undefined } ,
326323 variableValues ?: Maybe < VariableValues > ,
327324 fragmentVariableValues ?: Maybe < FragmentVariableValues > ,
328325 hideSuggestions ?: Maybe < boolean > ,
329- ) : undefined | { [ argument : string ] : unknown } {
326+ ) : undefined | ObjMap < unknown > {
330327 const directiveNode = node . directives ?. find (
331328 ( directive ) => directive . name . value === directiveDef . name ,
332329 ) ;
0 commit comments