title: What do these parens/comma mean in this value assignment?
body: <p>I am working on porting the GraphQL reference implementation from javascript to C#.  I came across something I don't understand or know how to reason about so I'm unsure the correct way to port it.  The code in question is shown below or you can go to this link to see the code in the repo <a href="https://github.com/graphql/graphql-js/blob/271e23e13ec093e7ffb844e7ffaf340ab92f053e/src/language/parser.js#L448" rel="nofollow noreferrer">parseConstArgument function in parse.js</a>:</p>
  
  
  
  <pre><code>    function parseConstArgument(lexer: Lexer&lt;*&gt;): ArgumentNode {
    const start = lexer.token;
    return {
      kind: Kind.ARGUMENT,
      name: parseName(lexer),
      value: (expectToken(lexer, TokenKind.COLON), parseConstValue(lexer)),
      loc: loc(lexer, start),
    };
  }
  </code></pre>
  
  <p>So what I am not understanding is the line making the assignment to the <strong>value</strong> field.  The <strong>expectToken</strong> function either returns an <strong>Token</strong> object or throws an error.  The <strong>parseConstValue</strong> function returns a <strong>ValueNode</strong> object.  The <strong>value</strong> field itself expects to be assigned a <strong>ValueNode</strong>.</p>
  
  <p>So what is this doing? Does it first exectute <strong>expectToken</strong> to make use of the possible error and if no error thrown it throws away the <strong>Token</strong> returned and then assigns the result of <strong>parseConstValue</strong> to the <strong>value</strong> field?  That is my best guess, but I'm not 100% sure and I don't know how to describe this syntax to do a Google search on it.</p>
  
  <p>Another similarly confusing field assignment is like the one here <a href="https://github.com/graphql/graphql-js/blob/271e23e13ec093e7ffb844e7ffaf340ab92f053e/src/language/parser.js#L554" rel="nofollow noreferrer">parseValueLiteral function in parse.js</a></p>
  
  <pre><code>return {
      kind: Kind.INT,
      value: ((token.value: any): string),
      loc: loc(lexer, token),
    };
  </code></pre>
  
  <p>Again my confusion is with the assignment to the value field.  In this case <strong>value</strong> expects a string, so I am just assuming this "weird" syntax is just assigning <strong>token.value</strong>, which is a string, to the <strong>value</strong> field.</p>
  
  <p>It would be much appreciated if someone could explain this and possible point to documentation on these javascript features.  I really would like to make sure I am not introducing bugs in my port because I don't understand the javascript syntax.</p>