TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why Angular 2 Switched to TypeScript

69 点作者 Doolwind将近 9 年前

7 条评论

pixie_将近 9 年前
I&#x27;ve been programming for a long time and TypeScript has been a slam dunk for me. It makes programming large web apps actually considerably more manageable.<p>Unfortunately I spend a lot of time defending the merits of static typing to my co-workers. At the same time they&#x27;re going on about how unit tests are important, while static typing eliminates entire classes of errors and they don&#x27;t get it for some reason. Unit tests while important don&#x27;t prevent type errors, and if you tried using them for that you&#x27;d have orders of magnitude more tests to write.<p>I feel like I&#x27;m taking crazy pills having to defend static typing while every dynamic language I&#x27;ve used for any project of any considerable size has been a complete nightmare to manage. At this point I feel like a lot of new coders coming out of school just haven&#x27;t written anything large enough yet and maybe that&#x27;s why they don&#x27;t see the point.
评论 #12152826 未加载
评论 #12155027 未加载
评论 #12154113 未加载
评论 #12153585 未加载
iLoch将近 9 年前
I wanted to use TypeScript with a new React project, but the biggest problem I had (which eventually lead me away from using it) was that typings were so hard to get ahold of. Built something in JS? Sorry, you have to provide what is essentially a source map in order to get it to work with TypeScript. That should be a non-starter for anyone who is doing more than a hello world app. Figure out a way for me to use TS without having to create a bunch of extra type garbage in my app and I&#x27;ll upgrade my code base immediately.
评论 #12151918 未加载
评论 #12151923 未加载
评论 #12151930 未加载
评论 #12152182 未加载
评论 #12151896 未加载
stephen将近 9 年前
Question for TypeScript and specifically Angular 2: does Angular 2 being written in TypeScript mean that webapps based on Angular 2 that are also written in TypeScript, are basically 100% type-safe (e.g. all app-to-Angular library calls, or within-app view-to-model&#x2F;etc. calls, are all type checked)?<p>I ask because after looking (admittedly very briefly) at writing an Ember app in TypeScript, it looked like because Ember assumes all of it&#x27;s webapps will be JavaScript, there ends up being a lot of dynamic-&#x2F;string-based idioms, e.g. model.set(&quot;property&quot;).<p>(There is a good SO post about turning this into a typed model.property.set(...) in TypeScript, but that solves just this one instance, and not the entire Ember experience.)<p>So, this left me with the feeling that for a TypeScript webapp to have a truly great&#x2F;first-class&#x2F;typed interaction with it&#x27;s framework (Angular, Ember, whatever), that the framework itself would have to: a) be written in TypeScript, and b) have the founding assumption that most (all?) apps written for it would also be TypeScript.<p>So, per this post, Angular 2 is a), it&#x27;s written in TypeScript. What about b)?
评论 #12152098 未加载
评论 #12154573 未加载
评论 #12152743 未加载
评论 #12151959 未加载
Doolwind将近 9 年前
If you&#x27;re looking for Typescript type definitions for a project you&#x27;re using check this list - <a href="https:&#x2F;&#x2F;github.com&#x2F;DefinitelyTyped&#x2F;DefinitelyTyped" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;DefinitelyTyped&#x2F;DefinitelyTyped</a>
评论 #12151971 未加载
shadowmint将近 9 年前
<p><pre><code> There are a lot of options available to frontend devs today: ES5, ES6 (Babel), TypeScript, Dart, PureScript, Elm, etc.. So why TypeScript?&#x27; </code></pre> ...<p><pre><code> Elm and PureScript are elegant languages with powerful type systems that can prove a lot more about your program than TypeScript can... </code></pre> ouch. Thats got to be a tiny bit awkward for the Dart team to read (so, I guess Dart isnt in the list of elegant languages then?)
评论 #12151984 未加载
lomnakkus将近 9 年前
It continues to be amazing to me that a new generation of developers is discovering that, yes, static checking adds a lot of value (for non-trivial-sized projects). Of course, if you were tasked with delivering web apps -- until recently -- you didn&#x27;t really have any choice.<p>The older I get, the more the whole &quot;everything moves in cycles&quot; thing appears to be true -- almost regardless of what particular subject matter is under consideration.
评论 #12151988 未加载
评论 #12151980 未加载
评论 #12151943 未加载
评论 #12151941 未加载
评论 #12152044 未加载
评论 #12152011 未加载
评论 #12154622 未加载
评论 #12152042 未加载
评论 #12152082 未加载
stevehiehn将近 9 年前
So far I&#x27;m really into typescript (for dev). However i one big problem which is C.I. It&#x27;s annoying to have to configure an environment just to run a TS compile job.
评论 #12151910 未加载