Skip to content

Commit

Permalink
Merge branch 'master' into aa/dt-2078-aadevuser-i-can-use-prismiciocl…
Browse files Browse the repository at this point in the history
…ient-to-fetch-and-type-slice
  • Loading branch information
angeloashmore committed Apr 27, 2024
2 parents 685792d + f141026 commit 9afde3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ All notable changes to this project will be documented in this file. See [standa
* release alpha as minor ([9bd6355](https://github.com/prismicio/prismic-client/commit/9bd6355d7098f45f221821e3485edc8bad05f29e))
* use `@prismicio/types-internal` alpha ([df8f63d](https://github.com/prismicio/prismic-client/commit/df8f63d858227a246913dac33f15529294fc0515))

### [7.4.1](https://github.com/prismicio/prismic-client/compare/v7.4.0...v7.4.1) (2024-04-13)


### Bug Fixes

* type error in `mapSliceZone` ([#339](https://github.com/prismicio/prismic-client/issues/339)) ([638e87a](https://github.com/prismicio/prismic-client/commit/638e87aeb97a04c0b8fbb160bd65a1d26028335e))

## [7.4.0](https://github.com/prismicio/prismic-client/compare/v7.3.1...v7.4.0) (2024-03-27)


Expand Down
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 9afde3a

Please sign in to comment.