skatejs/generator-skatejs

Support TypeScript

alexlafroscia opened this issue · 2 comments

  • Prompt user to see if they want TS support
    • Support TS flag as an argument as well
  • Automatically install additional required TS development dependencies
  • Generate TS files for app files
    • index.js
    • Style utility
  • Generate TS files for additional components without asking again for the user's preference

Useful links

Off topic a bit, but I'm curious how you were thinking of handling "Generate TS files for app files".

We're looking to build an internal generator and provide TypeScript as an option, but I don't really want to have to maintain both a .js and a .ts version of each file.

The least bad option I can think I was considering having the "canonical" files be written in TypeScript, and then if the user chooses to use JS code, we'd run the sources through tsc with target: es2015, and emit those files.

But, I haven't seen this in any other generators, so I'm interested in what your thoughts were. Cheers!

I haven't really thought much about it at all, really. I don't use TypeScript at all, but it's something I'd like to support here since we have the definitions and @Hotell is so passionate about it ;)

I think your idea of making the TS files the "canonical" ones and then transpiring away anything not in JS when generating the JS versions would be interesting.

However, since the Skate source is going to be in Flow, it might make more sense to do that with Flow instead (having the types in there by default and optionally removing them when generating a new component).