TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Porting a React Front End to TypeScript

72 pointsby gary_bernhardtabout 5 years ago

11 comments

scottfrabout 5 years ago
You can get a lot of the benefits of Typescript in VSCode without leaving JavaScript behind by using JSDoc.<p>Typescript will pick up the JSDoc type annotations and use them to type the code. This can be a great option when typing an existing project.<p>Docs: <a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;docs&#x2F;handbook&#x2F;type-checking-javascript-files.html#supported-jsdoc" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;docs&#x2F;handbook&#x2F;type-checking-j...</a>
评论 #23004316 未加载
评论 #23008152 未加载
sefrostabout 5 years ago
I’ve found this React + TypeScript cheat sheet extremely helpful while recently porting a React codebase to TypeScript. (To the point it’s one of only four bookmarks on my browsers bookmark bar.)<p>Perhaps others here will find it useful as well.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;typescript-cheatsheets&#x2F;react-typescript-cheatsheet#reacttypescript-cheatsheets" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;typescript-cheatsheets&#x2F;react-typescript-c...</a>
评论 #23007314 未加载
评论 #23025722 未加载
stgewehrabout 5 years ago
It seems that I fundamentally misunderstand the benefits of TypeScript. I found myself spending hours and hours on reading the type errors stacktraces and adding types for libraries. Writing TS code takes 2x time than simple JS... and it is extremely painful experience. In comparison to many old plain JS projects I did - it simply doesn’t make any sense, the TS solves problems which I haven’t experienced at all.
评论 #23004053 未加载
评论 #23004175 未加载
评论 #23004060 未加载
评论 #23003959 未加载
评论 #23003995 未加载
DanRosenwasserabout 5 years ago
Hey all, I work on the TypeScript team. I&#x27;ve been super happy to read some of the posts about the migration on Execute Program. If anyone has any feedback or questions on TS, I can also try to answer them.
评论 #23006866 未加载
joelbluminatorabout 5 years ago
I&#x27;m not saying I never ever run into bugs due to dynamic types such as method&#x2F;variable typos, I just think it&#x27;s much more rare than people make it out to be. If that sort of thing happens a lot in a project you basically have very little tests. I&#x27;m confident in saying it happens to me maybe once in a few months - and that&#x27;s working in a super dynamic environment of Rails. The Null error does happen, but that happens in java as well.
评论 #23004121 未加载
评论 #23004183 未加载
评论 #23004185 未加载
评论 #23004167 未加载
评论 #23004091 未加载
评论 #23007476 未加载
评论 #23003987 未加载
prmphabout 5 years ago
I love TypeScript, but have encountered a situation where I simply could not compile my code anymore because it started causing an internal error in the compiler itself.<p>Fortunately, I work as a team lead, and this was on an experimental branch, so I was able to hand off bits of code relating to architectural patterns I was evaluating to my team to continue work on those.<p>But I simply could not proceed with my code as is, a very frustrating experience to say the least. How is this even possible?
评论 #23009788 未加载
czei002about 5 years ago
Regarding the previous backend related article and code sharing between backend and frontend, how does your project setup look like?<p>For example, does the code get compiled using a bundler like webpack? if yes how do you solve the import &#x27;..&#x2F;..&#x2F;..&#x2F;..&#x2F;..&#x2F;shared.ts&#x27; problem? Or do you use node modules in a monorepo? Compared to other languages I found these questions surprisingly difficult to answer and solutions often quite cumbersome, e.g. if I want to share one small file in my project I don&#x27;t want to maintain a public npm module for it...
评论 #23010447 未加载
评论 #23009918 未加载
LAMikeabout 5 years ago
The question is, is it worth it?<p>I&#x27;m starting to feel behind the curve and I want to learn new stacks like Next.js, Typescript and GraphQL. Anyone else feeling this way or have already gone through that learning curve?
评论 #23003957 未加载
评论 #23004094 未加载
评论 #23003867 未加载
评论 #23003822 未加载
评论 #23004246 未加载
评论 #23006980 未加载
评论 #23003866 未加载
评论 #23007325 未加载
评论 #23004306 未加载
评论 #23003941 未加载
评论 #23003928 未加载
评论 #23006982 未加载
ludamadabout 5 years ago
One critical thing for TypeScript&#x27;s success that I wish for the Lua community is that it paved a roadmap for typing a huge chunk of the JS ecosystem. Porting to TypeScript can be entirely incremental, and you usually have a wealth of types coming in from dependencies. The UX here is going to be one of the best as far as ports go, as usually porting feels negative value up front
Kiroabout 5 years ago
I want to start using TS for my Node service but ts-node seems janky and the compability with ndb (which I use all the time) seems bad.
评论 #23010121 未加载
评论 #23004249 未加载
conmigoabout 5 years ago
I&#x27;ve never increased my productivity by using Typescript, although I really tried very hard to like it. It just keeps bugging me. It&#x27;s a constant stream of interruptions that force me to please the TS compiler, compared to having a rare type issue a once in a while in plain JS.<p>Besides that, I&#x27;ve never been a Microsoft fanboy(to say the least) and it&#x27;s worrying me that almost the entire JS eco system falls in the hands of that company; Github, VSCode, Typescript, NPM, etc.. Am I alone in this?<p>There is so much good stuff in the JS world, but we seem to adhere to a few companies and a few systems more and more. Being a &#x27;Javascript&#x27; developer today only has very little to do with Javascript. It&#x27;s about React, Redux, Hooks, ESLint, Prettier, Typescript, etc.. Oh, and don&#x27;t forget to do it Agile, another joy and productivity killer. And when you don&#x27;t agree with this stack you&#x27;re either not so smart or still need to learn to &#x27;understand&#x27; it.
评论 #23007579 未加载
评论 #23007282 未加载
评论 #23007444 未加载
评论 #23007343 未加载
评论 #23010885 未加载
评论 #23013714 未加载