How to set type during mutation with JavaScript gRPC client?

I have tested this and work just fine

const dgraph = require("dgraph-js");

const stub = new dgraph.DgraphClientStub('localhost:9080')
const client = new dgraph.DgraphClient(stub)
const txn = client.newTxn()
const mutation = new dgraph.Mutation()

const mut = {
    email: 'foo@example.com',
    name: 'Foo',
    'dgraph.type': 'User',
    uid: '_:user'
  }


const run = async () => {
    mutation.setSetJson(mut)
    
    const response = await txn.mutate(mutation)
    await txn.commit()
    console.log(response.getUidsMap().get('user')) // "0x1"
  };

  run()

Query

{
  users(func: uid("0x2726")) {
    email
    name
    uid
    dgraph.type
  }
}
{
  "data": {
    "users": [
      {
        "email": "foo@example.com",
        "name": "Foo",
        "uid": "0x2726",
        "dgraph.type": [
          "User"
        ]
      }
    ]
  }
}

This also works

{
  users(func: type(User)) {
    email
    name
    uid
    dgraph.type
  }
}