React-rails: Generate Typescript based component

Created on 10 Feb 2019  路  2Comments  路  Source: reactjs/react-rails

rails g react:component HelloTypescript --ts

Expected behavior

Running via Spring preloader in process 1234
      create  app/javascript/components/HelloTypescript.ts(x)

Actual behavior

Running via Spring preloader in process 1234
      create  app/javascript/components/HelloTypescript.js

When I have run bundle exec rails webpacker:install:typescript or when I specify --ts after the generate react:component, I'd like it to create a Typescript component instead of a JS one. (I see there is a --coffee flag too, so a --ts flag would be nice)

Most helpful comment

@richarddewit could you please give #990 a try.
@BookOfGreg I'd appreciate any feedback for #990.

All 2 comments

@richarddewit I've not used Typescript before, but it's clearly popular and pretty widely supported by major players already so we would welcome a PR if you're able to do so.

https://github.com/reactjs/react-rails/tree/master/lib/generators/templates
The templates for the generators are in this folder, so anyone implementing would only need to provide a template and then add it to the component generator here:
https://github.com/reactjs/react-rails/blob/master/lib/generators/react/component_generator.rb#L92
Thank you!

@richarddewit could you please give #990 a try.
@BookOfGreg I'd appreciate any feedback for #990.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrismv48 picture chrismv48  路  3Comments

davidlormor picture davidlormor  路  3Comments

prasanthrubyist picture prasanthrubyist  路  3Comments

dylanitorium picture dylanitorium  路  4Comments

ttanimichi picture ttanimichi  路  4Comments