-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix typings for use inside node.js #40
Conversation
❌ Build es6-promise-pool 156 failed (commit 31bce7c1c0 by @urish) |
Thanks for contributing! Is this ultimately caused by this TypeScript issue? In that case, maybe it's also worth mentioning that there's a legacy API with a named export rather than the default one that TypeScript is struggling with. I'm not sure if the compiler will understand it (and you'd need to add typings) but in ES6, this is also possible: import { PromisePool } from 'es6-promise-pool' I don't want to keep that API around per se because as I said, it's a legacy thing, but it does seem cleaner than I'm no TypeScript expert though. The typings were contributed by @bcherny. Maybe he wants to weigh in as well? |
Hi Tim, thanks for the super quick and thoughtful response. Yes, it seems to be related. From examples in the typescript documentation (and also here), seems like they use the following syntax:
However, it seems like the current typings don't play well with this syntax (typescript complains about I created a super-small demo repo for this, just git clone, npm install, npm start to watch it in in action: https://github.com/urish/es6-promise-pool-typescript |
Hmm, I'm curious why it worked for @bcherny then. We use TypeScript at work though. I'll ask someone on my team next week just to make sure we don't break anything. 🙂 |
Awesome, thanks! Feel free to ping me if anything. And thanks for this awesome library, I recently used it in a project and it was a perfect fit |
Hi there, any update to this? Currently seems like for ts/es6/cjs purposes many are switching away from default exports since it just makes things easier. |
FWIW, I have the same problem trying to use it with TypeScript and the PR fixed it. |
Closing due to inactivity. |
With the current typings, you must write your import as
however, this causes a runtime error in Node.js:
This commit changes the supported TypeScript import syntax to
which works correctly in Node.js