# Ts issue with contentrelationship fields

**URL:** <https://community.prismic.io/t/ts-issue-with-contentrelationship-fields/18035>\
**Category:** Developing with Prismic\
**Tags:** typescript, nuxtjs\
**Created:** [November 20, 2024, 2:22pm UTC](https://community.prismic.io/t/ts-issue-with-contentrelationship-fields/18035 "2024-11-20T14:22:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jankohlbach](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jankohlbach/32/8998_2.png) [@jankohlbach](https://community.prismic.io/u/jankohlbach)\
**Post date:** [November 20, 2024, 2:22pm UTC](https://community.prismic.io/t/ts-issue-with-contentrelationship-fields/18035/1 "2024-11-20T14:22:36Z")

</div>

## Describe your question/issue in detail

I'm having issues with typescript when using contentrelationship fields when I wan to use them like following:

```auto
      <div class="container">
        <div class="grid">
          <h2>{{ item.category.data.title }}</h2>
        </div>
        <div
          v-if="isFilled.contentRelationship(item.category)"
          class="grid"
        >
          <h2>{{ item.category.data.title }}</h2>
        </div>
      </div>

```

 ![Screenshot 2024-11-20 at 15.17.41](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/1/11d64de902c75a872378d6971324e969ce1c1d20.png)

first error is because it could be an empty relationship field:

 ![Screenshot 2024-11-20 at 15.18.11](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/3/3ec1c4e5e7d22054ca87eb03bf8f7c17acfe26f7.png)

so I tried to fix that by using isFilled.contentRelationship, but then I get another error that I don't know how to fix/type:

 ![Screenshot 2024-11-20 at 15.19.11](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/b/b29bc8a373bff504e9f91a7f3d43e43f7748e24b.png)

would love to hear ideas how to fix that because I don't want to add every single time, feels hacky

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 21, 2024, 11:01am UTC](https://community.prismic.io/t/ts-issue-with-contentrelationship-fields/18035/3 "2024-11-21T11:01:12Z")

</div>

Hi @jankohlbach,

We've discussed this previously here and you'll find the solution in that thread 🙂

> [@TypeScript Content Relationships in Nuxt](https://community.prismic.io/t/typescript-content-relationships-in-nuxt/14700/12):
>
> Hey @leopold, Thanks for your patience! I looked into this and I think I might have a solution for you. This is based on a solution that our engineer Angelo developed for typing fetchLinks in Next.js, but I've tested it in Nuxt and it seems to be working. Typically we use the $prismic.isFilled helpers to check if a property exists. However — as you have encountered here — TypeScript doesn't know the structure of the linked data. Angelo wrote a helper to take care of that — isFilledRelatedData(…

Thanks.

---

<div class="post-metadata">

**Author:** ![jankohlbach](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jankohlbach/32/8998_2.png) [@jankohlbach](https://community.prismic.io/u/jankohlbach)\
**Post date:** [November 25, 2024, 9:02am UTC](https://community.prismic.io/t/ts-issue-with-contentrelationship-fields/18035/5 "2024-11-25T09:02:12Z")

</div>

hey, that works, amazing  
just couldn't find that haha  
but feels way better than adding the comments everywhere 🤌🏼
