# Slice model typescript

**URL:** <https://community.prismic.io/t/slice-model-typescript/4291>\
**Category:** Developing with Prismic\
**Created:** [February 26, 2021, 2:11pm UTC](https://community.prismic.io/t/slice-model-typescript/4291 "2021-02-26T14:11:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxime.hersand](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@maxime.hersand](https://community.prismic.io/u/maxime.hersand)\
**Post date:** [February 26, 2021, 2:11pm UTC](https://community.prismic.io/t/slice-model-typescript/4291/1 "2021-02-26T14:11:46Z")

</div>

Hello,

I start to create a nuxt with slicemachine. I decided to use typescript on my project.

I'm wondering about the .json model of a slice. I have a select type with options. I will have to test these entries in my component.

My question

Is it possible to have a typescript model that builds and exports a json to allow me to create a class that reflects this json and to have an enum structure that contains my options? The objective is to reduce string duplication in tests and to have only one source of truth.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [March 5, 2021, 1:26am UTC](https://community.prismic.io/t/slice-model-typescript/4291/4 "2021-03-05T01:26:51Z")

</div>

Hello @maxime.hersand thanks for reaching out!

Could you give us some more details about your use case?  
Where wold these typescript model and JSONs files be located in your project, and how do you imagine them being generated in Slicemachine?

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [March 11, 2021, 4:00pm UTC](https://community.prismic.io/t/slice-model-typescript/4291/6 "2021-03-11T16:00:50Z")

</div>

This issue has been closed due to inactivity. [Flag to reopen](https://community.prismic.io/t/re-open-a-thread/2175).

---

<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:** [March 24, 2021, 3:40pm UTC](https://community.prismic.io/t/slice-model-typescript/4291/11 "2021-03-24T15:40:33Z")

</div>

Hi @maxime.hersand ,

I'm not sure what you mean here, do you want to create a Typescript interface from the model.json file?

Thanks.

---

<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:** [March 25, 2021, 10:37am UTC](https://community.prismic.io/t/slice-model-typescript/4291/12 "2021-03-25T10:37:58Z")

</div>



---

<div class="post-metadata">

**Author:** ![maxime.hersand](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@maxime.hersand](https://community.prismic.io/u/maxime.hersand)\
**Post date:** [March 25, 2021, 11:18am UTC](https://community.prismic.io/t/slice-model-typescript/4291/13 "2021-03-25T11:18:03Z")

</div>

Hello,

Sorry I take no time to answer.

What I mean is for example I have a select name status with options :

- agenda
- preco
- stock

To avoid creating an enum which will be a duplication of what is declare in custom\_type, is there a way to match typescript enum or something to had something like

`v-if="slice.primary.status === STATUS.agenda"`

And avoid have to declare somewhere :

```
export enum STATUS {
   agenda: 'agenda';
   preco: 'preco';
   stock: 'stock';
}

```

My reflexion is if for some reason I want to add a status, automaticaly I could test `STATUS.newOption`

---

<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:** [July 8, 2021, 12:19pm UTC](https://community.prismic.io/t/slice-model-typescript/4291/14 "2021-07-08T12:19:24Z")

</div>

Being discussed here:

> [@Slicemachine type generations for typescript projects](https://community.prismic.io/t/slicemachine-type-generations-for-typescript-projects/4658/9):
>
> Hi Jeremy, I got a response from the team and they are not working on it at the moment, but the DevExp team plans to work on this after holidays. Thanks.

---

<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:** [July 8, 2021, 12:19pm UTC](https://community.prismic.io/t/slice-model-typescript/4291/15 "2021-07-08T12:19:29Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:51pm UTC](https://community.prismic.io/t/slice-model-typescript/4291/21 "2021-12-09T17:51:08Z")

</div>


