This comment in the Jest repository, https://github.com/facebook/jest/pull/7554#issuecomment-454358729, has been floating around on the Twitterverse the past few days and seems to be garnering a lot of attention.
The fact that a Facebook project is migrating to TypeScript (TS) is kind of big deal considering they're also behind Flow, a direct competitor of TS.
Other prominent JS devs have been chiming in as well. Some with a little more cursing, so apologies in advance. 😉
Is this the final nail in the coffin for Flow? Is it another year where TypeScript adoption continues to rise and it becomes the Year of TypeScript?
There's even a horse_ts Twitter account now. It's not too hard to guess who it is, but I still find it pretty funny.
"So if you’ve been a holdout (like me, to be honest), 2019 is definitely the year to learn TypeScript.", @kball quote from https://zendev.com/2019/01/15/frontend-development-topics-to-learn-in-2019.html
Share your thoughts in the comments below and feel free to shamelessly plug your TS posts, if you've written any on dev.to. I'll shamelessly plug first.
Photo by NordWood Themes on Unsplash
Oldest comments (61)
Might as well call it hypescript at this point. It seems like it’s all the rage.
Probably a good sign that an all-the-rage thing in JavaScript is a tool that should fundamentally help write more sound software across the board, and one that’s been around long enough to become pretty stable I’d imagine.
Hmmm HypeScript could have some fun typings in that language...
I dig it!
I like HypeScript already 🙆 TAKE ALL MY MONEY!!
I'm one of the maintainers for React's types, and I'm writing a post series on how TypeScript works with JSX. Hopefully this'll clear up some of the magic smoke behind how JSX typing works :)
dev.to/ferdaber/typescript-and-jsx...
Cool!
TypeScript is what makes Angular 2+ enjoyable for me. I'm seeing it added to everything lately. A good sign indeed.
If you're an Angular developer you'll be pretty familiar with it already ;)
I do believe it's all the rage right now but there are times when I see the value in a JS implementation. I still think there is not enough support for certain types and you are left either writing your own adding
any
to describe something. And in converse, when working on a large codebase or teams the comfort of types is very helpful.And naturally a shameless plug for a react-native expo starter I made to solve that problem for RN.
github.com/mrtnrst/expo-typescript...
Which are some types you think are not supported? I was interested in jumping in this TS-hype-train and things like this are good to know before :)
I get the feeling Martin meant 3rd party libraries that don't have typings defined (if written in JavaScript) or are written in Typescript but don't provide their own robust types for APIs.
This can definitely happen, though it's a lot less common (and painful) than it was 3-4 years ago.
I recently used an Angular-specific 3rd party library for authentication. They didn't include types for some of their underlying JavaScript code.
I had the option of either using
:any
as the type (or leaving the type off, as it will default to:any
) or writing my own types to describe their JavaScript APIs.I wrote out some type definitions that covered the part of their APIs that I was using and the definitions took about 15 minutes after looking at the JavaScript code in the package under
/node_modules
.If you decide to use
:any
(or, again, leave off any type annotations, which works fine) you are where you would be with plain JavaScript - so nothing lost.If you add type annotations, you gain all the benefits of types - my favorite being discoverability of APIs.
Right, It made more sense after reading more about it. I think the discoverability in general is such a nice thing you get by going with static types that is almost worth it by that alone haha
Another nice thing about Typescript is how the types "flow" through the application.
Often I only need to annotate a couple of parameters, variables, methods.
Then when using those things the rest of my code is able to infer the results of operations.
For example:
Notice, there are 0 type annotations here...
But, Typescript knows that
name
is astring
and anywhere I use name, either as a parameter or in an assignment or expression, Typescript will flow thatstring
type to the next place I'm working withname
.A lot of developers when first using Typescript will add a ton of annotations to their code, only to realize later that Typescript is great at inferring type information and doesn't need us to be so explicit.
I'm curious as to what types you're missing as well.
I have not encountered that yet. An interesting quirk is that if you only need Type checking then you should make an interface. Interfaces are thrown out at compile time which leaves your code lighter. Classes are kept and should only be used if you actually need to instantiate an instance of that type during runtime.
Or is 2019 really the year js falls out of the top ten...because typescript bum bum buuum
well, turns out, if you don't know javascript, your typescript will suck too. oh yeah, and all your doing is writing a superset of JS that literally transpiles back to JS in the first place, so it would be REALLY weird for typescript to displace JS, as ultimately that is what you are actually making with typescript...
Big fan of TS. Been using it for years maintaining Angular apps and have even picked up the habit of using it for larger-than-small JS projects.
Didn't get around to trying Flow.
I've just started dabbling with TypeScript and..
A simple change helped me to reduce the file size today 😉
probably because I wasn't doing Babel right 😅
But it wasn't so bad so more reason to like/move/try to use TypeScript 👍
I know a lot of people came to TypeScript from Angular 2 and on, but for me it was a different path.
We adopted TypeScript in 2015 where I was working at the time and used it with a custom front-end library. After that, I jumped into the world of FinTech with React and TypeScript. And since then all my professional React experience has been pretty much all in TypeScript. And aside from React, I've used it in node as well. Works really well there too.
It plays really well with React. You know the TS team cares about Reactland, because they added the fragment syntax fairly quickly. And it plays well with Preact too. It was a minor fix, but I had a PR go into Preact for a types issue just over a year ago. Felt pretty good about that.
God, I hope not #killitwithfire
That was literally my first thought when I read the title 🤣🤣🤣🤣
This was literally my first thought when I read the title of this article 🤣🤣🤣🤣🤣
TypeScript strict syntax makes it scalable. So, big projects in TypeScript reduces a lot of pain in the ass.
Not exactly sure what it means that 2019 is the year of TypeScript. I worked on large projects at Microsoft and they used TypeScript exclusively on large scale systems for years. And there is a good reason it was used over vanilla JavaScript. I can't imagine not having type safety beyond 1 developer.
All I mean is, maybe this is the year that its adoption really skyrockets. I've been using it since 2015 and it's 🔥.
I've recently started to write in TypeScript while creating my first Angular application and I love it. Being able to use types, classes, interfaces etc makes everything so much easier!
Typescript seems to be really gathering attention nowadays. I remember avoiding Angular, as I had to learn another language.. Typescript. But its that same typescript that made me take Angular as well as trying all Possibilities to use wherever I use javascript from React to Electron Js. High quality intellisense and type enforcement makes Typescript 1st class.
If you're in Reactland, it couldn't be easier to get started with TypeScript these days since support landed in Babel 7 and they implemented support in Create React App.
To be fair having to learn Typescript AND Angular at the same time makes learning both significantly more difficult.
Nope. I stayed with React and Typescript. Angular's strategy felt too heavy for simple applications.
I wasn't defending angular, I don't use it either. I was saying that learning both at the same time makes both hard to learn.
That was my exact course, and I believe that is why I am so biased toward TypeScript. I avoided so much JavaScript pain.
I definitely took courses on fundamental JS later on, because as wonderful as TS is, at some point you will break your face if you don’t understand the underlying language.
Oh yeah I LOVE TS, I just was overwhelmed with it at my first shot(I come from static typed languages but was very familiar with JS by this point), and it was annoying not knowing if my problems were TS or Angular when I tried learning both at the same time.
Been There. Done that. 👍
We're gearing up to adopt it where I work, so very possibly yes.