Dgraph-js only accepts strings as query args

Issue summary

Vars containing values that are not strings or String objects are ignored when using queryWithVars() in dgraph-js. This causes dgraph to return the obscure error documented in Grpc error when running query.

Proposed resolution

  • Remove the check in txn.ts that enforces that args are strings or String objects.
  • Coerce all values to strings for backwards compatibility with String objects.
  • Improve type safety for the vars parameter so only acceptable primitives and String objects can be passed in.

Alternately, if there is a reason that only strings or String objects should be accepted, throw a usable error is a var is received that is not of those types and set the type of the vars to string | String instead of any.

May be resolved with Remove checks for string or String and improve types. by bumpusfrancus · Pull Request #128 · dgraph-io/dgraph-js · GitHub

I would include a test, but the existing test suite doesn’t run for me.