11 ms·
I'm disappointed setting up typescript is still such a pain with 2.0.
by b-nint 8y ago
I'm disappointed setting up typescript is still such a pain with 2.0.
- fermentation 8y agoWhy would facebook be interested in making it easy to use a technology that they directly compete against?
- sophiebits 8y agoSpeaking for the React team, we have little reason to suggest people use Flow over TypeScript. I haven’t personally followed the status of TS in CRA closely, but I know it’s a popular request among our users so I would love for us to make it easy.
- fermentation 8y agoThat's certainly comforting to hear, then. Sometimes it gets confusing connecting the negative news of these large companies to their cool open source projects.
- holman 8y agoEh, the React team in particular is pretty even-handed when it comes to what goes into CRA. This release, for example, adds support for Apollo, which goes head-to-head with Relay. I’ve been pretty happy with the team’s thoughtful approach to adding a dependency or not.
- pmalynin 8y agoUse ParcelJS and Typescript. Couldn't be easier.
- arenaninja 8y agoReally? If anything the move to babel 7 makes it easy, use babel-loader for .tsx?$ files with @babel/preset-typescript I've setup about 4 projects over the past year, if you feel like you need help feel free to email me any particular pain points you have and I'll try to get you through them, email in profile (not a react contributor, just frequent react/typescript user on financial applications)
- acemarke 8y agoI'd actually love to see a good blog post that details the process of, say, upgrading from Babel 6 to Babel 7 for a non-CRA app, and then adding in some form of TS support on top of that. (I've got a couple apps that I'd like to try doing that with myself in the not too distant future.)
- streptomycin 8y agoThey are independent, so you could read two blog posts, one for Babel 7 https://babeljs.io/docs/en/v7-migration https://babeljs.io/docs/en/v7-migration and one for TS https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/ https://blogs.msdn.microsoft.com/typescript/2018/08/27/types...
- ianschmitz 8y agoCheck out https://github.com/strothj/react-app-rewire-typescript-babel-preset https://github.com/strothj/react-app-rewire-typescript-babel... for an example I helped get going. It was fairly straight forward!
- acemarke 8y agoThanks, appreciate it!
- sbr464 8y agoI don’t have a post but I took a half hour the other day and did it, it was basically: Add typescript, babel typescript, add the plugin in babelrc, and update the Babel cli build command in package.json to look for ts file extensions. That enabled me to start incrementally adding typescript into an existing node.js codebase, I was surprised how easy it was.
- sbr464 8y agoHere were the changes to get typescript working with an existing node.js codebase (babel 7) package.json (scripts) BABEL_ENV=development babel -d build/ src/ --extensions \".ts,.tsx,.js\" --quiet --source-maps inline package.json (add property) "type-check": "tsc", package.json (dev depenencies) @babel/preset-typescript, typescript babelrc (add with env) presets: ["@babel/typescript"] tsconfig (example) { "compilerOptions": { "target": "esnext", "module": "commonjs", "declaration": true, "outDir": "build", "strict": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "skipLibCheck": true } }
- danabramov 8y agoSorry. We needed to prioritize to get this release out because it's already been snowballing for about a year. We actually did have "TypeScript support" on a nice-to-have list for this two week sprint but unfortunately didn't get to it: https://i.imgur.com/l0CpdZy.png https://i.imgur.com/l0CpdZy.png (I promise I'm not making this up :-) I'm confident we'll ship it by the end of this year though.
- andrethegiant 8y agoWhat is the status of Flow in the JS ecosystem?
- ssalka 8y agoEveryone I know who uses it wishes they had gone with TypeScript. Anecdotal for sure, but I wouldn't be surprised if most Flow users felt this way - TS is winning in basically every way.
- root_axis 8y agoFlow offers a more sophisticated type system that is designed to express types that correspond with the sort of idioms you see in JavaScript in the wild. TypeScript is simpler and less flexible, but that simplicity can translate into increased productivity since there are less foot-guns and also less bugs. Strange/buggy behavior and odd performances issues are not totally uncommon with Flow whereas TypeScript doesn't seem to suffer from this as much. Since TypeScript is much more popular, IDE support tends to be a lot better out of the box, but the flow-langauge-server gives you all the same IDE-like features (intelligent autocomplete, jump-to-def, module resolution etc). Personally, I like Flow more, and I also think its easier to integrate into an existing codebase (either as comment annotations or gradually via per-file flow comment header), but at the end of the day, not choosing TypeScript amounts to swimming against the current without much justification.
- paavohtl 8y ago>Flow offers a more sophisticated type system that is designed to express types that correspond with the sort of idioms you see in JavaScript in the wild. TypeScript is simpler and less flexible, but that simplicity can translate into increased productivity since there are less foot-guns and also less bugs. Source? That's the primary design principle behind TypeScript too. TypeScript's type system is powerful enough to practically do arbitrary type-level transformation of data structures, and even do some crazy recursive pure functional type level programming. The only things I'm missing from TypeScript are variadic generics (which can be emulated quite well with TS 3.0) and higher kinded types - and I don't think Flow supports them either.
- daok 8y ago+1 for TypeScript. The current existing ports of CRA for TypeScript are always behind.
- PudgePacket 8y agoFrom memory one of the issues on github says it's coming in 2.1. It just wasn't determined to be a "blocker" for 2.0.
- sephware 8y agoTypeScript is fantastic for its IDE support and instant feedback but I'm waiting for the day it's built into CRA as a first class citizen. Sounds like that day will be soon though maybe even this year.
- acemarke 8y agoWorth noting that the CRA-TS project (a totally separate repo) is in the process of merging in the changes from CRA 2.0: https://github.com/wmonk/create-react-app-typescript/issues/284 https://github.com/wmonk/create-react-app-typescript/issues/...
- jaaames 8y agoYeah these guys follow quickly, I've used this multi times and can highly recommend.
- andrewstuart 8y agoExactly this. Create React App is awesome except its not TypeScript, and unfortunately the key point of Create Reacte App is that it is opinionated which is its magnificent strength, but it's opinion is not TypeScript as the primary language choice. It's a pity TypeScript isn't the default. I'd list Create React App as the number one best JavaScript technology of all time, awarded for the massive pain saving it confers. It allows the most fabulous thing in the world, which is to avoid using the JavaScript tooling.