# Slice items typing (next & typescript)

**URL:** <https://community.prismic.io/t/slice-items-typing-next-typescript/16136>\
**Category:** Developing with Prismic\
**Tags:** typescript\
**Created:** [June 14, 2024, 4:04pm UTC](https://community.prismic.io/t/slice-items-typing-next-typescript/16136 "2024-06-14T16:04:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrp](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/lrp/32/5728_2.png) [@lrp](https://community.prismic.io/u/lrp)\
**Post date:** [June 14, 2024, 4:04pm UTC](https://community.prismic.io/t/slice-items-typing-next-typescript/16136/1 "2024-06-14T16:04:03Z")

</div>

This code will fail because of a typing error:

```auto
export type Card = { (listing of props from prismic document)
    icon: string;
    name: AnyRegularField;
    text: AnyRegularField;
    cta_text: AnyRegularField;
    cta_link: FilledLinkToDocumentField<string, string, never> | FilledLinkToWebField;
};
{slice.items.map(({ icon, name, text, cta_text, cta_link }: Card) => (...)))}

```

On line 9, i am having the error:

```auto
Type 'Record<string, AnyRegularField>' is missing the following properties from type 'Card': icon, name, text, cta_text, cta_link

```

Doing this would fix this error:

```auto
{slice.items.map(({ icon, name, text, cta_text, cta_link }: Record<string, AnyRegularField>) => (...)))}

```

But I don’t want to do this as I would lose the typing of icon for example, which has to be a string in the rest of my code:

```auto
<Icon name={icon} ... />

```

name property of my Icon component has to be of type `string` (and not `AnyRegularField`)

How could I solve this issue knowing that I have to type correctly the props that come from my prismic doc?

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [June 17, 2024, 7:51am UTC](https://community.prismic.io/t/slice-items-typing-next-typescript/16136/2 "2024-06-17T07:51:14Z")

</div>

Hi Louis,

Could you provide more context? Which line is line 9, and where is the definition for `Record`?

Sam
