Full TypeScript support in `frontity create`


It looks like when users do frontity create --typescript it doesn’t quite work yet. @orballo opened a topic with the current problems: Creating a new package and a custom theme with TypeScript

User Stories

As a Frontity project developer
I want to be able to start a project in TypeScript
so that I can type all my local packages.

Current Problems

These are copied and refactored from the ones @orballo exposed in his post: Creating a new package and a custom theme with TypeScript

  • The project needs these dependencies:

    • typescript
    • @types/react
    • Maybe other @types packages used by frontity.
  • The above dependencies could be (not sure which one is better yet):

    • dependencies declared in the root’s package.json.
    • devDependencies declared in the root’s package.json.
    • dependencies declared in the package’s package.json, like @frontity/core.
  • The project needs a tsconfig.json file. Similar to the one we have in our repo.

  • When users add a new field to the default package export, like
    { state: { theme: { some: "field" } } }
    TypeScript won’t complain unless there is at least one defined field at the same level. This is probably due to the default definition of state:
    { state: [key: string]: object }
    We need to improve that.


  • If users opt-in to use TypeScript (with --typescript or by answering Yes to a Do you want to use TypeScript prompt): should frontity create let them choose only a TypeScript theme? or also a JavaScript theme?
  • I think this one is already solved. @orballo could you please confirm it?
    When you run frontity create-package -t , it is not yet implemented the support for this option (and is not explained in the help command, which leads the developer to believe that there is a bug).

I ran this command in frontity 1.4.2 and it doesn’t seem fixed. The command runs without minding my -t, --typescript option. And when running npx frontity create-package --help the -t option is still present.

Oh I thought you were talking about frontity create, not frontity create-package. My bad.

It looks like @david added the option but didn’t implement the feature and I didn’t noticed it in the code review. I’ve done a PR to remove the option until it is implemented.

1 Like

I was creating a new project, and I think that while there isn’t an available typescript theme (or even if there is one, when I know what I’m doing, I might want to start from zero) there should be an option in frontity create to create a project without any theme installed.