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: