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
anyto 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
:anyas 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
nameis astringand anywhere I use name, either as a parameter or in an assignment or expression, Typescript will flow thatstringtype 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 🤣🤣🤣🤣🤣