Nuxt3 Typescript MediaField no kind and url property

hey there,
another typescript question
I have a link to media field, because you could add a video or an image
so, in the code I have to check what type of media it is, and I wanted to do that with v-if=" === 'document'" for video otherwise image
but, I get an error Property 'kind' does not exist on type 'LinkToMediaField'. Property 'kind' does not exist on type 'EmptyLinkField<"Media">'
same thing with url
works if I use it like ( as prismic.FilledLinkToMediaField).kind but not sure this is the way to go ...

Hey @jankohlbach,

I'm not certain, but I think the problem is that will not exist if the field is unfilled. If that's the case, you're on the right track by using FilledLinkToMediaField. You might have better luck by using Something like:

  && === 'document'

Let me know if that helps.



Hey @samlittlefair

yeah, using:

import { isFilled } from '@prismicio/client'

v-if="isFilled.linkToMedia( && === 'document'"

did it for me, thanks a lot, that feels cleaner :slight_smile:


Using isFilled worked for me too to bypass the URL problem.

1 Like

Great! I'm glad it worked.

1 Like