Imports question. I'm using a library (https://www.npmjs.com/package/indefinite) where I can do this:
import * as indefinite from 'indefinite';
console.log(indefinite.default('apple'));
The default part 'feels' wrong to me. Is there a better way to import that?
It works though so... deal with it?
@raymondcamden Probably about as elegant as you’re going to get if you do need to import everything from the module
@aral i used @sirlan's example - worked great :)
@raymondcamden But won’t that only import default? If you’re going to do that why not just do:
import a from ‘indefinite’
(Or am I missing something?) :)
@aral it worked, thats all i know :)
went with: import { default as ind } from 'indefinite';
and ind(...) works fine.
@raymondcamden Ah right, if the default export is all you need, the line I gave you should work too and it’s a bit more common :)
In this case:
import ind from ‘indefinite’
@aral ah... so we dont need the as X part as default is... well default.
right thinking there?
@aral muchas gracias!