DEPRECATED: Create React apps using typescript with no build configuration.
create-react-appnow supports typescript natively - read the guide for adding typescript to existing projects.
For existing
react-scripts-tsusers who would like to upgrade, follow this guide.
I have chosen to archive this repository, if you need to contact me, i'm on twitter @willmonk.
react-scripts-ts
Create React apps (with Typescript) with no build configuration.
Do you know react and want to try out typescript? Or do you know typescript and want to try out react? Get all the benefits from
create-react-appbut you use typescript! 🚀
npx create-react-app my-app --scripts-version=react-scripts-ts cd my-app npm startor with yarn
yarn create react-app my-app --scripts-version=react-scripts-ts cd my-app yarn start
(npx comes with npm 5.2+ and higher, see instructions for older npm versions)
Then open http://localhost:3000/ to see your app.
When you’re ready to deploy to production, create a minified bundle with
npm run build.
In general, most upgrades won't require any migration steps to work, but if you experience problems after an upgrade, please file an issue, and we'll add it to the list of migration steps below.
<2.16.0to
>=2.16.0
Since
2.16.0, the template uses different
tsconfigfiles for both development and production mode. For the latter, unfortunately, the path resolver is not smart enough to fall back to the basic
tsconfig.jsonin case the expected
tsconfig.prod.jsonis not present, so you have to create this file manually like shown here.
<2.13.0to
>=2.13.0
Since
2.13.0,
typescriptis listed as a peer dependency of
react-scripts-ts. For projects generated with at least this version, the init script takes care of properly installing it as dev dependency to the generated projects. Older projects require manual installation, in case you have not already done that.
Using
npm:
npm i -D typescript
Using
yarn:
yarn add -D typescript
<2.5.0to
>=2.5.0
Version
2.5.0introduces a new config file for jest, that is necessary for the tests to run. If you were previously running a version older than
v2.5.0and upgraded to
v2.5.0or newer, you need to manually add the new file, or else you'll get an error similar to this when trying to run your tests:
Test suite failed to run{ "messageText": "Cannot read file 'C:\[project]\tsconfig.test.json': ENOENT: no such file or directory, open 'C:\[project]\tsconfig.test.json'.", "category": 1, "code": 5012 }
To fix this, create a new file in the root of the project called
tsconfig.test.json, and paste the content of this file into it. Everything should work now. For more info, please see this issue.
moduleNameMapperconfig override - @sebald
--watchAllto be set - @DorianGrey
[email protected]
This included changes that were not published by the facebook upstream, so was unpublished.
typescriptversion to 2.3.x until 2.4 @types are fixed
extend) - Thanks to @DorianGrey
[email protected]
[email protected]- thanks to @mindjuice
source-map-loader- thanks to @Place1
[email protected]- thanks to @sjdweb
[email protected]
@typeswere being installed on init
cli-highlightdependency
npm run build
setupTest.ts
npm run build
eslintto
tslint
tsconfig.json
typescriptTransform.jswhen running
npm run eject