-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Discussion: TypeScript support #509
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Hey @mattiamanzati, thanks for this PR! Quick question, did you ever encounter issues with awesome typescript loader? I get the following error on
from a fresh install, but of course installing locally (or globally) doesn't fix this. Seems related to s-panferov/awesome-typescript-loader#54. |
Uhm, yeah I think it appeared one time only! Try to run npm install typescript --sav-dev in your Project folder and let me Know! Are you running node 6 and npm3? ----- Messaggio originale ----- Hey @mattiamanzati, thanks for this PR! Quick question, did you ever encounter issues with awesome typescript loader? I get the following error on npm start: |
@mattiamanzati Sadly didn't fix the issue, just tried with a fresh install :( also tried with different flavors of node without much success. Here's my latest setup in my computer (OSX)
|
Would be really eager to test this, but can't get past the install procedure: create-react-app my-awesome-typescript-app-folder --scripts-version=git://github.com/mattiamanzati/create-react-app.git#typescript-support
[...]
module.js:457
throw err;
^
Error: Cannot find module '/Users/majo/Desktop/my-awesome-typescript-app-folder/node_modules/git:/github.com/mattiamanzati/create-react-app.git#typescript-support/package.json'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at checkNodeVersion (/Users/majo/.nvm/versions/node/v6.6.0/lib/node_modules/create-react-app/index.js:169:21)
at ChildProcess.<anonymous> (/Users/majo/.nvm/versions/node/v6.6.0/lib/node_modules/create-react-app/index.js:126:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node --version
v6.6.0
npm --version
3.10.3
create-react-app --version
create-react-app version: 0.4.2 |
Any more progress on the possibility of TypeScript support getting in? |
This would be much cleaner if it didn't include |
Thanks for the PR! Nevertheless I encourage you to fork This article explains how you can fork it. Thanks! |
@majodev Any luck with that error? |
TypeScript is now officially supported as of Create React App 2.1. Read the release notes to get started! |
Feel free to try and give feedback about this PR by using:
create-react-app my-awesome-typescript-app-folder --scripts-version=git://github.com/mattiamanzati/create-react-app.git#typescript-support
This PR should'nt be merged yet, see the discussion below!
Good news everyone!
First of all, thanks to everyone working on this great package! It's allowing newcomers to enter the world of react with just a few command line commands!
Being a TypeScript fan, and after seeing some request about TypeScript support, i tryied to give it a shot!
Not everyone uses TypeScript (you should :P), so this PR will just add other stuff to NPM install to users, and if it's not needed, it will just increase the NPM install time of the create-react-app. On the other side this could became a separate NPM package like "typescript-react-scripts" and be installed using --scripts-versions, but this would require to fork (or spoon) all the current configs for webpack, babel, etc... What do you think would be the best solution?
I have used this because I like the idea of TypeScript sources made es3 compliant by babel. At the moment typescript does'nt support that natively, so I decided to go with this route and let all pass through babel.
babel.dev.js uses "cacheDirectory" config, which is a babel-loader and not a babelrc config option. That's why inside typescript.dev.js I have to monkey-patch that config and remove the cacheDirectory option. Maybe we should consider moving that option to a "babel-loader.dev.js" file, and then include the babel config.
I had no idea about that, so I ended up writing a React component that simply tells that you can also write TypeScript. We should find a simple example that uses interfaces, in order to explain the advantages of TypeScript on bigger codebases.
We should dive into create a unified config between the two system. Writing a hybrid js & ts project would end up in tslint blaming you because it's settings are different. This usually happens when you have a large codebase and slowly migrate to TypeScript.
To avoid adding another dependency, I decided to simply include the react and react-dom typings along with their typings.json file. However this means that we need to keep it up to date, so should we consider adding another dependency and run typings install react react-dom --save?
7. How to handle tests?Right now tests will fail since it will attempt to test the tsx file. Should'nt we run the test on a compiled file version? Unfortunately I don't know much how we could setup that.
That's all! Thanks for your time and suggestions!