I look forward to the near future where TS is the norm. Already seeing it happening in Next.js official example repos, rewriting their basic with-tailwind in TS. React remix tutorials also just come at you with TS out of the gate.
One of the biggest advantages is change management. You adjust one function signature and the entire codebase lights up like a Christmas tree, showing all the places that need adjustments. Or just basic things like renaming a symbol across all files can be done (mostly) automatically.
I always thought TS is great for large applications, but it's actually also really helpful in prototyping. What you describe really helps in environments where things change a lot and it gives some peace of mind that stuff will probably work after adjusting
I've been using typescript since 2014 and I STILL do *not* understand why some people are reluctant to use it. Every project I write that requires javascript is instantly translated in my brain as "obviously this'll be typescript" I only use javascript for quick test apps and I find myself beating my head against the wall without my comforting type constraints 😭
Please keep making these history videos! I feel as a younger dev coming into the space, I've missed out on learning a lot of the tech that brought us to where we are today. These videos help unfurl the layers of the SWE onion.
My company wanted to move away from Angular, because some loud colleagues found it way too strict (as it always comes with TS), and the half year release schedule made our projects after 1.5 year obsolete, because we did not keep up with the versions. As we don't write test, most of them don't use TS features (use any most of the time) the management did not see the benefits, they wanted all the new projects to be in React.js. Like plain React no TS. It took us some time with my leader, to change the management's mind about it. In short we came up with these points: Most of our colleagues write low standard code. They don't know enough JS and can't accept the helping hands from TS. Changing to an unknown lib in the company without TS will lead to even more bugs and bad code. Lowering these bare minimum standards won't help us in the long run. We should encourage TS and tests, and that will help us keep up with the versions. They understood and made me do lectures for my colleagues. I will present them this video next time!
Typescript is quite buggy at times and prevents you doing a lot of convenient things the language was designed for. If you're not gonna use those features you might as well choose another language such as java
@@jp46614 which features? You always can opt out of type system with any/unknown if you don't want to bother defining some tricky very dynamic type or want to do it later.
Juustt remember to make a note that if you're talking about TS - JS relationship, it's actually a transpiler than a compiler. The difference seems linguistic-only, tho it's an important thing to not forget about when writing code. For start, Compiler will warn you if your code does not make much sense andc(modern one) won't compile code with unreachable code. Transpiler will mostly only tell you about type errors and things it can't transpile to target language..
Didn’t wanted to change my mind in 2 years of JS programming. But the day I tried TS, I felt like I was idiot for not trying it before. Such a good layer on top of JS. And if like me you hate Java, it’s seems the same but your experience is a lot better
Java feels like a prison, you're forced to adhere to a very strict set of rules, and this also means that sometimes you will do everything do avoid doing X thing because you can't do it how you like it. JavaScript feels like you're alone in the world, with nothing to control you. You can do anything. But that also means you have no idea what to do, and even if you have a goal, you have no way to learn from anyone. TypeScript is the perfect mix between the two. It lets you do whatever you want, and it provides you the necessary crutches when you're in need of help, and can provide guidance about what you should be doing in the first place
@@meceffeukada3767 Nah man, a lot of people (including me) tried Java and that's exactly why they hate it. Though I'll give 2 exceptions: - I worked with older versions (mainly 8, also 5 and 11), but that's all that's ever used. There's just no jobs with newer java projects - IntelliJ is the best piece of software ever written, and it works the best with Java. It's still the best option for every other language, but it's only like 80-90% as effective for TS or C#
I still don't get how to think in javascript, it's like reading the first pharagraph of a book 30 times and still not remembering a word of what I read.
Typescript is worth even for the code completion, and structuring your project, you always know what are the types or what members an object has. If your app big than these are huge benefits, not to mention the other many benefits TS has.
i remember the times I used to get undefined for an object property and lose my mind, trying to track where it's getting overridden. This was during jQuery times when anything can update anything on any event. after a whole day or two, I'd realise it wasn't isSpellingCorrcet but isSpellingCorrect. Thanks to typescript, now none of that BS happens. I get suggestions from intellisense and I simply press tab. ❤️
What my beef with Typescript is the types that some vendors create that make no sense when reading the name and no sense when you take a look at the type declaration itself. Just made me wanna go back to loosely typed JS. Feeling much better now.
I go back and fourth on this. I trust MY types but not really everyone else's. I kinda think that as TS becomes the standard for public packages though this will happen less and less. Or people will at least make more open source efforts to correct any discrepancies between how the api truly works on the js level and what its types represent
Wow. This video combined with Imperative vs declarative are simply amazing. you explain things so concisely and simultaneously digestible that my brain can totally follow. That combined with the imagery and the well-timed glint of Oprah left me in stitches. More, more, MOAR!! These videos are great!
So true, I love typescript for the extra documentation and error checking. If you define a function decloration or even parameters then decide to change them, typescript will tell you where in the code your old usage of a function doesn't match its new decloration.
First time I used TS by choice was for a sw architecture assignment back in uni. We had to implement the classic GoF design patterns using any language of our choosing. I wanted to apply the patterns in web apps. The thing is, some of the patterns make the most sense when dealing with user interactions (such as memento), so they had to be run in the browser, not server-side. I was still a newbie so it took me quite a while to realize that JS (including ES6) is not really an O.O. language, so it lacks many of the required constructs such as interfaces and abstract classes. Our professor was a pain in the ass to deal with. If your code didn't explicitly use O.O. constructs he would give you a bad grade for "not complying with requirements". I thought my project would be a lost cause, but then I read about TS and all the O.O. syntactic sugar. Once I got up to speed and figured out how to add typings to pre-existing JS libs (great code auto-completion in VSCode, btw), I could implement my project in about three days. I've been a TS fanboy ever since haha. So yeah, TS is not just "JS with types", it's so much more.
Thanks for the video, I love it. Side note: 00:05:23 TypeScript is not a compiler, it's a transpiler, since it doesn't compile code to machine code, it compiles it to JavaScript
Angular 2, man... Deciding to learn it was one of the best choices I've ever made. I had just learned v1 when v2 came out, completely different, rebuilt in Typescript. Totally wasted my time learning v1, but I never would've been such an early adopter of TS otherwise. Thank goodness. Funnily enough, Google wouldn't have adopted it if they hadn't thrown in decorator support. It's stuck in "experimental" purgatory to this day because the ES decorator proposals have been taking FOREVER and are still only stage 2.
Will TypeScript age well though ? As you explained, JS already catched up with modules and classes, but in the future, JS new features may conflict with what TS proposes, like the private class fields proposal (stage 4) vs the private modifier in TS. The promise of TS being just a layer over JS may be more and more challenging to keep with time. The two outcomes I see are either, breaking changes and deprecations on TS new versions, or a split from JS evolution trajectory at one point.
I suppose the compilation process from TS to JS can be adjusted to do anything in theory. There's already some inconsistencies with things like the readonly modifier which does not enforce prototype fields to be immutable on the compiled JS code despite being "readonly" on the TS side.
I’m a developer who started learning, without a technical background, in March 2020. Because of this, I’ve missed out on the context surrounding tools that my team uses, like TypeScript, which has caused some problems for me. This video really helped me build a relationship with the “why” of TS, which is influencing my relationship with the “how” of TS. Thank you. Subbed. Edit: maybe GraphQL/ApolloGQL at some point?
I love this video. I love TS from the beginning. I just love the way you explain the importance of type safety. Because some people are so lazy and hate to work with types. They write some code and quite. If people want to write correct piece of code, I believe that having a type in front of your variables is compulsory. Because that means, you know what you are doing...
No idea why, but I love finding old stuff like this. For example, here's Chris Coyier from 2007 when he was in an Irish band - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9GUBQs6SgTE.html
I started with Basic, C, and then Java at university. When I first started to use JavaScript I hated it. What I realise now is that I actually hated the LEGACY of JavaScript. Modern JavaScript is infinitely better than it's origins. Typescript is just the future of JavaScript.
yeah same here, I watched this video a few days ago then was trying to remember why TS won... i went back to the video and realised it never actually said anything about beating out its competition of Flow etc...
i loved the part where you said that "dynamic languages like JS break down IF YOU'RE NOT CAREFUL"... most people don't understand the fact that there is no problem with JS if you're not bad... the problem starts when you have many people, a lot of whom are bad, and you have to coordinate with them how things should be... then TS makes things easier
I disagree. A programming language (or any other system for that matter) is well designed if it makes it easy to do the right thing (and optionally hard to do the wrong thing). Just because you *can* write good code with JS, doesn't mean it is *easier* to do that, compared to other languages. In fact, your argument support that. When enforcing stricter rules, even bad programmers tend to mess up less. I argue that good programmers, too, are better off not having to do in their heads all the checks that C#'s compiler, for example, can do for them automatically. And tbh, "if you're not careful", in this case, is most of time. Your team will probably have bad programmers. Or stressed programmers. Or lazy programmers. Or tired programmers. And they *will* take the easy way. Let's, make the easy way the correct one.
@@gallergur then we have to delve very deep into the philosophy of what is considered "the right thing" for some people "the right thing" a dynamic language should let you do easy is "everything" and for some people being able to do everything is bad because it leads to more mistakes by people who don't know what they are doing... mostly by people who can't bother actually learning the language and how it works... having stricter rules MIGHT lead to less mistakes, i never claimed otherwise, but JS is not bad because someone who doesn't know how to used made a mistake with it...
@@HKRazieL So you're claiming you never make mistakes? Static typing helps you, at the very least, catch some mistakes before you even save your file (let alone deploy it to production). But it is often more than that. Type systems allow you to express designs and structure using language constructs, and that is useful for communicating the design to your colleagues, your future self, AND the type checker (that can check that *your* design is used as intended, not just the language's). "The right thing" is a very subjective phrase. However, "everything" does include a lot of things that you and I can probably agree are bad. So allowing "everything" (or to be more exact: not making it harder to do certain things) is not better. Exactly what are those things is debatable. But having the ability to express these rules as executable and verifiable code is a very useful tool.
Sadly, people forget that tools like TS, Docker, Kubernetes created to solve large scale problems and driven by hype deploy them everywhere often adding unnecessary complexity
Angular were ahead of their time adopting TS and RXjs. Starting to pay major dividends. I switched back to angular from react recently and not going back to react.
Thanks a lot for the amazing video! I do have a suggestion tho, I find it hard (for me at least) when I'm trying to focus on what you are saying and then suddenly a tweet pops up in the middle of the screen here 4:39, my attention switches to the tweet and I immediately start reading it instead of listening to what you say.
The reason I like JS, and to an extension TS, is that dynamic component. Being able to define data structures on the fly in runtime. Since tbh...I want to be able to define a function as "it returns x, but with y added into it" and... trying to do that in Java broke me...
There must be something about JS that is just better suited for the current needs, otherwise it wouldn't be that successful. But maybe it's just the fact that it comes with this super flexible but fast rendering engine, and it has actually nothing to do with JS.
@@herrbasan Isn't native code...like idk...GTK, Windows forms and QT a lot faster and less resource intensive then Blink, Gecko, Trident or Webcore? Almost like the rendering engine plays a minimal part in all this considering the diversity of implementations available...even the underlying JavaScript engines have changed drastically over the last several decades with V8 only really coming into the limelight in the last decade or so.
@@hanro50 I think it is exactly the rendering engine what made JS popular. Currently the web frontend is one of the simplest (if not the only) way to do cross-platform app development. No installation, works on Mac, Linux, Windows, Android, iOS, almost out of the box. Quite standardized, hot, up-to-date. Since JS is the only language in browser, it's learning curve is easy in the begining it's not a surprise that is so widespread. It is similar to VBA in Office. It is used widely, not because it is that pleasant to use (neither the lang nor the IDE), but because that's the only choice.
@@moczikgabor Ye...but you have to remember that rendering engine is still different depending on the browser family a set browser belongs to. I can easily write code that'll look perfect in chrome, but will break in Firefox or WebKit. Yet 99% of the backend JS code will be more or less exactly the same between all three browsers. With the only breakage typically being attributed to a missing feature...
I work in a massive code base that's being slowly converted from .js to .ts, and every time I change a file over to typescript tons of latent bugs jump out at me from VS. I despise working in our .js files and can't wait for the day when they are all gone.
TypeScript seems kind of like what's happening with Python's type hints, except in that case it's happening in the main language. Gradual addition of typing to retain the benefits of dynamic languages while getting most of the security of typed languages.
I love typescript, almost know it for about 80% now, it’s vast as fuck alone (types, guards, interfaces, bindings, conditional types, overloading, decorators, tsconfig and all its options, using get/set in objects, readonly, static, expanding, inheritance …) and even more when you add utilities libraries such as rxjs, events, etc… but next step is clearly rust for server side and maybe even browser side thanks to webassembly.
Thank you for the video. Your voice is really deep with a lot of base, so listening to it on speakers is pretty hard. If you use other audio, it is fine.
i remember the times I used to get undefined for an object property and lose my mind, trying to track where it's getting overridden. This was during jQuery times when anything can update anything on any event. after a whole day or two, I'd realise it wasn't isSpellingCorrcet but isSpellingCorrect. Thanks to typescript, now none of that BS happens. I get suggestions from intellisense and I simply press tab.
Reminds me of Fireship in all the right ways. Do note that the thumbnail has the word "won" cut off due to youtube showing the time in the bottom right!
I tend to leave code transformations to babel, which is better suited for that. And use typescript exclusively as a "linter". I tend to think of my code as a JS codebase that just happens to have type-checking as a static analysis step in the build process. And type annotations as being similar to JSX: non-JS extensions that get removed during the build process (with the difference that JSX is transformed into something different and type annotations are just stripped). This type of thinking translates better to other languages like python, that has optional type annotations and tools to enforce them statically. Typescript itself is also going more in this direction: they deprecated TSLint in favor of plain'ol eslint with a ts-enabled parser and some ts-scpecific rules. They are advocating for users to write a .js extension in the imports so that it produces valid JS output without transforming imports, etc.
Loving these videos Tyler. A constructive criticism: your voice sounds quite soft and muddy compared to other audio clips, which can make it quite difficult to hear you. I have to increase the volume quite a bit, but when other audio clips play they're far too loud. My guess is that it's your mic? Not sure if there's a simple way to clear up your voice. But yeah, really enjoying your content, have subscribed and am looking forward to more!
came from a C++ background, JS is a tough language for me to use because of how hard it is to maintain and keep track of. The lack of type in a language kind of throw me off in a lot of ways even though I believe that I would have loved this flexibility if I don't have any C++ background knowledge. C# kinda bridged the gap for me with dynamic and object type, but my brain is still with a very strong typed mindset, which I think it is good in preventing me from misusing object and dynamic, especially in a multithreaded environment
@@uidotdev Dynamic to type is also extremely hard. It's like that meme where the guy is riding a bike and throws a stick into the spokes. You know it's good for you but when you just want to do the thing but TS says NO.
@@agontprevarator5214 It isn't? Isn't the point of the meme to demonstrate self inflicted wounds? In this case, people (me) who gets upset with typescript slowing them down - installed typescript knowing full well it would fuck me at some point.
I migrated to TypeScript basically everywhere... It's hard not to see how many less nerves you lose when you don't have to trace one simple error for half an hour, just to realise it was a typo that could've been spoted in seconds with static typing...
hope this makes me change my mind about TS, cuz it takes long enough to create new functions quickly while debugging... and NOT BECAUSE of variable types!