6 ms·
If you are using typescript, you should read: https://github.com/Microsoft/TypeScript/issues/7270 https://github.com/Microsoft/TypeScript/issues/7270 TLD'R: R
by kuon 11y ago
If you are using typescript, you should read:
https://github.com/Microsoft/TypeScript/issues/7270 https://github.com/Microsoft/TypeScript/issues/7270
TLD'R: React 15.0 broke TSX in typescript but the workaround is easy.
- spicyj 11y agoWe didn't realize this would break. We're looking at cutting a 15.0.1 that puts React.__spread back with a warning.
- lmm 11y agoI realise it's a lot of work, but as more and more downstream projects come to depend on React, having a "community build" that would build those against your RCs and run some integration tests would be a great way to improve reliability of the overall ecosystem.
- technion 11y agoSeems to still work in my small codebase, but I get a series of type warnings. Typings still has 0.14 tagged as the latest - I'm guessing we need an update there too?
- deadbeef404 11y agoAlso note, if anyone is using "reactify" and has used the spread operator in JSX, as 15.0.0 removed React.__spread, your build will break. (Reactify uses the deprecated react-tools which uses React.__spread.)
- danabramov 11y agoYeah. Putting a warning should solve the problem because people will start complaining to the transform vendors about this and hopefully they will deprecate their transforms or use Babel internally.
- erichocean 11y agoFWIW I used TypeScript in anger with React, and hated it so much I rewrote all the React code in regular JavaScript. TypeScript and React, IMO, are a poor fit. To be clear: I do like TypeScript and use it almost exclusively on the server, so this isn't a case of me "not liking TypeScript". It's the combination of the two. Basically, all of the stuff I did to keep TypeScript happy when using React was worthless overhead and brought nothing but pain, warping the codebase horribly. The JavaScript version with React was smaller, lighter, and had way less cognitive overhead. YMMV.
- DrJokepu 11y agoWhat is exactly your problem with TSX? I've been using TSX for a while so maybe I can help. The only thing that TypeScript really adds to JSX is component parameter validation, which is quite neat to be honest.
- petilon 11y agoTypeScript also validates the expressions that supply the values. And if you use Visual Studio you get intellisense and validation for HTML, and intellisense and instant validation of your javascript expressions. These benefits are awesome, and by the way, all this is independent of React. You can use TSX just as a templating library using UIBuilder, see: https://github.com/wisercoder/uibuilder https://github.com/wisercoder/uibuilder
- co_dh 11y agoI have the opposite experience.