diff --git a/index.test-d.ts b/index.test-d.ts index 58acea4..7cf4f99 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -7,6 +7,33 @@ const sites = [ 'https://github.com', ]; +const sitesWithPromises = [ + 'https://sindresorhus.com', + Promise.resolve('https://avajs.dev'), + Promise.resolve('https://github.com'), +]; + +const sitesAsyncIterable = { + async * [Symbol.asyncIterator]() { + yield 'https://sindresorhus.com'; + yield 'https://avajs.dev'; + yield 'https://github.com'; + }, +}; + +const sitesAsyncIterableWithPromises: AsyncIterable> = { + [Symbol.asyncIterator]() { + return { + async next() { + return { + done: false, + value: Promise.resolve('https://github.com'), + }; + }, + }; + }, +}; + const numbers = [ 0, 1, @@ -50,3 +77,6 @@ expectType>(pMap(numbers, (number: number) => { })); expectType>(pMapIterable(sites, asyncMapper)); +expectType>(pMapIterable(sitesWithPromises, asyncMapper)); +expectType>(pMapIterable(sitesAsyncIterable, asyncMapper)); +expectType>(pMapIterable(sitesAsyncIterableWithPromises, asyncMapper));