Is TypeScript Really Necessary?

  Рет қаралды 14,335

Chris Hawkes

Chris Hawkes

Жыл бұрын

My tutorials - codehawke.com/
📣 Other Social:
/ realchrishawkes
/ christopher-hawkes-130...
github.com/chawk
stackoverflow.com/users/83627...

Пікірлер: 180
@wheresmyskin
@wheresmyskin Жыл бұрын
I work on big projects, maybe not that complicated, but they bring hundreds of millions of dollars in sales every month. How often do I run into type safety problems? Very rarely. We have maybe one serious bug a year related to type safety? So for type safety reasons I don't think adding TS is necessary. It's just how you write your code and if you can trust the data you receive from various APIs. We write our own API services to integrate with 3rd party tools, so I know 100% what will I get from our API. It's gonna be either object or null, string or empty string, array of items or an empty array. What else is there? Anywhere in code review if we see weak types or type pollution it gets corrected right away. If something slips past reviewer and gets into the code base, it's like 99% probability it's gonna get caught by static code scanner in build pipeline and the merge will be rejected. Hence like one type bug a year. Usually very minor one, because all critical systems are constantly monitored, tested with automated tests, integration tests and manual tests. TS's type safety features are only type safety features like any other. Safety features won't work unless developers are aware what they should and shouldn't do. Even the state of the art alarm system in your house won't work if just keep leaving the back door open and ignore all the alerts.
@nivo6379
@nivo6379 Жыл бұрын
TypeScript prevents so many bugs, it has nice IDE integration and many other things.
@FinaISpartan
@FinaISpartan Жыл бұрын
I use TypeScript with extremely strict eslint rules enabled, and it's still not enough. Dumb bugs still make it into prod that would have been caught at compile time had I used Rust (which I now exclusively use for my backend). Yes TypeScript is necessary. Reading an untyped legacy codebase for the first time made that painfully clear to me.
@pancakesupreme5071
@pancakesupreme5071 Жыл бұрын
See you on r/programmingcirclejerk lmao
@erickmoya1401
@erickmoya1401 Жыл бұрын
Typescript is not enough, but is a HUGE jump from finding "Not found property x of undefined". I worked in big projects in Javascript. It was easy and fast, we hit production in 3 months and sales made stakeholders happy. Until we had to refactor for new features, and things started to break almost every day on almost every production release. I have never again coded in Javascript without TS in strict
@bartoszkrawczyk4976
@bartoszkrawczyk4976 Жыл бұрын
@@erickmoya1401 Exactly. I think that people who argue that TS is not needed write only small personal projects that are never refactored. TS is preventing huge amount of small stupid mistakes
@quelchx
@quelchx Жыл бұрын
I converted my companies backend and front-end to Typescript a while back, and now I can't program anything without Typescript and I forced my team to learn it. It has helped with a lot of things in a lot of areas.
@attevirtanen271
@attevirtanen271 Жыл бұрын
@@erickmoya1401 exactly
@samuelgunter
@samuelgunter Жыл бұрын
TypeScript is like driving with a seatbelt. When it was first introduced, people used to the old way of things thought it was uncomfortable, but it's still extremely useful and most people can't imagine doing something as dangerous as not using it
@etherweb6796
@etherweb6796 Жыл бұрын
IMO, not worth it. Modern JS, testing, and a library like superstruct used correctly is far superior. Typescript adds a ton of boilerplate that is not necessary to make a good app. It basically removes all the flexibility JS has and in return you get something like Java or C#. The one thing that is nice is being able to specify types online instead of using jsdoc (but I hardly think this justifies all the rest of TS) Disclaimer: I've been programming JS for over 15 years, so might be a little biased - I've done a decent bit of debugging and only maybe 10 bugs I've dealt with in that time were type related.
@simponic
@simponic Жыл бұрын
I agree that for projects with maybe a handful of engineers working really close together, JS + good unit tests is fine. In a larger project with multiple teams though, TypeScript brings so much to the table - and maintaining TS is so, so much easier! JS doesn't really have much coercion from stopping engineers from applying a shit ton of hacky "quick fixes". Of course there is a time for hacky code when there is a need to get something done fast. Especially if it's in a small team setting where you can just ping everyone who has context of the system about the change being made. But, when entire components of a system are managed by one team, not having to cross reference every single place an object is used to know what the heck is being done to it is a huge win overall in development efficiency. All in all, both have their places, but I'd call it a stretch to place having to learn a patched-up version of JS using a library to do something TS has been built with from the ground up with that exact purpose in mind, "far superior". I'd firstly reach to TS before JS on a project I know will be handed off to another team or individual.
@etherweb6796
@etherweb6796 Жыл бұрын
@@simponic TS is easy to abuse. Record can remove just about all of the type safety in TS, and it works even in the strictest setting. TS is also just a library, it isn't an actual language. Everything is still JS underneath, and if you are building something that you can't build in modern JS, then it probably shouldn't be built in TS either. But if you like typing out interfaces just to use generic objects one time, then more power to you.
@hexsprite
@hexsprite Жыл бұрын
It’s essential for larger codebases
@ldon7319
@ldon7319 Ай бұрын
its absolutely not.....its essential for C# programmers who don't want to learn JS.
@whiterockjoe
@whiterockjoe Жыл бұрын
As a beginner, I like Typescript since it makes me think more about the architecture and function of the code. A big mistake as a learner is to jump to quickly into coding without enough planning and design. And too often, I would not think enough about my functions, and I would code myself into a corner. So, it’s to not to bad for me to have to slow down and lay the types before actually coding my functionality.
@DevRSC
@DevRSC Жыл бұрын
This is exactly what happened to me. As a beginner, I tend to create personal projects without planning, and frequently I forget to plan before coding, but TypeScript taught me to be strict with my syntax. It saved me a lot of time fixing errors.
@MrGinz4uuu
@MrGinz4uuu Жыл бұрын
@@DevRSC do we need to learn full JS before going into TS
@hamm8934
@hamm8934 Жыл бұрын
Personally I really just like the self documenting aspect of it and knowing what my subscribers and consumers use and produce
@dawsonpate7385
@dawsonpate7385 Жыл бұрын
I've built apps with hundreds of thousands of line of code and I refuse to use typescript. I'm not saying it's bad, if it works for u then use it. But i would rather not waste my time fighting with the compiler to do something I know works while it's yelling at me that I'm doing something wrong. If ur regularly testing the code then it really just becomes redundant to have the extras to add types to js for safety. I feel like if u need a dynamic language to be written like c# or java, in that case then just use c# or java and stop forcing a round peg in a square hole.
@alexbecar977
@alexbecar977 Жыл бұрын
I'm a junior and always preferred strongly typed languages, most of my peers who do front-end don't like typescript but I would always prefer compile time to runtime errors, maybe they don't like angular and link ts to it since most non angular teams in my country don't use ts
@johnsmith-ro2tw
@johnsmith-ro2tw Жыл бұрын
The fact that a programmer with a bit of experience doesn't like TS blows my mind. It should be a red flag regarding the guy's skills. For a beginner I can understand, because it means a whole lot more stuff to master. But for an experienced programmer, I cannot understand.
@funkydankspliff
@funkydankspliff Жыл бұрын
@@johnsmith-ro2tw I’ve done plenty of projects over the years with and without TS, I can attest that it will catch potential errors but my personal preference and why I always loved JS over Java/C# or any typed language is because of its untyped nature it feels more free and anarchistic
@Microphunktv-jb3kj
@Microphunktv-jb3kj Жыл бұрын
noone likes angular...
@ingmarfalk3306
@ingmarfalk3306 Жыл бұрын
I really cant understand how anyone is able to work with dynamic languages. I need my type system 😅
@shirleycrew1056
@shirleycrew1056 Жыл бұрын
Typescript makes it easier to mirror c#, like you said. It makes more sense to me as a mid level developer to compliment JavaScript and angular makes it more seamless to work with.
@2penry2
@2penry2 Жыл бұрын
I was very sceptical at first. But I don't think I can go back to regular js for anything other than really simple stuff. Purely from the DX it is so nice to have first class IDE support for interfaces rather than having to dig into the implementations to figure out what something should be doing. Inference is pretty powerful too. Strict null checks are pretty nice too.
@darkfoxwillie
@darkfoxwillie Жыл бұрын
completly necessary, I'm working in a complex app as a newcomer and it is a pain to work on without typing.
@trappedcat3615
@trappedcat3615 Жыл бұрын
Not that it is anywhere near as good as TypeScript, but do you use jsdocs?
@darkfoxwillie
@darkfoxwillie Жыл бұрын
@@trappedcat3615 it isn't in the project :(
@andreachello8331
@andreachello8331 Жыл бұрын
I struggled a lot with JavaScript in the past just because I didn’t understand what function or property I was calling or needed to call in order to achieve the functionality I needed. With typescript this all changed, it basically filters and tells you exactly what you need to call in order to get that functionality working, so besides the type safety, my main reason for using typescript is to have a more cohesive experience when it comes to programming
@codybishop7526
@codybishop7526 Жыл бұрын
It would be nice if you could go over how modern web development is less web development, and more application development for the web. We all start learning how to build websites and then somewhere along the line we’re expected to turn into software engineers instead of website developers. I truly believe that there should be a delineating line between web development and web application development. Otherwise, it becomes too complex and confusing for beginners, or for people who just want to build websites.
@realchrishawkes
@realchrishawkes Жыл бұрын
I can, while I do agree that there is a difference, it's just endless learning for all involved. Basically this video. kzbin.info/www/bejne/qWWbiqpqr5KqetE
@kamaboko1
@kamaboko1 Жыл бұрын
Wow, the perfect video at the perfect time. I just started learning Typscript today. My first thoughts were, "Really? I'm going to forget that 'Frank' is a string?" I've been using JS for React for a while now and friends have said, "Oh man, you have to learn TS. You have to!" Perhaps on huge projects with a lot of devs working in the code I can see its value, but for smaller projects that I work on I just don't see any value in the added code. I've just not ran into the kinds of problems people are having using JS in which TS catches.
@devincheca9605
@devincheca9605 Жыл бұрын
Strict null checks are awesome. Yes they are more work. Yes they prevent a lot of bugs.
@2penry2
@2penry2 Жыл бұрын
Hell yeah, they force you to actually cover the null cases rather than just the happy path!
@mostafaelbarrak6468
@mostafaelbarrak6468 Жыл бұрын
For frontend apps, typescript inarguably brings some advantages : - better integration between the different components and layers of the app - code misconception prevention - self documentation, - autocompletion etc... It is a very powerful tool, that you should consider using, for frontend apps instead of pure js. On the other hand, for backend projets, with node js, and any other type of project where security issues matter, it is almost necessary to use a somehow strictly typed language such as typescript... Because, Without strict typing, you may inadvertantly write insecure code... Especially code that allows malicious data injection... Typescript becomes then almost a necessity.
@georgekontus6730
@georgekontus6730 Жыл бұрын
Just picked up TS a few days ago. I also came from JS and finding TS hard to learn. I’m looking for the next project to practice TS on. FYI JQuery is still widely used on websites in 2022, look at all the Wordpress sites out there.
@viniciusalvess
@viniciusalvess Жыл бұрын
If I'm starting a backend project that needs to be statically typed, I would rather use C# or Java instead of Typescript. But converting a nodejs existing project to Typescript is definitely an improvement but it will bring a lot of headaches with it. The beauty of Javascript is that it is dynamically typed and very flexible to code with.
@magikarp1075
@magikarp1075 Жыл бұрын
JavaScript lack of type safety and type clarity made it unsuitable for large applications.
@WinstonCodesOn
@WinstonCodesOn Жыл бұрын
TypeScript gives you a safeguard against regressions caused by programmer error for when your program gets very large. As a Ruby developer, one of the biggest problems I run into is making a small change somewhere and that affects the variables being passed into a method somewhere else in the program. Good test coverage helps catch that in Ruby, but it would be nice if there was a way to automatically preempt those types (no pun intended) of errors. TypeScript makes complex JS programs much more manageable.
@Euquila
@Euquila Жыл бұрын
The thing that bites me is when the server sends back data with the wrong shape (like sending back "true" instead of true). Typescript doesn't help you in this case. You need to add a schema/validator to your frontend code but this is time consuming. I always start my projects with TS, and write all my files as `.ts` or `.tsx` but I pretty much opt out of all the enforcement of TS. I will add an ***interface*** when I want to document a more complex object (like a user's document/record, a context object, or options object). I try to avoid `any` but have a rule that "if I can't figure it out in 2 minutes, put any" I use `as` a lot to help typescript understand the data being passed in
@dealloc
@dealloc Жыл бұрын
Use tRPC or generate types from your API, provided that it follows standard practices (REST OpenAPI/Swagger or GraphQL). tRPC is better because it will _always_ be in sync since the Router type is directly imported from the server-side. Generation still require a manual process, even if you generate when pulling changes (i.e. a git hook). Rely more on inference rather than manually typing your API as it's error-prone. For the most part there's no need to type return values or interfaces other than for input arguments. Make TypeScript help you, not you helping TypeScript. Use type annotations instead of type assertions. Type assertions overrides the compatibility rules and you are more likely to introduce bugs since you're effectively telling the compiler "I know what I'm doing", similar to using `any`. Although it can catch _some_ type incompatibilities for statically defined types, but it doesn't catch conditional types. Sometimes there's no way around it, if the API you're using isn't TypeScript-oriented, but for the most part you should not rely on type assertions.
@dpaulflavius
@dpaulflavius Жыл бұрын
Yes, it is, for creating a correct app and for easier implementation, it's amazing. That's why, if you were to attend to JS Conf in Budapest this year, you would have find out that they already started the project for implementing the TS in JS, so that they will be combined under the classic JS, but working like TS. This process might take 10-15-20 years, but you assist on the project launch so start learning TS :)
@purpinkn
@purpinkn Жыл бұрын
The thing I love about typescript is having to click through a variable 7 levels deep to figure out what it references. That's efficiency.
@extendedrealities27
@extendedrealities27 10 ай бұрын
imaging eating or shitting... constantly validating if your every single step type is properly defined, it removes from you a common sense and literally intuition, it makes you conforming dumb....
@boo5274
@boo5274 Жыл бұрын
As a freelance front end dev, I hated that I had to learn typescript, but I think once you understand everything about it, it's less of a headache. I'd still prefer to use JS because personally my code is never too convoluted and usually makes sense and is pretty hard to mess something up because of type errors. But alas, most teams I've come across use typescript :(.
@alberto.cartaxo
@alberto.cartaxo Жыл бұрын
I'm self-taught and although I have a law position at work, I do some programming. I came from python and worked on my first project recently using refine.dev. after doing a 8hr course on typescript I had a blast using it. At first I didnt like it but it started grow on me. I made debugging SO MUCH easier and richer. It kind feels it's like flying by wire, where the computer won't let you make stupid mistakes. Some stuff still needs to be addressed though, IMHO, such as mouse events.
@Rust_Rust_Rust
@Rust_Rust_Rust Жыл бұрын
Stick to law
@jacobtb1
@jacobtb1 Жыл бұрын
we've been invaded by java devs. fuck my life. I hate it
@extendedrealities27
@extendedrealities27 10 ай бұрын
Indeed, the making of websites was a fun until all the jobless less talented C/Java programmers started looking for a new job... they came here and fucked up everything with theirs OOP thinking, types, interfaces, components and impossible level of complexity to do the same simple thing...
@erickheredia8910
@erickheredia8910 Жыл бұрын
I cannot return to plain Javascript, hehe. I simply can't.
@johnstone7092
@johnstone7092 Жыл бұрын
Im a new dev using ts now and Im wondering why tho? Am I jsut working on too simple projects or what? Can you tell me a case when you were like "Thank god this is in typescript!" ?
@titiloxx
@titiloxx Жыл бұрын
Summary: Chris talks about whether or not learning Typescript is worth it. He admits that when he first started learning it, he didn't think it was necessary. However, he has since changed his mind and now believes that it is a valuable tool, especially for larger projects. He recommends that beginners learn Typescript, as it will make debugging and other aspects of development much easier.
@rayhanmahmud6579
@rayhanmahmud6579 Жыл бұрын
thanks mate. you are the hero.
@jon1867
@jon1867 Жыл бұрын
Absolutely 100% recommended for writing any codebase bigger than 1000 lines of code which is pretty much every project you'll work on.
@quintencabo
@quintencabo Жыл бұрын
Yeah its really essential for large code bases. Before I switched to ts soooo much time was wasted on xxx is undefined or is null error s sooo much time.. Battling the compiler is great because you know it works and probably will keep working. Also how it forces you to make a parser function with unknown is a good thing.
@slamislife74
@slamislife74 Жыл бұрын
I just love it when I'm writing JS (I don't do that very often) and it says something very enlightening like "undefined is undefined"
@victorhugosoaresdesouza9876
@victorhugosoaresdesouza9876 Жыл бұрын
was refactoring a crud api application and wasted like a day to find out how to type Error handlers
@engageintellect
@engageintellect Жыл бұрын
I work in R&D. Mostly automation and creating POC’s. Our code bases are relatively small, so I prefer JS. Though I have been using typescript with Sveltekit projects. It’s alright… it just feels extra.
@dovh49
@dovh49 Жыл бұрын
Sometimes JS Docs is all you need! Even when you are doing just vanilla JS JS Docs can be helpful.
@quelchx
@quelchx Жыл бұрын
It you know JS you can write TS. I dislike hearing people say they're learning another language when they're not because it's not another language -- it's only extra syntax basically added to JS.
@everythingisfine9988
@everythingisfine9988 Жыл бұрын
Ever sense I found a type script command that auto generates a TS file for exported JS functions, I no longer see a need to actually "write" typescript.
@sqwert654
@sqwert654 Жыл бұрын
I mostly do game development and learning webdev. I just dont like dynamic types, its just a recipe for errors imo. Its the Reason I'm learning Angular.
@paulholsters7932
@paulholsters7932 Жыл бұрын
If a project is complex you definitely need typescript. Otherwise you don’t. Unless you use Angular then you have to kinda. It’s shitty to use in the beginning. Which is why I would suggest learning JavaScript first and then typescript. Never use typescript when still in a prototype phase though.
@hamzakhiar3636
@hamzakhiar3636 Жыл бұрын
For me was the learning curve tbh it's a bit steeper there's a lot to learn on compilation options and stuff that's happening in the code, I followed their docs and lemme tell ya I had a good time with it loved how Microsoft is taking initiative on teaching and stuff but idk seems like didn't made my mind up yet on learning typescript or I'm taking a wrong approach
@astroid-ws4py
@astroid-ws4py Жыл бұрын
Type safety is great, For example now I like to program in Crystal more than Ruby (both for Crystal's static typing and its speed), I really like the ability to specify what type each variable is, That's crazy to build software projects without it, Maybe for scripting and "calculator languages" (Julia, Python, Octave) it is fine but not for general application development.
@markogartnar5658
@markogartnar5658 Жыл бұрын
If you use something like trpc you can actually develop faster than with javascript, because of type inference.
@RickyGarcia_Learning
@RickyGarcia_Learning Жыл бұрын
I always love the throw away intros, "HeyEvryBudiWutAhp" 😂
@martinmendez695
@martinmendez695 8 ай бұрын
I just started to use TypeScrypt after many years hoping it was going to be another way to have strongly typed JS. Although, It took me a little bit to figure it out how to implement it with Express and Sequelize, it is worth. I am thinking that it will really pay off when developing the front-end using the same models.
@realchrishawkes
@realchrishawkes 8 ай бұрын
I agree, it’s worth it in the end
@karanbhatt9320
@karanbhatt9320 Жыл бұрын
I love typescript. I am java developer and variable A is integer and you can assign the string to and will not give error at compile time and direct at runtime (which can be production) is just too bad for me. I became Frontend developer because of TS and Angular because it's easy for Java developer
@Darkitz69
@Darkitz69 Жыл бұрын
typescript really helps code document itself. Sure you need a doc sooner or later, but no more writing jsdocs, because its pretty easy to see what a function does when you have in/output-types
@MrFlakgorilla
@MrFlakgorilla Жыл бұрын
As a learning beginner, I suppose Typescript gets interesting when the code base variables and inputs are becoming massive. I used it for tic-tac-toe, then the todo app, when I created it using imperative programming and didn'T touch react. I think the latter reached over 1500 lines simply because I wanted to scale it up so much. Now learning react with js by building a cv-generator to understand the nature of things and then add TS to see how it behaves within react
@yamogebrewold8620
@yamogebrewold8620 2 ай бұрын
A type checker is always necessary for any serious software. Be that TypeScript or any other compiler. The compiler alone is also not enough. The programmer has to craft the program in a way that enforces correctness at compile time using design patterns and software principles.
@tasheemhargrove9650
@tasheemhargrove9650 Жыл бұрын
I think strict typing becomes increasingly important the more the code base grows. It also helps with readability and intellisense in IDE’s. That’s part of the reason I’ve always preferred strictly typed languages. I like that Angular uses Typescript by default. The only thing I don’t understand about Angular is why Observables are used by default when JavaScript already offers promises. It seems like reinventing the wheel and just adding extra features to the wheel. Or a better analogy would be forcing every manufacturer to put race tires on all of their cars. Most cars don’t need the amount of grip race tires give you. What observables offer seem to be unneeded in 90% of cases.
@sludgeman
@sludgeman Жыл бұрын
If you work in large projects that requires people to understand your code, it is necessary. As a Java developer (and I think C# developer think the same) Typescript feels natural.
@AgentZeroNine1
@AgentZeroNine1 Жыл бұрын
I find Typescript to be very redundant and kinda a time waste if you're already doing testing, but it is something I'm learning on the side because of the growing demand from teams. I'd never use it on a personal project though. What is your thought on the Typescript team proposing "Types as Comments" to native JavaScript to lessen the need of Typescript?
@importprogram
@importprogram Жыл бұрын
I wouldn't say its necessary, but its useful although it has issues. The issues aren't really related to Typescript and the langauge but more over to the libraries that attempt to support it, and yeah DefinitelyTyped helps, sometimes it doesn't cut it and you spend an hour adding a module to your defenitions of a project. Another problem I see is that not everyone uses the same backend and frontend environments and that means you spend a lot of time at the beginning making schemas/types... And if your prototyping things, it can be a nightmare! My general rule is use JS to prototype (maybe ill use TSDoc in the future prototypes in JS), then use typescript for bigger and complex applications/codebases.
@blehbleh9283
@blehbleh9283 Жыл бұрын
Strong typing is very nice for large and complicated projects
@showingsoftwarebugs5963
@showingsoftwarebugs5963 Жыл бұрын
It removed a lot of the need for unit testing. At first I hated it, but once I saw it showed me I needed to make changes in other files off one change, it loved it. There are still a few things I don't like about it(for example can't do object.hasOwnProperty(key)). But overall I would rather use typescript. I generally follow a rule... if the same type or interface is defined by more than 1 file, I will put it in a types folder and import it. Otherwise I put the type and interface definitions at the bottom of the JavaScript file so I don't have to scroll through them while working on my code.
@steelwolf180
@steelwolf180 Жыл бұрын
If they are working API related stuff yes since typescript has good documentation and support for OpenAPI. Anything else it will be it depends and i priotrise on the team size as complexity as well.
@TheChodex
@TheChodex Жыл бұрын
Once I went TypeScript I never wanted to go back. It's absolutely necessary they should make TypeScript by default in browser.
@grumpylibrarian
@grumpylibrarian Жыл бұрын
I thought you were going to answer this question, not literally ask it. I haven't used TypeScript, so I couldn't say much. What I do know is what problem I would want solved that I cannot do in JavaScript. I have a runtime parameter typehinting routine that uses the instanceof operator, making heavy use of the "well-known" Symbol.hasInstance property to create "types." The advantage is that I can get MUCH more complicated types than anything that TypeScript appears capable of doing by abusing the Symbol.hasInstance method, and I can reuse those same types as standalone checks for external inputs. The first disadvantage is that this is a non-zero overhead added to each function call, but in most programs, this is negligible. In any cases where it's not, I can simply remove the hinting function, which is normally applied to the "arguments" for a function with a list of types. The second, which would be something TypeScript would help with, is that until the function is called, I can't tell that it's going to be called incorrectly. So it requires full execution, possibly across all edge and corner cases, to find those types of errors. But even that isn't usually a problem. While I will occasionally get a runtime for a bad parameter in a function call being caught by the typehinting routine, I'm far more likely to be halted for using an undeclared variable. JavaScript can't notify me of these errors at JIT compilation because of the multiple scopes and nonlinear nature of closures. It doesn't know that by the time I call a function that it won't have that variable name somewhere within its scope. For all it knows, I'm going to stuff that property into the global scope. Hoisting and strict mode probably prevent bare insertion of a variable name into any intermediate scopes, but even strict mode accepts that I might change the properties of globalThis by the time the function is called. If TypeScript solves THAT problem, then it's worth the trouble, and I'll work on integrating it into my code. The compiler would have to assume that nothing will be added to globalThis, and it would have to know in which environment I'll be running so it knows what to expect in that local globalThis. So I couldn't have a completely agnostic compiler to find this error, but the code I write largely IS agnostic and designed to work in Node, a standard browser environment, worker threads, WebExtension background and content scripts, Electron, and possibly other environments in the future such as Deno or Bun. If the only benefit I'd get is diagnosing function calls a little sooner than the runtime check could, then I'd have to weigh it against the much more specific checks I can do at runtime via the Symbol.hasInstance method. It would only be useful in low-frequency late-called functions that take a wide range of inputs, such as any string or any number, instead of being able to require valid filenames or integers between 1 and 65535, for example.
@wumbl3
@wumbl3 Жыл бұрын
Couldn't you just make a VSCODE extension to typecheck javascript?
@user-js7ud9du2y
@user-js7ud9du2y Жыл бұрын
adjusting to typescript is not as difficult than jumping to a framework..but things like nestjs is easy to adjust with and trpc makes writing api a thing of the past.. strongly typed part where most of the advantage is though you can have things such as class-validator
@ademineshat
@ademineshat Жыл бұрын
I like it as language, but I don't like the fact that we need to compile it to JavaScript. All of that battle with the compiler 😁
@jamesmussett
@jamesmussett Жыл бұрын
The only reason Typescript exists is because JavaScript was the only language available in the browser. Once the Web IDL comes to WASM allowing interoperability with browser APIs, JavaScript and Typescript will slowly die off. We’re already seeing everybody on Microsoft stacks migrating to Blazor.
@etherweb6796
@etherweb6796 Жыл бұрын
Which was precisely why Microsoft made TS to begin with.
@jaspercaelan4998
@jaspercaelan4998 Жыл бұрын
I think it's an overkill for most front end stuff but I would probably use a type safe language for most server side code but I would use a proper type safe language instead of some hacked together tool (Typescript).
@callthecapital8631
@callthecapital8631 Жыл бұрын
Love typescript, may even be using it too much as a crutch...I actually gotta dive deeper into javascript and learn that inside out but its hard to go back
@nanonkay5669
@nanonkay5669 Жыл бұрын
Yes. The answer is yes! A resounding yes! It is definitely necessary. It is almost a guarantee that you'll make a typo or access something that doesn't exist. What I don't like about Typescript though is that you have to do some type gymnastics before you write anything meaningful but the payoff is well worth it
@ratamahata3343
@ratamahata3343 Жыл бұрын
Ofc, YES!
@indrajitsarkar3169
@indrajitsarkar3169 Жыл бұрын
I'd say yes, since I started using TS, coding in JS is not an option anymore. It's frustrating at first, but it's very much worth it.
@urssaf343
@urssaf343 Жыл бұрын
No. Would I use types if they were a native js feature? Yes.
@neociber24
@neociber24 Жыл бұрын
When you need to learn about a new codebase you will be blessed if they use Typescript specially if is a big codebase
@tedchirvasiu
@tedchirvasiu Жыл бұрын
Yes
@BryanChance
@BryanChance Жыл бұрын
it just adds another layer of dependency in my opinion.
@DanTheMan-rr3yg
@DanTheMan-rr3yg Жыл бұрын
I might sound like a boomer…but maybe someone can help me change my mindset. I primarily use JavaScript for backend (NodeJS) but I think this all stems from me using TypeScript when it was new…but I felt like I was struggling with the compiler always, getting errors I didn’t know how to fix, and always tempted to use “any” just to get the error to go away. I also felt like I was writing double the amount of code. My simple method that takes two objects needs interfaces now? Now my code base is cluttered with these and my large code base is even bigger now and harder to find stuff. As for debugging, idk the VSCode debugger works pretty darn well with JavaScript. Granted this is because of the modules I use support TypeScript lol And for the argument of “less bugs”, idk really? You’re still gonna get bugs and a good linter can find these on your JS project easily. Idk like i said, I might sound resistant to what’s new/popular, but eh, I don’t see a need for it. But yes it’s important still to read it and learn it, but would I use it? I don’t think so…maybe someone can help me change my mindset.
@dehman6836
@dehman6836 Жыл бұрын
It's super necessary
@Stupendousboy
@Stupendousboy Жыл бұрын
type safety is good. whats horrible i see is younger devs tends to create more layers bcoz they are making it behave like type language
@tomasborek3069
@tomasborek3069 Жыл бұрын
not necessary, but handy.
@Matt23488
@Matt23488 Жыл бұрын
Is TypeScript necessary? I think the answer to that is "no" because there are plenty of projects out there that just use regular JavaScript. But it does have benefits and drawbacks. It seems easy at first, until you encounter something in the type system that you have no idea why it's behaving a certain way. You find more and more of those instances, and you research them and find out why. And it's usually because you didn't understand the compiler and wrote bad code. So you rewrite it correctly and there you go. But this happens for awhile as you learn more nuance. So it can feel like you're fighting the language and compiler and it might be tempting to just go back to JS. But if you stick with it, you'll learn how to properly take advantage of the compiler, and use type inference to pull off some really clever types to provide elegant APIs. And the result is not only convenient for the developer, you can insure that parts of your code are called in very specific ways, with specific data if you so desire. If you like duck typing in JS, then you should really love TS. Because you can create types to represent any kind of duck that you want. Or a type that can represent one of a set of ducks. Or a duck and a cat. Or whatever. The point is, you are telling the compiler how your code works so that it can stop you from using it incorrectly. When used correctly, an entire category of bugs are simply impossible because the compiler will catch them.
@Kanexxable
@Kanexxable Жыл бұрын
I do find ts to be painful but most of the time I blame framework and library authors more than I blame ts. Most developers blame ts and I know it's not perfect. But framework and library authors should try to understand ts more and even the web so that types can be made in better ways
@gabrielmachado5708
@gabrielmachado5708 Жыл бұрын
I can't think without types
@extendedrealities27
@extendedrealities27 10 ай бұрын
when you speak your native language, do you use grammar to create sentences? Do you need to think to think?
@amd9918
@amd9918 Жыл бұрын
typescript is a blis. its nice to read and its so clean and you don't need to compile them to js.. ts can run by using ts-node so its so clean. ngl when I see angular js.. i hate how messy it looks like lol xD then they have ts I kinda love it like I'm in the era where angular 2 comes out long long time ago. .that's where I started to use typescript because of angular ts.
@seangreen9590
@seangreen9590 Жыл бұрын
I didn't get to the level where I really need to solve some Javascript problems so i need to move to type script for now I'll stick with Javascript
@LukeAvedon
@LukeAvedon Жыл бұрын
Yes.
@lardosian
@lardosian Жыл бұрын
Until you are fairly fluent with it it can be a battle!!!
@NickHamilton88
@NickHamilton88 Жыл бұрын
Yes it is
@clairelist1060
@clairelist1060 Жыл бұрын
For personal projects? Nope. For big projects? Maybe! It seems to just add different problems to javascript lol
@_vicary
@_vicary Жыл бұрын
It surprises me that so many devs are still thinking TypeScript is optional.
@johndebord7802
@johndebord7802 Жыл бұрын
Don't like writing typescript, but like libraries that are written in typescript
@meganadams7274
@meganadams7274 Жыл бұрын
Honestly? It's a lot of boiler plate for simple typing, and something that had already been solved without TS before. But because all the "cool" programmers say it's the best thing since sliced bread, I guess I will too.
@davidchavez1064
@davidchavez1064 Жыл бұрын
I love typescript
@gogogogogogogogogogog9
@gogogogogogogogogogog9 Жыл бұрын
no i don't think it is necessary , if you want use go or rust
@shrimpoffthebarbie
@shrimpoffthebarbie Жыл бұрын
I'm a senior dev. Been programming for forty years now. The hardest thing I did was give up oop paradigms and embrace true functional programming. I consider TS a huge leap backwards. It cannot do runtime type checking. It's a joke. I really don't want to go back to the BS of interfaces, methods (the worse crime), dependancy injection. Yuck yuck yuck. Am I too much a higher-order function snob? Also I hate Microsoft with a passion. So probably bias here.
@extendedrealities27
@extendedrealities27 10 ай бұрын
Yep, it takes time to of experience to understand stupidity of "modern" times. I literally have nothing to say... maybe this story: "A certain society believed that the reason humans could walk was because of a certain "stick" they had invented. Everyone in this society owned one of these sticks, and babies were presented with them shortly after birth. It was unthinkable and even heretical to question the importance and essential nature of these walking sticks. One day, a rebel decided to demonstrate that humans could walk without the stick. But, given that he himself had never tried walking without the support of the stick, he fell down when he attempted to walk stick-free. Thus, the society concluded once again that it was the stick that allowed humans to walk."
@Blast-Forward
@Blast-Forward Жыл бұрын
yes
@EdwardOrnelas
@EdwardOrnelas Жыл бұрын
I only started programming in March, seems like there is a new and better programming language everyday than the one you learned 💀
@deadlock107
@deadlock107 Жыл бұрын
Get used to it bro :)
@astroid-ws4py
@astroid-ws4py Жыл бұрын
What is important is that you get the general ideas and not the particular syntax, Though professional devs/computer enthusiasts should probably learn/try at least one language in different category for getting a better understanding on computers and computer languages: Low-level / direct hardware access languages category: C, C++, Rust, Zig, FreePascal. Mid-level Garbage collected languages category: Java, Go, C#, Nim, Crystal, Kotlin etc. High-level dynamic untyped scripting languages category: Ruby, JavaScript, Python. Specialized functional languages category: Haskell, OCaml, Lisp, Scheme, Clojure, Scala.
@Blast-Forward
@Blast-Forward Жыл бұрын
Typescript has been around for years.
@vicmitchell9962
@vicmitchell9962 Жыл бұрын
I'm still with Javascript
@ChaimMosheStern
@ChaimMosheStern Жыл бұрын
I don't look at it as a headache I look at it as a very good tool that provides very useful intellisense and fils a bit The Gap that I'm missing from C sharp
@brys6577
@brys6577 Жыл бұрын
Typescript is awesome but it's EXTREMELY slow. Of course, not the compiled stuff but the compiler is asinine and it's plugin support is meh.. it's really slow for web development when I have to wait for vue-tsc (plugin for typescript compiler) I don't mind it. I do like types, makes it easier to not click all the "view source" which I did often in JS.. however, I can't get over the slowness of the compiler
@remoteworkboard
@remoteworkboard Жыл бұрын
It gets in the way lol. Which isn't always a bad thing I guess but making Javascript strongly typed seems to defeat the purpose of javascript.
@xxxxxx-wq2rd
@xxxxxx-wq2rd Жыл бұрын
if a better editor can check for error for me then it is less convincing to learn something more complicated.
@oraz.
@oraz. Жыл бұрын
Typescript is dumb. Why people think it's bad to use the javascript type system directly, or they can't do it and need a preprocessor to do it I don't get. It's not like type errors are they only bug. For any kind of error it's your responsibility to understand what language feature exists rather than having something else do it for you.
@realchrishawkes
@realchrishawkes Жыл бұрын
I agree that there are still a ton of runtime bugs possible with typescript code. That said, I'm sure it catches a lot. Is it worth it? I'm not sure, sometimes crazy types give me a headache
@oraz.
@oraz. Жыл бұрын
@@realchrishawkes yeah, I dunno. I think javascript's type system is pretty well defined. Maybe people think types are a bigger deal because of typescript itself.
@titaniumwolf2
@titaniumwolf2 Жыл бұрын
What ever the lead dev wants I'll do it. As long as I get paid.
@bicatu
@bicatu Жыл бұрын
yes it is.
Why I'll always use Typescript over Javascript
18:17
Web Dev Cody
Рет қаралды 16 М.
Best Learning Strategy for Programmers
16:17
Chris Hawkes
Рет қаралды 13 М.
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 38 МЛН
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 4,1 МЛН
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 7 МЛН
I Cannot Believe TypeScript Recommends You Do This!
7:45
Web Dev Simplified
Рет қаралды 167 М.
Python vs C# - which should you choose?
16:02
Chris Hawkes
Рет қаралды 43 М.
Is Django FINALLY dying? (Let's Investigate)
2:38
PEXT
Рет қаралды 2 М.
Next Generation TypeScript | Prime Reacts
24:45
ThePrimeTime
Рет қаралды 98 М.
Are Unit Tests Really Helping?
6:53
Chris Hawkes
Рет қаралды 10 М.
Is TypeScript (NodeJS) Faster than Go?? |  A server comparison
9:54
ThePrimeagen
Рет қаралды 217 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
TypeScript Slows You Down - Here’s Why
5:44
Theo - t3․gg
Рет қаралды 38 М.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Рет қаралды 199 М.
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 38 МЛН