question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for ECMA Script import

See original GitHub issue

Hi, first of all, ngraph is a great project!

Maybe I’m overworked but trying to import ngraph.graph in my TypeScript project I’m not successfull:

import createGraph from 'ngraph.graph' cause TypeError: createGraph.default is not a function import { createGraph } from 'ngraph.graph' cause Module '"ngraph.graph"' has no exported member 'createGraph'.

Am I doing something wrong or I missed something? Couldn’t find any solution on the web 😦

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tomas-javurekcommented, Oct 25, 2022

I found a solution. Adding "esModuleInterop": true in tsconfig.json do the trick. See https://www.typescriptlang.org/tsconfig#esModuleInterop

0reactions
tomas-javurekcommented, Oct 25, 2022

It would be maybe very nice to support your project by defining types on npm @types/ngraph.graph. Other libraries, such ngraph.from/todot would be typed as well… It’s very nice and usefull project and going accross the development in TypeScript can spread its use I guess.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ECMAScript modules | Node.js v19.3.0 Documentation
Node.js fully supports ECMAScript modules as they are currently specified and provides ... Dynamic import() is supported in both CommonJS and ES modules....
Read more >
import - JavaScript - MDN Web Docs - Mozilla
If an import declaration is encountered in non-module contexts (for example, <script> tags without type="module" , eval , new Function , which ...
Read more >
Announcing core Node.js support for ECMAScript modules
Node.js 13.2.0 ships support for ECMAScript modules, known for their import and export statements. This support was previously behind ...
Read more >
Documentation - ECMAScript Modules in Node.js - TypeScript
Node.js supports a new setting in package.json called type . ... When a .ts file is compiled as an ES module, ECMAScript import...
Read more >
ECMAScript Modules - Jest
Jest ships with experimental support for ECMAScript Modules (ESM). ... If your codebase includes ESM imports from *.wasm files, you do not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found