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.
Mohsen Azimi@mohsen____Woah! Facebook Jest is moving to @typescriptlang
github.com/facebook/jest/…04:40 AM - 16 Jan 2019
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. 😉
Jamie 🏳️🌈I'm dropping Flow in favor of TypeScript... and you should too.
Flow just doesn't give a shit about the community... and I say that having worked on the Flow team at Facebook.
Facebook should drop Flow entirely. It's a bad investment for even them at this point22:40 PM - 19 Nov 2018
Kent C. DoddsI've been using TypeScript for ~1 week now. Migrating from Flow.
Breath. Of. Fresh. Air.
I'll blog about this in a week or two. This is really great though.20:41 PM - 20 Dec 2018
Ryan FlorenceSide note. TypeScript is taking over. It has gained rapid adoption in 2018 and its embarrassing that I don't know it.
If you're looking for a job, there's a 50/50 chance your next code base will be using it if my workshop attendees are any sort of decently random sample.02:32 AM - 30 Oct 2018
Guillermo RauchTypeScript: will cement the role of raw JS as a prototyping language, and give it a certain incremental path towards increased safety, correctness, enhanced team collaboration. ".ts" will be supported out of the box by most frameworks and platforms. Bonus: assemblyscript.org20:08 PM - 29 Dec 2018
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
Top comments (68)
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 :)
I really hope not..
Typescript, has its usecases, but without native support it is almost pointless to me.
Too much setup.
The easier debugging is nice however.
My main gripe is problably that it tends to promote large corp style OOP with bajillions of pointless interfaces and classes.
Which in my experience leads to state soup and lack of code-mutability.
For sure it can promote large corp style OOP. Perhaps, and I have no data for this, just my musings, is that Angular promoted this once they adopted TypeScript. DI, classes, decorators etc...
I've been using TypeScript in React and browser extensions and almost never use OOP. The only time I've really used classes in React was for components that required state. Aside from that rarely, and now that hooks are stable and able, function components would be the way to go for new work.
Having said that, OOP is not a bad thing. Just like anything, people can do bad things 😉
I am mostly against OOP, for a number of reasons that would longwinded and off topic. :)
I my world, the TS gains do not outweigh the layers of complexity added to all parts of the developing process from developer skills to the libraries and build systems we use today.
It is unnecessary for most things, so why bother with it?
I am talking about complexity, and the way I see the language generally used in practice.
TS has more features, that is the entire point of the language.
Just yesterday I was debugging a TS npm library, all I wanted was add to poke the source with a few console logs.
But because it was a TS library it came in 5 different ES versions, had a slew of typings I had to see through, and the actual source was not included because npm is for JS.
This would have forced me to get the source code, hook it up to my npm dependencies and then build it with my few debug changes.
Is there a better way to debug, problably yes, I could have explored the map in the browser and addd breakpoints, or use some other tool.
Had this been a JS library I would have spend a few minutes looking over the source.
Now, imagine a junior wanting to do this.
Complexity comes at cost, it is the entire point of functional programming, but centered around the problem of state management.
Toting TS as a good tool for functional programming is like saying eating children is a good way to prevent hunger.
It overlooks the actual problem.
Yeah, that all makes sense. It's definitely a different workflow.
I'm used to other languages that don't ship source code in packages, so this is nothing new to me.
Npm package authors could include source if they wanted - so the lack of it seems more like a personal choice on the part of the author.
If a js lib author uses Babel to support older versions of Node or browsers, they will include transpiled versions of their js code.
In .NET/C# I can make a package that has compiled code only, but includes a hash to a git commit. When I'm debugging, my IDE pulls the repo code down to my machine and lets me debug into it live. It's a great developer experience.
Lack of tools is not really the problem, quite the opposite the way I see it.
Tools should make us more productive, not be a nessesary thing to be productive at all.
The fact that we are even talking about solving the problem with more IDE tools suggests a flaw in the system.
We need something that will reduce complexity at this point. Otherwise the frontend community will end up fragmenting into completely unessesary domains of knowledge based on frameworks and what kind of transpilation we do.
More so than it already has.
Came across this today. I rarely use classes myself, but I thought this was pertinent to the convo.
And I love the new VueJs 3 functional component API RFC.
Functional + Types = 💗.
I tend to agree. I have to use it at work and I understand the arguments in favour; but to me it still feels like a ball-and-chain compared to vanilla JS. I do understand some of the benefits; but there are also some downsides:
privatereally means private
But yes - mainly my problem is that it can encourage a classic OOP approach to coding when IMO one of the big strengths of JS is that it facilitates some really effective functional approaches.
Might as well call it hypescript at this point. It seems like it’s all the rage.
Hmmm HypeScript could have some fun typings in that language...
I dig it!
I like HypeScript already 🙆 TAKE ALL MY MONEY!!
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.
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 :)
This can definitely happen, though it's a lot less common (and painful) than it was 3-4 years ago.
I had the option of either using
:anyas the type (or leaving the type off, as it will default to
If you decide to use
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.
Notice, there are 0 type annotations here...
But, Typescript knows that
stringand anywhere I use name, either as a parameter or in an assignment or expression, Typescript will flow that
stringtype to the next place I'm working with
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.
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.
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. 👍
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.
Anything that adds complexity to that situation i would deem as a bad solution.
With TS, we are just shifting the work to someplace else and adding new problems for people to learn rather than solving the original issues.
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 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.
I think one of the wonderful things about Typescript is that it's an opt-in type system.
And copy it into a Typescript file (
And then compiled it with the Typescript compiler:
If I wanted to I could add just 1 type:
And everything still works!
Sure, Typescript code that you might see in an Angular application can have types everywhere and a bunch of strict compiler flags - but this is one side of the spectrum.
Typescript is happy and helpful anywhere along that spectrum.
:any(or don't add an annotation at all - it's the same thing), leave the compiler options loose, and ease yourself into it.
Then as the project grows in complexity, start flipping on compiler flags, add more types and see where your expectations of your code don't match reality.
If you just prefer no type information in your code, cool! Don't use Typescript :)
But it's not an all or nothing thing - approach Typescript on your own terms and I think you'll find it enjoyable and interesting.
If you're an Angular developer you'll be pretty familiar with it already ;)
TS is something I have been looking to learn for months/years but haven't really started with. I am sure it is same w/ many other people. They are hitting the tipping point now. Can't wait to give it a try. 😁
2019 is going to be a year of typescript for me for sure. It was a growing interest throughout 2018 (along with testing) and I finally might get a proper project in TS. My hopes are for higher code quality and predictability, and for the benefits of code editor suggestions :)
The main problem with typescript is that it is becoming a hack upon another hack. The types get very long and the compiler has problems with them (I was able to let the type checker run into an infinite loop aka a stack overflow).
Typescript the idea is great, but the execution is lacking
Still worlds better than untyped js though
I've worked with Typescript for 4 years now on large and small projects, creating my own custom types and using typed and untyped libraries.
I've never run into a case where I had an infinite loop that caused a stack overflow of the Typescript language service or compiler.
I'm not saying it can't happen, but, based on my personal experience, I can't see this as being a "con" for the language.
I can make any compiler blow up with specially crafted code - that's just programming.
If your types are getting very long (I'm assuming because of complex generics), then you can use type aliases to rename them to something shorter...
Or maybe your system complexity is showing itself in the type annotations.
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!