Friday 25 January 2019

Module export default ES5

Hi, I am working on an npm package. I export my function like this module.exports = myFn;. In a javascript project, I can import it like import myFn from 'mylib'; or const myFn = require('mylib'); but then I import it in a typescript project I can use only import * as myFn from 'mylib'; or import myFn = require('mylib');. I what to use it as import myFn from 'mylib'; and I am getting error TS1192: Module '"mylib"' has no default export.. How can I add default export to my package?

Submitted January 25, 2019 at 09:38AM by dr4605

No comments:

Post a Comment