10 ms·
I recently did the exact same job as the author of this post. Migrating 15K LoC from JS to TS. The author of Vue.JS also migrated Vue completely to Typescript
by tinyvm 8y ago
I recently did the exact same job as the author of this post.
Migrating 15K LoC from JS to TS.
The author of Vue.JS also migrated Vue completely to Typescript.
At first I had major apprehension because of how much Microsoft generally enforces things on developers.
It's well know that if you start using C# , your entire stack will generally be MS based...(SQL Server, Azure etc... )
But after I did the migration , I was blown away by how confident and how much flexibility I had when i was writing my code.
Even if I have been writing code with Java / C# for nearly a decade , nothing has come close to Typescript in terms of productivity,flexibility and confidence.
Having used Javascript since before Node.JS , I think the whole idea of having to "transpile" my code to something or to respect some "rules" define by a company with a reputation that wasn't really "all in open source" .
But after using Typescript on multiples projects , you just can't go back , it's incredible how well it's scale without enforcing anything on the developers.
Hopefully , one day bootcamps will include Typescript in their trainings to demonstrate how typings can solve maintainability issues...
- sephoric 8y agoI'm starting to think Microsoft's strategy with things like VS Code, Monaco editor, and Typescript is "blow the developer away with how amazingly productive they are so that they will want to use more of our products". Because it's just so high quality yet also gratis/libre (MIT license), that I can't see what else they could be trying to do.
- evilduck 8y agoIt's probably multi-faceted. Part of me thinks it's just something they use internally extensively and that branching out to the public means they can easily hire talent to work on their own projects. It's also probably an effort to stay relevant and make amends with web developers, who have long held them in low regard. And yeah, Azure is a booming business for them. VSCode has a bunch of first-party extensions that reduce friction for working on their platform.
- jcmoscon 8y agoYes, and I will start looking into azure because of this same amazing feeling I'm having with VS code and typescript.
- sephoric 8y agoIf it's as cheap and powerful as AWS then I'm on board too. But I doubt it is, Amazon's got it down to an intricate science that seems like it can't be beat.
- WorldMaker 8y agoDepending on specifics (obviously), Azure is quite competitive with Amazon on pricing, and extremely competitive on "power". Your mileage will of course vary, but the interesting thing about Azure versus AWS is (surprising to some) Azure tends to use more "open standards" versus AWS' proprietary solutions. (Two examples off the top of my head: Azure supports Docker and Kubernetes directly rather than the Elastic TLAs' own in house container models and container orchestrators. Azure's most used in-memory cache is Redis.)
- nwsm 8y agoDefinitely look into it, but it isn't nearly as robust as AWS. Automation/DevOps and data streaming/processing are some lacking areas. Fine if you just need PaaS app + RDB though.
- h1d 8y agoThe interface is astonishingly Windows'ish with millions of knobs to turn and not as stable as you want. (Resource usage metrics returned errors for a while on me.) You will need time to get used to it. I even use AWS for a Windows instance.
- julienb_sea 8y agoHonestly I also think its a recruiting tool for Microsoft. Developers watch the meaningful and useful open source contributions made by Microsoft, and some of the highbrow disinterest in Microsoft due to choices made in the past will fade.
- Jach 8y agoMS has long been about "Developers! Developers! Developers!" But these days they're about more than just Windows developers shipping native closed source applications.
- h1d 8y agoYet Visual Studio (not the Code) is still a payware with multiple editions.
- manigandham 8y agoYou can build anything with the free community edition and they keep down-shifting previously enterprise features with every major version.
- fooey 8y agoMicrosoft's tooling is fantastic Trying to work with other databases after using SQL Studio is incredibly frustrating
- deleted 8y ago[deleted]
- chubot 8y agoThis is not new -- Steve Ballmer understood this viscerally (ahem) over 10 years ago: https://www.youtube.com/watch?v=Vhh_GeBPOhs https://www.youtube.com/watch?v=Vhh_GeBPOhs Granted, they weren't releasing much open source then, but it was all free to use, and the quality was far above open source alternatives (e.g. think the Visual Studio debugger vs. GDB wrappers). I think they just naturally figured out that there's zero advantage to keeping developer tools closed source.
- skohan 8y agoNever forget "Embrace, extend, extinguish". Microsoft has a history of adopting open standards, adding value to them to gain market share, then leveraging that to destroy their competition. Microsoft might seem to be an "open source champion" now, but remember that it is a publicly traded corporation with a fiduciary responsibility to maximize profits for its shareholders and a history of anti-competitive, anti-consumer practices. Right now they are being warm and fuzzy to regain the developer mind-share they have lost over the past couple decades to open-source software. If they get a large percentage of developers using their tools and services (looking at you GitHub) I would not trust that they will continue to be so warm and fuzzy.
- sime2009 8y agoI know how "Embrace, extend, extinguish" works when the product people are "locked" into is closed source and propriety. But explain to me how this works when the product is open source and can be forked by anyone?
- skohan 8y agoThey may not be able to do "Embrace, extend, extinguish" in the exact same way with their open-source efforts, but that doesn't mean they would not be able to apply leverage given sufficient market share. Imagine if VSCode becomes the defacto code editor. Then they add seamless integration with GitHub, including value-added features which are not available from other providers like gitlab. Developers accept it because everyone uses GitHub anyway. Then they add features to GitHub to integrate seamlessly with Azure, and bug tickets related to GitHub plugins for interop with AWS start to take longer and longer to be resolved. Then maybe one day they change the terms of service, and it's no longer allowed to develop GitHub plugins which compete with Azure. Then they release an update to VSCode which uses deep learning for code completion. On Windows it uses a new DX12-powered subsystem which makes it fast and responsive, while on Mac and Linux it falls back to a single-threaded solution which makes the whole application feel laggy. In a scenario like that, it would be in principal possible to fork VSCode and make a more platorm-agnostic version, but how realistic is it that an individual, or even a small team will be able to keep up with a large corporation which seeks to make such an effort less successful. Open source software is great, but if Microsoft owns the governance of those projects, and the up-streams and down-streams, they still have a lot of power over them.
- alasdair_ 8y ago>I can't see what else they could be trying to do. https://en.wikipedia.org/wiki/Visual_J%2B%2B https://en.wikipedia.org/wiki/Visual_J%2B%2B Microsoft does the same thing over and over - "embrace" a technology, "extend" it by adding some extra stuff to it that happens to work best on Windows then "extinguish" the tech once people are locked in. Also see: Internet Explorer or Kerberos or Office document interoperability or AIM (messenger) or half a dozen other things.
- sonnyblarney 8y ago"Even if I have been writing code with Java / C# for nearly a decade , nothing has come close to Typescript in terms of productivity,flexibility and confidence." Same here. Isn't this truly amazing? Take a jangly language like JS, and add some typing for the compiler, which forces you to write cleaner code in addition to all the compiler advantages ... combined with some really cool features and bang a magical, pragmatic language. Aside for some script things for which Python is still a blessing, I'd chose TS for everything else, at least to start. It just has the right mix of flexibility and expressivity etc.. Though TS is an MS project, I suggest it really is quite different, it's 'open from the start' kind of thing, you can have a loot at TSC internals. The team seems to be fairly dynamic and responsive. Typscript is my #1 favorite 'invention' of the last few years, I think it will be around for a while, and I hope to see many more JS API's 'properly documented' with the help of TS.
- nerdponx 8y agoI've heard it said that Javascript and C are both good languages to compile to -- the language itself is very "fast" in basic operations (V8 is hyper-optimized, C is relatively close to the metal), but an ugly language with lots of gotchas and warts that make it hard for a human to use effectively, but which don't pose a problem for a well-designed compiler.
- kccqzy 8y agoNo lol. Javascript is not a good language to compile to. People compile to JavaScript only because it's the only language to run in browsers. Most compilers, after type checking and semantic analyses, basically generate a control flow graph with basic blocks. Javascript doesn't have goto so it doesn't allow you to express those low-level things natively, which is why emscripten has to include a relooper component to turn them back into loops and conditionals. If you want a good language to compile to, look at LLVM. It's a language designed to be compiled to, and it's mind-blowingly easy to compile to than either C or JavaScript.
- brett40324 8y agoIt's maybe worth noting here that compiling to C and transpiling to JS are two entirely different paradigms of linking and building a software release.
- funkaster 8y ago> if I have been writing code with Java / C# for nearly a decade , nothing has come close to Typescript in terms of productivity,flexibility and confidence I can completely relate. To me the greatest thing is the tooling around it. Using tide[0] on even plain js codebase is just amazing. I really wish ruby had a TypeRuby compiler (to regular ruby). I know about crystal, but I still want regular Ruby, just with a type checker at compile time, not runtime. [0]: https://github.com/ananthakumaran/tide https://github.com/ananthakumaran/tide
- munchor 8y agoThat's awesome! Did you convert from Flow or just plain JS? I think the experience is much different when converting from Flow vs converting from JS. When coming from pure JavaScript, you do indeed become much more confident and flexible around the code. When you come from Flow, the differences are much more subtle as I described in the article.
- lhorie 8y agoI'd argue that porting from JS to TS is a very different beast than porting from Flow to TS. I've ported code from JS to Flow and could say the benefits are similar to those of porting from JS to TS. The most relevant part in this article IMHO is the conclusion: > things like a strong community and availability of type definitions are more important because weak type inference can be solved by "handholding" the type checker a bit more. I think it's important to highlight that this may be true of his project but not necessarily yours or mine. Flow's type inference provides a much deeper level of confidence than TS with far less effort, for example, typing only the public interface of a module is often enough to surface type mismatch errors several functions deep within the module. In TS, you'd have to type every function signature to get the same level of confidence. What worries me about flow is reflected in the comment from the facebook engineer linked from the article: it seems the flow team is focusing heavily on facebook-scale performance at the expense of most every other aspect of the project. A while back, the existential operator was quietly deprecated in the name of perf, and lately some updates have been of questionable soundness, e.g. https://flow.org/try/#0GYVwdgxgLglg9mABAdxFAFAQwFyIPIBGAVgKbQCU2YIAtgSQE6IDeAUIogyVCA0pgG5WAXyA https://flow.org/try/#0GYVwdgxgLglg9mABAdxFAFAQwFyIPIBGAVgKb... (compared to http://www.typescriptlang.org/play/#src=function%20wut(a%3A%20Object)%3Anumber%20%7B%0D%0A%20%20return%20a%3B%0D%0A%7D http://www.typescriptlang.org/play/#src=function%20wut(a%3A%... )
- brett40324 8y ago> In TS, you'd have to type every function signature to get the same level of confidence. I don't disagree, but isn't this the point? That by typing every function you can reliably have confidence in parameter types and return value types, and if your program is able to throw a type error on build, then it should and alert the developer that they're not logically correct in their implementation.
- lhorie 8y agoMy point is mostly that you can get away with explicitly typing less things in flow and still get similar levels of coverage. For example, consider this example: export function formatTime(time: Date) { return digitize(time.getHours()) + ':' + digitize(time.getMinutes()); } function digitize(n) { return ('0' + n.toStirng()).substring(-2); } Just a single type declaration is enough to let Flow catch the typo here. In TS, you'd also have to write the argument types for `digitize`. Importantly, if you wanted to explicitly add arg types for `digitize` w/ Flow, your editor can tell you what they are supposed to be.
- no1youknowz 8y agoI went from jQuery (inc libs) and < ES5, to VueJS (components) and ES6. It was such a big jump, after 8 months of it now. I am so much more productive than I was before. It's just not funny. If I did the same as you. Going from JS to TS, what kind of experience (from there on in) should I be looking at?
- com2kid 8y agoIMHO the largest difference is the amount of time you save hunting down stupid issues. e.g. no more spending 3 hours fixing a typo. Also, code is much more manageable, and refactoring is tons easier. With enough Babel plugins, you can get ESNext functionality that does whatever you want (some of those early stage proposals are really cool! They might go away tomorrow, but hey, so cool!), so Typescript's old advantage of offering more language features is kinda nullified. In the end, I started writing the later part of my current project in Typescript, and I much more enjoy working on that part of the code than the earlier parts.
- deleted 8y ago[deleted]
- sonnyblarney 8y agoTS takes one day to get going, which is one of the best things about it. Stick to the 'basics' of TS, which are super general programming syntax structures and idioms - there's really nothing new you'll come across (maybe unions?) - so it's easy. Then you can try some of the trickier things but frankly we don't use them that much. You'll be up and running pretty quickly because you can mix your 'new' TS modules with old-school JS code no problem. And then go from there. I like TS because it's not some big new fancy paradigm shift: it's just typing, some other pragmatic things, and it works pretty well, very quickly. It's the only tech I will actively evangelize as being 'the thing you need if you use JS' type thing.
- matchbok 8y agoYup. I will never start a new project in plain JS ever again.
- nojvek 8y agoTo be fair, pure js with types as jsdoc comments that typescript handles just fine is a great way to write code. No transpiration needed for node modules. No source maps, it’s same old plain JS that’s nicely checked by typescript.
- mikewhy 8y ago> Even if I have been writing code with Java / C# for nearly a decade , nothing has come close to Typescript in terms of productivity,flexibility and confidence. TypeScript is, by far, my favorite type system. I love structural typing. I love conditional types (ReturnType<T>). I love things like `keyof T`. I love how good it's inference system is. I love how I can still use it in a JS file and still get type checking with JSDoc. I tried out Dart over the holidays and it felt like a major step backwards. Seriously, hats off to the developers.
- DigitalSea 8y agoIt appears the tide is changing and what was once hated upon by many in the JS and front-end community, has now become cool and a tonne of projects are migrating. Another project migrating to TypeScript is the Aurelia Javascript Framework for its next version coming out later in 2019. It's funny because I remember when Angular 2 was announced and that it would be written completely in TypeScript, they copped a lot of backlash for it, but it appears to have been a good move. I exclusively have been writing in TypeScript for about 3 years now and it's crazy how good it actually is, especially for distributed teams in different time zones. The code is self-documenting and the number of silly mistakes being committed into our codebase has dramatically been reduced, combined with solid unit tests, we haven't really had a code level bug in what feels like months, browser bugs on the other hand... My favourite thing about TS besides the types and interfaces is the compiler. I no longer have to use transpilers like Babel anymore because TypeScript handles compiling to many different module formats and targets. Back when I used Babel, it felt like pulling teeth because of the different plugins and packages you had to install and configure to use. I find it really hard to use anything other than TypeScript now, it is simply too good.
- tybit 8y ago> It's well know that if you start using C# , your entire stack will generally be MS based...(SQL Server, Azure etc... ) That’s only because of Microsoft fanboys nowadays, .NET core is a pleasure to use on Linux and AWS with a variety of databases etc
- skrebbel 8y agoYup, it's ridiculous cargo cultism from mediocre C# programmers. There's nothing about C# that forces you into MS's ecosystem. In 2014, well before Microsoft's dotnetcore oss adventure, I ran the dev team at a startup. Our entire backend was C#. Our devs used the OS of their preference, and so we had Mac, Windows and Linux. Xamarin Studio is (was?) a remarkably decent IDE for something so niche. We hosted it in Docker (bad call, it was way too new then) on Mono (great call, it Just Worked), on Linux. Data in Postgres. All of this was as easy as doing the same with eg JS or Java (and arguably easier than eg Ruby because C# has a proper cross platform dependency story). There's nothing about C# that forces you to use SQL Server or Azure. Absolutely nothing.
- mirekrusin 8y agoIf you did js->ts, that's not "exact same job", is it? He describes flow->ts and highlights differences between the two.
- iamaelephant 8y ago> It's well know that if you start using C# , your entire stack will generally be MS based...(SQL Server, Azure etc... ) It may be "well know" but it's entirely untrue.
- knocte 8y ago> It's well know that if you start using C# , your entire stack will generally be MS based...(SQL Server, Azure etc... ) Why the fuck...? I love using Linux+PostgreSQL with F#, and deploying to AWS. > Even if I have been writing code with Java / C# for nearly a decade , nothing has come close to Typescript in terms of productivity,flexibility and confidence. Disagree. After doing JS & Java & C# & Perl & F# & TS (& a bit of others such as C, C++, Python), I think TS is just a giant patch to a language that is broken by design. And a patch is just a patch. Just fucking migrate to a decent language already! (e.g. F# or Rust)
- czechdeveloper 8y agoFrom my point of view, they have just great integration together, but but nothing really forces you to use them. Original post sounded like you are being forced into it.
- epscoe 8y agoWhat's your F# setup on AWS? I've been tinkering with an F# (Giraffe) side-project for a while and am finally trying to find a place to host it. Azure seems simple to use but way too expensive -- app service + DB starting around $100/mo, even with Linux and Postgres. AWS seemed complicated for a solo dev, couldn't figure out what I actually needed or how much of it, or how to plan for scalability later without paying too much today. After too many hours comparing prices and features, I resigned myself to learning Docker so I could deploy to Heroku and plan to move it later. I'd love to hear your thoughts/dev workflow/deployment pipeline/etc. (Side note, it turns out Docker is a lot more user-friendly than I'd feared, although my dev machine runs Windows Home, which is less supported (also want to point out that at 1/3 the price of a Mac, Windows is still not worth it and Windows OEMs all have terrible support)).
- romanovcode 8y ago> It's well know that if you start using C# , your entire stack will generally be MS based...(SQL Server, Azure etc... ) This is very not true. For the past 2 years or so of using C# I never used MSSQL, Azure or even Windows.