-
-
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
TypeScript declarations are failing on iterables #47
Comments
Also, the |
Thanks for the feedback! There's another issue around the typings that I haven't been able to get to yet. I didn't write them and I don't know that much about TypeScript, but I've been meaning to get into it. I'll also accept a PR with fixes though! |
I will try to look into it if time permits. By the way, what other issue you were having with declarations? |
I just ran into the same problem and fixed it using patch-package, so I could easily submit a PR. What do you think? |
I had issues with the typings. I wrote up: // fix 2018-01-08
export = PromisePool
declare class PromisePool<A> extends EventTarget {
// skip GeneratorFunction as that is documented to be deprecated starting v3
constructor(
source: IterableIterator<Promise<A>> | Promise<A> | (() => (Promise<A> | void)) | A,
concurrency: number,
options?: PromisePool.Options<A>
)
concurrency(concurrency: number): number
size(): number
active(): boolean
promise(): PromiseLike<void>
start(): PromiseLike<void>
}
declare namespace PromisePool {
export interface Options<A> {
promise?: Promise<A>
}
} Added the new index.d.ts to But I've not extensively testing the typings though. I needed the result of calling a GeneratorFunction and the others look valid based on reviewing the source code. Note that I just overrode the typings. I use webpack for final bundling. |
This definitions also fails with error TS2304: Cannot find name 'EventTarget' |
Hello!
Thank you for this great library!
However, when I try to use iterable with it, the compilers throws errors:
So I have to call it this way in order to suppress the error:
new PromisePool(generator() as any, 10);
.Maybe, the declaration should be changed to:
source: () => PromiseLike<A> | IterableIterator<Promise<A>>
?Thanks!
The text was updated successfully, but these errors were encountered: