prismicio / prismic-types

Type definitions for Prismic content, models, and APIs
https://prismic.io/docs/technologies/javascript
Apache License 2.0
11 stars 4 forks source link

asImageWidthSrcSet does not accept ImageField #30

Closed benwest closed 2 years ago

benwest commented 2 years ago

asImageWidthSrcSet expects an ImageFieldImage, but in the docs it appears to be accepting an ImageField.

Reproduction

import { asImageWidthSrcSet } from "@prismicio/helpers"
import * as prismicT from "@prismicio/types"

const image = {} as prismicT.ImageField
asImageWidthSrcSet(image) // Argument of type 'ImageField<never, FieldState>' is not assignable to parameter of type 'EmptyImageFieldImage | FilledImageFieldImage'.
lihbr commented 2 years ago

Hey there, thank you so much for the report again!

We're facing some TypeScript limitations with this type indeed... We'll attempt at fixing it without introducing further regression again!

lihbr commented 2 years ago

Fixed in 0.1.27 🎉

Updating @prismicio/types should fix the issue, let us know if you still encounter issues 🙏