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

Document how to create an app with TypeScript support #5895

Closed
borekb opened this issue Nov 24, 2018 · 6 comments
Closed

Document how to create an app with TypeScript support #5895

borekb opened this issue Nov 24, 2018 · 6 comments
Labels

Comments

@borekb
Copy link

borekb commented Nov 24, 2018

I had a relatively hard time working out how to create a new React app with the built-in TypeScript support. I looked here:

No mention there. Finally, in the changelog, I found what I was looking for:

npx create-react-app my-app --typescript

I think that all three places mentioned above should be updated, mentioning this flag. If you agree, I'd prepare a PR.

@ahmad2smile
Copy link

As @borekb said all tutorials mentioned

npx create-react-app my-app --typescript

to get typescript support. It should be clearer in the docs that its not necessary command. CRA just supports TS by default and If you have .ts files in your project it would just generate tslint and compile those files by default.

Also should be mentioned that --typescript flag doesn't produce .ts files. I expected this flag to produce TS files and when it didn't I looked though issues and medium articles why this wasn't working.

@ahmad2smile
Copy link

Also needed to add // tslint:disable comment in serviceWorker.ts to get it to work.

@rsuk
Copy link

rsuk commented Nov 29, 2018

I have submitted a PR to update the readme / getting started: 5866

@quantuminformation
Copy link

quantuminformation commented Dec 7, 2018

I'm importing polyfills but they are not being loaded or run at runtime with this new native typescript support, is there smth special we need to do?

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import 'url-search-params';
import 'react-app-polyfill/ie9';


ReactDOM.render(<App />, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();

@stale
Copy link

stale bot commented Jan 6, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 6, 2019
@stale
Copy link

stale bot commented Jan 12, 2019

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Jan 12, 2019
@lock lock bot locked and limited conversation to collaborators Jan 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants