Skip to content

Commit dd29e4e

Browse files
authored
refactor: rename ExtractAsyncIterValue internal type into DeasyncIterized (#61)
1 parent 8357aff commit dd29e4e

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

src/common/DeasyncIterized.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { type DeasyncIterized };
2+
3+
type DeasyncIterized<T> = T extends AsyncIterable<infer InnerVal> ? InnerVal : T;

src/common/ExtractAsyncIterValue.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/common/isAsyncIter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { type ExtractAsyncIterValue } from './ExtractAsyncIterValue.js';
1+
import { type DeasyncIterized } from './DeasyncIterized.js';
22

33
export { isAsyncIter };
44

5-
function isAsyncIter<T>(input: T): input is T & AsyncIterable<ExtractAsyncIterValue<T>> {
5+
function isAsyncIter<T>(input: T): input is T & AsyncIterable<DeasyncIterized<T>> {
66
const inputAsAny = input as any;
77
return typeof inputAsAny?.[Symbol.asyncIterator] === 'function';
88
}

src/iterateFormatted/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from '../common/ReactAsyncIterable.js';
66
import { asyncIterSyncMap } from '../common/asyncIterSyncMap.js';
77
import { isAsyncIter } from '../common/isAsyncIter.js';
8-
import { type ExtractAsyncIterValue } from '../common/ExtractAsyncIterValue.js';
8+
import { type DeasyncIterized } from '../common/DeasyncIterized.js';
99
import { type AsyncIterableSubject } from '../AsyncIterableSubject/index.js';
1010
import { type useAsyncIter } from '../useAsyncIter/index.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
1111
import { type Iterate } from '../Iterate/index.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
@@ -81,10 +81,10 @@ export { iterateFormatted };
8181
function iterateFormatted<TIn, TRes>(
8282
source: TIn,
8383
formatFn: (
84-
value: ExtractAsyncIterValue<TIn> | (TIn extends AsyncIterableSubject<infer J> ? J : never),
84+
value: DeasyncIterized<TIn> | (TIn extends AsyncIterableSubject<infer J> ? J : never),
8585
i: number
8686
) => TRes
87-
): ReactAsyncIterable<ExtractAsyncIterValue<TIn>, TRes> &
87+
): ReactAsyncIterable<DeasyncIterized<TIn>, TRes> &
8888
(TIn extends AsyncIterableSubject<unknown>
8989
? { value: AsyncIterableSubject<TRes>['value'] }
9090
: { value: undefined });

src/useAsyncIter/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ type IterationResult<TVal, TInitVal = undefined> = {
225225
* Will appear `false` for any iterations thereafter and reset back every time the iteratee
226226
* is changed to a new one.
227227
*
228-
* Can be used in certain cases for displaying _"loading" states_ metaphorically similar to
229-
* a how a pending state of a promise is thought of.
228+
* Can be used for displaying _"loading" states_ in many cases, metaphorically similar to
229+
* a how promise's pending state is thought of.
230230
*
231231
* Is always `false` for any plain value given instead of an async iterable.
232232
*/
@@ -279,5 +279,3 @@ type IterationResult<TVal, TInitVal = undefined> = {
279279
}
280280
))
281281
);
282-
283-
type ___1 = { a: string } & never;

0 commit comments

Comments
 (0)