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

Making it work with create-react-app --template typscript #66

Open
Sourav12061999 opened this issue Feb 23, 2023 · 1 comment
Open

Making it work with create-react-app --template typscript #66

Sourav12061999 opened this issue Feb 23, 2023 · 1 comment

Comments

@Sourav12061999
Copy link

Sourav12061999 commented Feb 23, 2023

I want some help on how to set this up with the `create-react-app --template typescript, I am not sure I am doing something wrong or it's some issue from the package itself

@maurer2
Copy link

maurer2 commented May 31, 2023

Hello, I believe the following should work:

  1. Eject CRA (to gain access to babel config)
  2. Install babel-plugin-typescript-to-proptypes
  3. Create a babel.config.js file, that contains the babel settings from the Readme.md file.
  4. Remove babel settings from package.json
  5. Change process.env.BABEL_ENV to "development" in scripts/build.js, otherwise the proptypes are removed in prod mode
  6. Add import React from "react"; to each component, even if it is not needed anymore when using the new JSX transform. Otherwise the proptypes won't be exported (see Types not being generated if no react import present #64)
  7. Runnpm run build. Proptypes should still be in the compiled files in build/static/js/*.js

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

No branches or pull requests

2 participants