Skip to content
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: type error in mapSliceZone #339

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading