Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Typescript based component #965

Closed
richarddewit opened this issue Feb 9, 2019 · 2 comments · Fixed by #990
Closed

Generate Typescript based component #965

richarddewit opened this issue Feb 9, 2019 · 2 comments · Fixed by #990

Comments

@richarddewit
Copy link

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)

@BookOfGreg
Copy link
Member

@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!

@delkopiso
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants