Types for the `frontity` state

Hi folks! :smiley:

Iā€™m trying to migrate the existent mars-theme to typescript as a starting point for a new theme and I noticed there is no way to know the types of the state.frontity fields. Should I define them manually in my themeā€™s types or should they be defined somewhere else?

EDIT: Also, I noticed that tiny-router is importing @frontity/router types, but that package is declared as a dev dependency, so when you do npm i inside a Frontity project, those packages are not installed and you will have TypeScript complaining.

Uh, TypeScript in Mars! :ringer_planet::heart::raised_hands:


Good question. Iā€™ve only defined url because Iā€™m not sure which ones should be the standard.

I wonā€™t like to add too many things to the ā€œstandardā€. Maybe title and description are basic, since you wonā€™t usually want to retrieve them from the REST API, right?

What other state.frontity fields do you miss?

Oh, feel free to fix that then :slight_smile:

I didnā€™t miss anything else. Itā€™s just a bit weird to define some fields under the frontity namespace, and then to type them in the theme, but I guess that if we cover those 3, people will define the new ones under the theme namespace.

If you want me to add those types in a PR let me know :slight_smile:

1 Like

Sure, go ahead :slight_smile:

Hey mate,

did you ever succeed in creating the TS version of the mars theme? And if so, would you mind sharing? I was about to start working on this when I realised that I am likely not the first one who thought about this and found your old post.

Cheers!

1 Like

Hi! Iā€™m afraid I stopped working on that. But I didnā€™t actually ported mars-theme to TypeScript, I built another theme from it. So you can proceed with your theme!

If you have any doubt I might be able to help.

I opened Problems when starting a Frontity project with TypeScript to continue the conversation there.