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:
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)