Skip to content

Commit

Permalink
fix: type error in mapSliceZone (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore authored Apr 12, 2024
1 parent 8b20c5a commit 638e87a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/helpers/mapSliceZone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type AnyFunction = (...args: any[]) => any;
*
* @typeParam Slice - The Slice from which the type will be extracted.
*/
type ExtractSliceType<TSlice extends SliceLike> = TSlice extends Slice
type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2
? TSlice["slice_type"]
: TSlice extends SliceLikeGraphQL
? TSlice["type"]
Expand Down Expand Up @@ -175,7 +175,7 @@ type MapSliceLike<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TSliceLike extends SliceLike<any>,
TSliceMappers extends SliceMappers<
SliceLike<ExtractSliceType<TSliceLike>>,
TSliceLike,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
any
>,
Expand Down Expand Up @@ -232,13 +232,7 @@ export function mapSliceZone<
sliceZone: SliceZoneLike<TSliceLike>,
mappers: TSliceMappers,
context?: TContext,
): Promise<
MapSliceLike<
TSliceLike,
// @ts-expect-error - I don't know how to fix this type
TSliceMappers
>[]
> {
): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {
return Promise.all(
sliceZone.map(async (slice, index, slices) => {
const isRestSliceType = "slice_type" in slice;
Expand Down

0 comments on commit 638e87a

Please sign in to comment.