写在前面
前端也要学英语系列,针对有外企工作意向或者海外远程办公需求的前端开发者,通过翻译一些原汁原味的技术文章,积累计算机相关英语词汇和表达。
正文部分
Turbo 8正在放弃TypeScript
Turbo 8 is
droppingTypeScript
大家都说,TypeScript对微软来说是一个巨大的成功。
By all accounts, TypeScript has been a big success for Microsoft.
我看到过很多人因为在JavaScript中添加了可以被编译器检查的显式类型而欣喜不已。
I've seen loads of people
sparkle with joyfromdousingJavaScript withexplicittypes that can be checked by a compiler.
但我从来不是它的粉丝。
But I've never been a
fan.
五分钟后不会,五年之后也不会。
Not after giving it five minutes, not after giving it five years.
因此,我非常高兴地宣布,我们将从Turbo 8的下一个重要版本中删除TypeScript。
So it's with great pleasure that I can
announcewe're dropping TypeScript fromthe next big release ofTurbo 8.
事实上,我其实很喜欢JavaScript。
The fact is thatI actually rather like JavaScript.
我甚至可以说它是我仅次于Ruby的第二喜欢的语言。
I'd go so far as to sayit's my second favorite language after Ruby.
是的,一个有距离的第二,但尽管如此仍然可以排在第二。
Yes, a distant second, but a second
none the less.
情况并非总是这样。
This wasn't always the case.
在JavaScript中有了合适的类,以及ES6以来的所有其他改进之后,编写代码变成了一种真正的乐趣。
But after we got
properclasses in JavaScript, and all the otherimprovementsthat flowed since ES6, it's become a real joy to write.
我仍然认为JavaScript并不完全适配我们在web应用程序的服务器端所做的大部分工作,但我完全尊重并欣赏其他人的不同看法。
I still don't think JavaScript is
well-suitedfor most of the work we do onthe server sideofthe web-appequation, but fullyrespectandappreciatethat others feel differently.
对我来说,拥有这样一个功能强大的JavaScript是我们的幸运,浏览器完全不需要``编译器就可以对其进行解释。
To me, it's simply our good fortune that we now have such acapableJavaScript, which browsers are able tointerpretwithout any needfor acompilerat all.
TypeScript对我来说是个阻碍。
TypeScript just
gets in the way ofthat for me.
不仅因为它需要显式的编译步骤,还因为它用类型技巧污染了代码,这给我的开发体验带来了很少的乐趣,而且经常带来相当大的痛苦。
Not just because it requires an
explicitcompile step, but because itpollutesthe code withtype gymnasticsthat add ever so little joy to mydevelopment experience, and quitefrequentlyconsiderablegrief.
应该容易的事情变得困难,而困难的事情变得“any”。
Things that should be easy become hard, and things that are hard become
any.
不,谢谢!
No thanks!
不过,这并不是在请求``改变``任何人的想法。
This isn't a
pleatoconvertanyone of anything, though.
正如我在编程类型和心态中所讨论的,很少有程序员对改变他们对类型的看法感兴趣。
As I discussed in Programming types and
mindsets, very fewprogrammersare typically interested inhaving their opinion on typing changed.
大多数程序员发现自己在职业生涯的早期就被打字所深深吸引,然后把剩下的时间花在合理化自己和他人的正确选择上。
Most programmers find themselves
drawn strongly totyping or not quiteearly in their career, and then spend the rest of itrationalizingThe Correct Choice to themselves and others.
这就是JavaScript和TypeScript二分法的神奇之处,TypeScript团队意识到完全接管JavaScript是不可能的,所以完全的兼容性必须从一开始就考虑进去。
That's part of the magic of this JavaScript v TypeScript
dichotomy, and full credit tothe TypeScript gangfor realizing thata full take-over ofJavaScriptwas never going to happen, socomplete compatibilityhad to be baked infrom the start.
仅仅因为Turbo 8放弃了TypeScript并不意味着你不能用它来编写客户端代码,或者使用任何其他使用它的库。
Just because Turbo 8 is dropping TypeScript
won't meanyou can't write your client code in it, or use any otherlibrary that employs it.
我们可以混合搭配,这很棒。
We get to
mix and match, which is wonderful.
这也是必要的。
It's also necessary.
因为与Ruby等语言不同,Ruby是服务器端的众多可选语言之一,而JavaScript是客户端的一个必选语言。
Because unlike languages like Ruby, which are
languages of choicewhen it comes tothe server side, JavaScript isa language of necessitywhen it comes tothe client side.
虽然您可以将方言编译到其中,但您仍然必须接受这样一个事实:在浏览器中运行代码意味着运行JavaScript。
While you may compile
dialectsinto it, you still have toaccept the fact thatrunning code in the browser means running JavaScript.
因此,在这种情况下,能够在没有任何工具和任何强类型的情况下编写这样的代码是一种幸事。
So being able to write that,
free of any tooling, andfree of any strong typing, is ablessingunder the circumstances.
再见了,TypeScript。
So
farewell, TypeScript.
愿你为你的同行带来更多的严谨和满足,同时让我们其他人享受JavaScript最初设计的光荣精神:没有强类型。
May you bring much
rigorandsatisfactionto yourtribewhile letting the rest of us enjoy JavaScript in theglorious spiritit wasoriginally designed:Free of strong typing.