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

ImageField<ThumbnailNames> works with a single string literal, but not a union #27

Closed benwest closed 2 years ago

benwest commented 2 years ago

It looks to me like ImageField is supposed to accept multiple ThumbnailNames as a union, but that doesn't work. Am I using it wrong?

import * as prismicT from "@prismicio/types"

const img1: prismicT.ImageField<"small">
img1.small // fine

const img2: prismicT.ImageField<"small" | "medium">
img2.small // Property 'small' does not exist on type...

Playground

lihbr commented 2 years ago

Hey there, thank you so much for the report!

You're doing everything right, so valid bug confirmed ✔️ We're working on fixing it in #29, should go out fairly soon if everything's alright :)