Dgraph-Js doesn't offer a default export for typescript

Hey All,

Dgraph-JS does not seem to offer a default export, so it’s fails silently with typescript if --esModuleInterop is set.

Here is a minimal example:

First, what I expect from the javascript

const dgraph = require("dgraph-js");
console.log(dgraph); // This outputs a bunch of classes

Now let’s look at the same thing from typescript

import dgraph from 'dgraph-js';
console.log(dgraph); // This outputs undefined

Here is the command to compile:

tsc --module commonjs --moduleResolution node --esModuleInterop true foo.ts

Do note that compilation fails if esModuleInterop is set to false, as there is no default export (but then other modules work correctly with esModuleInterop also fail)

This is super annoying because it makes it very difficult to port from javascript to typescript

@vardhanapoorv gave the following workaround

import * as dgraph from 'dgraph-js';
console.log(dgraph); // Outputs things normally

This PR adds support for it. Will be part of the next version of npm package published.