Тёмный

How to use TypeScript with React... But should you? 

Fireship
Подписаться 3,3 млн
Просмотров 929 тыс.
50% 1

Learn how to setup React with TypeScript. Compare the pros and cons of using TypeScript in an React project. Learn more in the full course 👉 fireship.io/co...
#js #react #typescript
🔗 Resources
Full TypeScript Video • TypeScript - The Basics
TS Docs www.typescript...
Create React App with TS create-react-a...
🤓 Install the quiz app
iOS itunes.apple.c...
Android play.google.co...
🔥 Get more with Fireship PRO
Upgrade to Fireship PRO at fireship.io/pro
Use code lORhwXd2 for 25% off your first payment.
My VS Code Theme
- Atom One Dark
- vscode-icons
- Fira Code Font

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1,2 тыс.   
@rayanabid1303
@rayanabid1303 3 года назад
the ending was by far the best one i have seen 😂
@anujjosh
@anujjosh 3 года назад
Agreed!
@nick7943
@nick7943 3 года назад
Yeah everyone know that react is best developed with
@RexGalilae
@RexGalilae 3 года назад
it convinced me that React and Typescript are
@topaz-rn
@topaz-rn 3 года назад
I wholeheartedly agree that
@patricktobias4232
@patricktobias4232 3 года назад
Mine ended with an ad, so it acted like a good segue 😂
@somedevstuff5060
@somedevstuff5060 3 года назад
Now I watched the full ad at the end cuz i thought the video was not finished. Genius move!
@ludologian
@ludologian 3 года назад
The ad was the answer I promise that I got a razor advertisment . I commented about (blazor) before in this channel 😁 so is it just youtube telling me to use blazor framework? I love c# and I'm learning js but I really hate the syntax I know js made for the web but then got many framework that you could be a full stack developer. but it still a learning curve to master all these . I prefer working on one technology stack like.net which offer everything, My issue with js and xamarin as well the syntax and heavy useage of arrow functions . I know typescript is more oop than vanilla js . it seems easier coming from oop experience and because it made by the legendary programmer that made c# .
@arongrhyzjovannid.4474
@arongrhyzjovannid.4474 3 года назад
Same, damn youtube algo
@georgepagotelis
@georgepagotelis 3 года назад
Obviously (you did)!
@informativecontent4778
@informativecontent4778 3 года назад
Lol yep
@hnccox
@hnccox 2 года назад
Should you use Typescript with React? Obviously.
@julianhecker944
@julianhecker944 3 года назад
now we need one of these great videos on TDD
@tonylion2680
@tonylion2680 3 года назад
second this... a whole series on testing by this genius would be awesome
@riddixdan5572
@riddixdan5572 3 года назад
would really like some proper series on testing
@MilanDrazic
@MilanDrazic 3 года назад
Tdd is bullshit. Waste of time
@Chow2323
@Chow2323 3 года назад
@@MilanDrazic Agree
@ZeonLP
@ZeonLP 3 года назад
@@MilanDrazic Strict TDD is indeed annoying and no one really follows the TDD approach 100%, but I guess it still gives us some nice principles to work upon.
@cerulity32k
@cerulity32k 2 года назад
Coming from a lot of C# and OOP, I started with TS and loved it way more than JS. Being able to ensure a variable type is extremely useful and more readable.
@lonelyastraunaut
@lonelyastraunaut Год назад
I am working on migration of the components into tsx and I am depressed 🥲
@cerulity32k
@cerulity32k Год назад
@@lonelyastraunaut Yeah, it doesn't seem like migration from JS into TS would be that fun, but starting out with a TS project is much more preferred with me.
@randomly_random_0
@randomly_random_0 Год назад
same
@paultapping9510
@paultapping9510 Год назад
while I don't think it's accurate to say I come from oop, it does make a lot more sense to me in most cases. I don't understand why you would ever not want strongly defined data types for your variables for eg. People vaguely claim it somehow saves time but I don't see how, and even if it does the tradeoffs don't seem worth it.
@dretheblack
@dretheblack 11 месяцев назад
yeah it makes a lot more since to write that way, kinda solve the skill issues js devs might have switching to cpp later in their career
@thedigs8563
@thedigs8563 3 года назад
That ending tho... nice one fireship
@kristopherrobin4001
@kristopherrobin4001 3 года назад
+1
@AnonymousMycologist
@AnonymousMycologist 3 года назад
The answer to "should you use TypeScript with React?" is "obviously" :) /s
@nirmalmattmusic3993
@nirmalmattmusic3993 3 года назад
OMG. He is a mentalist. Today I started learning typescript with react.
@Fireship
@Fireship 3 года назад
I identify as a precog
@dsi-films1264
@dsi-films1264 3 года назад
@@Fireship Hahaha
@anjelpatel36
@anjelpatel36 3 года назад
He really is. My guy launched the MySQL video the day I started to learn MySQL for a project.
@bryanmedina1822
@bryanmedina1822 3 года назад
Me too
@jesteriruka4215
@jesteriruka4215 3 года назад
He posted a video about WebRTC 2 days after I implemented a voice call into a fivem cellphone script.
@kylemckell
@kylemckell 3 года назад
I read a really good article by Kent C Dodds on how to write a React Component with TypeScript, and he suggests to not use the `const Component:React.FC = (props)` (as seen 4:52) syntax but rather use the `const Component = (props: Props)` syntax. Basically, the first one has a children prop even if we didn't pass one, whereas the second one doesn't. (and a few other reasons as he lists) It's a really good read, and interesting to hear his reasonings behind his opinion, I recommend it. RU-vid will flag my comment if I post a direct link, but look up "How to write a React Component in TypeScript by Kent C Dodds" and you'll find it.
@luizAugustoll
@luizAugustoll 2 года назад
I always use that and even don't known of FC existence.
@daniellindegren1182
@daniellindegren1182 2 года назад
React components should always be named functions: `function Foo() { }`
@WarmheartedKyubey
@WarmheartedKyubey 2 года назад
And another problem of FC way is: it's impossible to define a generic Component which is very useful sometimes.
@gajo357
@gajo357 2 года назад
@@WarmheartedKyubey It is possible, but does not look nice. const MultiSelect: (p: Props) => React.ReactElement = ({}) => {}
@dr.michaelmorbius2400
@dr.michaelmorbius2400 2 года назад
@@gajo357 jesus christ, does not look nice is an understatement.
@azzmounaim7696
@azzmounaim7696 3 года назад
No bullshit...pure content..saves you a ton of hours jumping between blogs and tutorials.I would say you have an amazing talent at condensing content and put it in simple forms.
@alicanyenidogan
@alicanyenidogan 3 года назад
I started using typescript for the first time 6 months ago when I switched my job and started as a react developer. I've been coding js long enough and wasn't happy that they were using ts instead of vanilla. Oh man I was wrong. TypeScript is great and everything i wanted JS to have. Give it a try if you haven't.
@yashpawar7881
@yashpawar7881 2 года назад
hello... i want to learn angular... i have completed html, css, bootstrap part.. now im very confused btw these two (js/ts) can i start directly ts from scratch or should i learn js before ts?.. i know java very well.. and Ts is like java but Js is totally different..
@upcomingweeb136
@upcomingweeb136 2 года назад
@@yashpawar7881 learn js before you learn TS TS is a subset of js you are still coding js but you have types definition
@keshavtomar3541
@keshavtomar3541 Год назад
@@upcomingweeb136 Superset*
@lionbrunch4244
@lionbrunch4244 3 года назад
A few hours ago I started a university project that requires React with Typescript. This video follows shortly after. I don't know how you choose your timing but it's awesome!
@mohammedaliagha7520
@mohammedaliagha7520 3 года назад
Loved the ending 💙
@PeteHannon
@PeteHannon 3 года назад
should've said "it depnds" :D
@dawn-of-newday
@dawn-of-newday 3 года назад
Lol
@EternalQuasar
@EternalQuasar 2 года назад
The ending is shittest possible, i was waiting for an answer
@adityakolte1148
@adityakolte1148 3 года назад
Hmmm... What type should i use? Few weeks later *Spams any*
@siapaayo7318
@siapaayo7318 3 года назад
thats why u should make a interfaces first
@rafaelpernil
@rafaelpernil 3 года назад
Also, unknown type is pretty handy
@sameeranadgaonkar9756
@sameeranadgaonkar9756 3 года назад
I hate to admit, but it's kind of necessary sometimes (if you want to save time right now..)
@re.liable
@re.liable 3 года назад
Oh no I'm so guilty of this.
@sfarc2359
@sfarc2359 3 года назад
Hover over bad code > quick fix It saved me hours on all my projects
@zackysh_
@zackysh_ 3 года назад
I must say that TS has saved me many hours of debugging, I feel that starting a project is slower but once started everything is more fluid
@carlosraul6578
@carlosraul6578 2 года назад
Los sigues recomendando después de dos meses ?
@Reaper_f30
@Reaper_f30 Год назад
Yea this is the bug plus for it
@oleksandrleskiv
@oleksandrleskiv 3 года назад
I use Typescript on backend and it autogenerates OpenApi documentation. And Typescript on the frontend can autogenerate http client with backend models attached for each API call. And that's wonderful
@PieterWigboldus
@PieterWigboldus 8 месяцев назад
I build the openapi, and generates toe definitions from that. Both are possible, just what works the best for you. But our definition is to design the api first, language and framework agnostic, just plain openapi.
@youngandfree93
@youngandfree93 2 года назад
I began using TypeScript with React for the last few projects I been working on. At first a lot of frustration trying to get around all the type cryptic errors that kept popping up and adding to frustration and development time to the most simple tasks. Now with practice and expierence TypeScript has actually grown on me and all the code hinting I get from it is so nice to have. The cons are yes you have to write a ton more code especially as you create Interfaces for each component's props but as your app scales you will be happy you did. TypeScript definitely a must have for me now.
@Aphova
@Aphova 3 года назад
I don't get too attached to tools (languages, frameworks, whatever) anymore but damn if TypeScript doesn't make me feel all warm and fuzzy inside. The only vanilla JS I write now is throwaway/scratchpad type stuff.
@nosknut
@nosknut 3 года назад
Bruh that "god damn precog" line got me so hard I'm still dying 😂
@jetardeshna3449
@jetardeshna3449 3 года назад
I HAD to listen to it twice. So good xD.
@sanojck815
@sanojck815 3 года назад
"precog" means the AI assisted errors popping up in VSCode?
@codinginflow
@codinginflow 2 года назад
This convinced me to convert my React app to TS
@codinginflow
@codinginflow 2 года назад
Just came back here to be convinced again lol
@codinginflow
@codinginflow 2 года назад
Just finished converting my whole app to TypeScript lol. It wasn't super easy but now I'm happy about it 😊 I love strict type checking
@VeraVeraniego
@VeraVeraniego 2 года назад
Love the fact that you made us think by ourselves if we should use React along with TypeScript, I wasn't expecting that. That's an enhance for your viewers critical thinking.
@tomasgoncalves2104
@tomasgoncalves2104 3 года назад
Great video as always, would love to see you talk about test driven development more in depth
@SCREENLURKER
@SCREENLURKER 3 года назад
Yes. Code overhead is a fact of life, writing more code is a reasonable trade-off for rock solid reliability through the development process. TS all the way!
@akshy471
@akshy471 2 года назад
I love all the errors in my IDE. Did I just say that. Damn.
@SCREENLURKER
@SCREENLURKER 2 года назад
@@akshy471 better in your IDE than in production!
@cerulity32k
@cerulity32k 2 года назад
@@akshy471 Makes my personal projects so much easier and faster to develop!
@allan710
@allan710 2 года назад
And with tabnine and copilot, that's not even too big of a problem.
@xXx-un3ie
@xXx-un3ie 2 года назад
Ok here is my pov: I would use TS because it gives me what I have in other typed languages but I have allready adjusted to JS so changing to TS sounds like trying out something new to do the same stuff for some virtual tradeoff I don't know if I need it really if things work good now.
@mechaahcem1657
@mechaahcem1657 3 года назад
It is much easier to learn TypeScript for a C# dev rather than JavaScript. Thanks for the video, man!
@Sjlundie
@Sjlundie 3 года назад
referencing Bukowski. My all time favorite writer aswell. Damn Fireship, you crazy.
@Waxaranai
@Waxaranai 3 года назад
First time using typescript is like hell, but im moving along with it. Im in love with typescript now after 1 year using it
@BenjaminMillam
@BenjaminMillam 3 года назад
Thanks! This was the perfect quick overview without having to dive into a 3-hour start-from-scratch tutorial.
@balajiravi9259
@balajiravi9259 3 года назад
First use js with react after more comfortable with it. Then move onto typescript 🙏🙏👍
@verified_tinker1818
@verified_tinker1818 3 года назад
When you come from a strictly-typed background, watching JS developers argue that types "add too much boilerplate code" and "aren't worth it" makes you question where they learned coding in the first place. To say it politely.
@jaimemetcher388
@jaimemetcher388 3 года назад
Expressing what you actually mean and defining the invariants and constraints your code is going to live and die by = boilerplate. Sprayed my coffee out my nose at that one.
@HandledToaster2
@HandledToaster2 2 года назад
This is why people need to learn programming with something like Java or C# first. They'll miss the types once they inevitably have to code in JS.
@gravy1770
@gravy1770 2 года назад
@@HandledToaster2 nope, I started with C , C++ and Java and I don't miss types at all. JS just requires that you be more attentive to inputs and outputs, and that's always a good thing
@HandledToaster2
@HandledToaster2 2 года назад
@@gravy1770 I stand corrected.
@HandledToaster2
@HandledToaster2 2 года назад
@@lottexy yeah i know the feeling, it just feels wrong, like you're making grammar errors or something lol. Python is even worse cause you don't even "let/const," you just straight up "foo = 1"
@ArnoldsKtm
@ArnoldsKtm 3 года назад
TypeScript with everything. It baffles me how lost I feel when I touch vanilla JS.
@vintagerealityvr
@vintagerealityvr 3 года назад
Bummer. Typescript is just strongly typed vanilla JS. The benefits are not arguable, but if you write good JS, it's only a nicety
@KebunH
@KebunH 3 года назад
@@vintagerealityvr do you use a notepad as ide? The difference between ts and js is night and day
@matejpesl1
@matejpesl1 3 года назад
I on the other side enjoy js when I have the opportunity to touch it. It's nice not to have to specify a million interfaces and props. Sure, it's not great when you're doing something that MUST work, but I like it for my side projects - I'm faster with it.
@vintagerealityvr
@vintagerealityvr 3 года назад
@@KebunH you didn't counter my point. Like I said, strongly typed JavaScript has inarguable benefits. The main benefit of strongly typed languages are error catching on compile (and with modern ides, error catching on typing). I don't know how long you've been coding JavaScript but you can write clean Javascript without being strongly typed.
@KebunH
@KebunH 3 года назад
@@vintagerealityvr the benefits go far beyond that, for example having to type only a few letters and hit enter for every term, or getting an accurate list of autocomplete options when you hit a dot, instead of having to remember your codebase by head, because of the ide being much more intelligent and context aware when there is a type system, making it also much faster to code like that. This is even more so when writing in languages like swift, where even arguments get template prefills, but TS at least somewhat comes close to that development speed. Of course you can write perfectly fine code without any compiler help like when you write vanilla JS, my point is just that its much slower and requires much more typing because you always have to type everything in full instead of just 2 or 3 letters and hitting enter, and its much less self documenting, quickly making it more tedious to work with when the codebase grows bigger
@nukemonk
@nukemonk 3 года назад
TypeScript is a blessing, even with React.
@kadirdamene7587
@kadirdamene7587 3 года назад
You MS-OOP-ANTI-HASKELISH-FP-STYLE fan boys never split the difference when TS goes bargain sale
@devsauce
@devsauce 3 года назад
For people who think this video is open ended, its not. Read it yourself: "...The answer to should you use typescript with react is - obviously" 😄
@RakeshKumar-zj4hu
@RakeshKumar-zj4hu 3 года назад
Is obviously JS. 😂😂. Anyways you fall into trap.
@ThiagoVieira91
@ThiagoVieira91 3 года назад
Starting the week in full throttle with React + TS. 🚀🚀🚀
@dedovagency
@dedovagency 3 года назад
good luck!
@siapaayo7318
@siapaayo7318 3 года назад
I think u should learn angular instead
@spythere
@spythere 3 года назад
@@siapaayo7318 Oh god, please no
@Stroos
@Stroos Год назад
Sorry, but I'm too lazy to use typescript
@DEVDerr
@DEVDerr 3 года назад
This is exactly what I wrote on almost all typescript-related video comments on RU-vid and StackOverflow comments for about 2-3 years. I'm still really shocked about the lack of knowledge about the TS in our JS ecosystem (some people still think that it's completely different programming language to this day lol) and I'm trying to spread more practical knowledge about TS to exactly describe how important and almost "you-can't-live-without-it" thing it is for: your mental health, your productivity, developer experience, your business, and not being a masochist that need to keep track of things that normally IDE, Terminal or other tools are supposed to do it for you. Some of the myths I would also want to bust here - You do not have to explicitly type goddamn everything in your code or forcing yourself to use any or unknown type. The most popular frameworks and libraries have really well written types, where type-inference work really beautifully (f.e useState hook shown in the video), so you can almost write normal JS code and still have the TS benefits. Best practical approach to TS: Do explicitly type things only when TS cannot get the type by itself, or if you want to have more nuanced and more detailed information about your values. - Yes, writing interfaces/types for your objects may seem like an extra work to do, but to be honest... how exactly "extra" work it is? Half of the minute? 1 minute max to write all the properties and their types? Look at the benefits that interfaces give you (autocompletion in IDE, auto error-catching by marking EXACT LINE WHERE THE BUG EXISTS with red line, autdocumentation etc.) and you will not ever use this argument again - Yes, TS is the best tool for creating documentation because.. it create the docs as you go. TS contains the best tooling in the entire JS ecosystem (yes, looking at you VSCode and WebStorm) and allows you to describe your application with the ways that you couldn't normally do with plain JS. And when you have your application fully typed - it's just a joy and pleasure to continue to work with this project because your IDE/terminal shows you exactly what the values you can use (where in JS you would had to console.log it manually and check the value there which takes time - so yes - TS is the ulimate life and time saver) - Yes, TS subtly forces you to write better code, but it doesn't do this by purpose. The only thing that TS really does is just showing you the faster feedback about the execution of your program than you would normally do by running your program manually. All of the problems that can occur by using bad practices and are hidden because JS tolerates them - it doesn't mean that there aren't there. They obviously are, but TS alarms you immediately about them (and what other things can be problematic in future). - Yes, TS subtly changes your workflow entirely when writing your code. But it's a good change, because it makes you think about the design and architecture of your application first and then with those written interfaces/types just w̶r̶i̶t̶e̶ click your app by just simply hitting auto-imports and auto-completions without even looking into other files instead of "happy code" it with forcing yourself to manually checking definitions in other files - No, TS is not bad for a small projects. Even in those little ones. Remember that every time, when you are not using TS - you're shooting yourself in the foot by disabling the autocompletion and static code analysis features that are crucial for most basic Developer Experience and coding enjoyment. So I do even recommend adding TS for smaller projects too with some really basic and simple tooling to compile it like tsc, because those DX-friendly features are really the beautiful things that you can't almost live without them Thank you Brad again for spreading the knowledge in the highest-quality way 🥰 I hope that some day we all will create the beautiful Developer Experience within whole JS ecosystem. P.S - Can we expect some video about the ultimate auto-import destroyer pathology - export default? It is another unconsciously used thing by almost everyone in whole JS ecosystem that brings a lot of problems to the projects with auto-importing (yes, with TS and named exports I didn't write any single import manually for about the year or so) but for some reason still everyone uses it. Thanks again for all!
@kerimgueney
@kerimgueney 3 года назад
All this inane drivel for a language promoted for its type safety and yet it's not even type safe: const foo: {val: string} = {val: "foo"}; const bar: {val: string | number } = foo; bar.val = 3; foo.val.toLowerCase() What a joke, lmao
@DEVDerr
@DEVDerr 3 года назад
​@@pizdaxyu But we're not only talking about JavaScript specifics. In the situation where you have a project containing 500+ modules with written internal individual logic which lacks documentation (pretty common thing in a lot of companies). - then JavaScript Specification doesn't do shit for you. Then TS comes with all it's glory with the type and proper usage information that allows you to pretty simply and easly manage those modules. "writing all this garbage" "Amateur mistakes" Why so toxic man? Why do you think that I make amateur mistakes (besides the thing that everybody does them but anyway)? xD
@DEVDerr
@DEVDerr 3 года назад
@@kerimgueney I see nothing wrong in TS here in this example. By design, you expect bar to have a shape of the object with a property that can contain a number or string. So by design you have access to the string and number methods then. TS does not check what exact values will be there (unless you explicitly defines them), because it doesn't execute your program. It just defines the shape/model of your values
@kerimgueney
@kerimgueney 3 года назад
​@@DEVDerr This is a variance issue and it can in fact be detected during compile time. TS just isn't strict about it, IIRC because it's bivariant. This in turn makes its type system unsound. There's a big github issue #10717 on this and several discussions on /r/typescript. Flow, OTOH, catches this quite well. What's wrong about it is that the type system doesn't catch this obvious type error. I don't even want to know how many projects there are having these so-called "runtime bombs" silently sitting in them. People relying on the type checker are living with a wrong sense of security, which makes me wonder: Why bother? I can't even remember the last time I had a typing issue. External data being wrong is the biggest issue in JS and TS doesn't do anything for that since it's an inherently runtime issue. I truly believe that TS is just something Microsoft slapped together to make web development more palatable to C# developers.
@IAmNumber4000
@IAmNumber4000 2 года назад
1:49 I love your video clip choices 😂
@fredxable
@fredxable 3 года назад
This is legit spookier than AI tbh. I think of a topic and this Fireship makes a video about it. 😂
@siapaayo7318
@siapaayo7318 3 года назад
Typescript is the reason why i love angular more than React or Vue. IDK why some people says they hate angular because of typescript. I found my best fullstack after learning Typescript + Angular : Angular + NestJS as Backend + Prisma as ORM
@jon1867
@jon1867 2 года назад
React works great with typescript though. Also Prisma is FANTASTIC, nest is nice but I don't like how super OOP the coding style is.
@krishgarg2806
@krishgarg2806 2 года назад
tbh I don't like angular because it feels way too complicated. For example, a simple component in angular will take a class and a separate HTML and CSS file (I know you can add the template in the ts file too but I don't think anyone does it) but a single component in React is so small that I can type it here. const Component = () => Hello
@Jbeat17
@Jbeat17 2 года назад
@@krishgarg2806 in enterprise level application you need a specific structure which everyone follows, that why angular is used instead of react. But now a days, the companies themselves define their structure and use react
@sebdoucet_fr
@sebdoucet_fr 3 года назад
I thing "type" is a better use than "interface" for defining custom type that apply to model, semantically, interfaces are used to abstract implementations from "type" and "class". And you can even write more advanced types with it
@danielegvi
@danielegvi 3 года назад
It just happens that anything that isn't a primitive in JS is an object, so there isn't much difference between a regular old object and a "class instance", they're all really just a set of keys and values. That's why you use the same keyword for either case. If you had two different keywords, they would do exactly the same thing.
@Arteafact
@Arteafact 3 года назад
Refactoring, that’s my number one reason for using TS, plus it’s pretty great in general to write, it has its flaws and the type system is definitely not perfect, but it’s orders of magnitude better than not having anything at all
@aloysiuskurnia7643
@aloysiuskurnia7643 3 года назад
Well my number one reason for TS is just that sweet-sweet code completion
@mikevaleriano9557
@mikevaleriano9557 3 года назад
Creating my own configuration (I firmly believe create-react-app is black magic) for my boilerplate TS/React project taught me a LOT. And it's worth it.
@iancuvlad7368
@iancuvlad7368 3 года назад
TS + React + Redux Toolkit = my favorite setup.
@RalfarTV
@RalfarTV 3 года назад
OMG YES!
@azzazkhansiddiqui
@azzazkhansiddiqui 3 года назад
Started using Typescript a couple of days ago and I'm now in love with it!
@daniellasilverman7554
@daniellasilverman7554 3 года назад
Question - you mentioned how Babel replaces the functionality of the TypeScript compiler's "target" version. However, I've seen people use both TypeScript and Babel together - something even detailed on the official typescript website. Is TypeScript + Babel even useful?
@dmz985
@dmz985 3 года назад
Babel has a lot of useful plugins that Typescript doesn't have (ex. optimize imports, most bleeding edge language features, etc.), that's why they are mostly used together.
@bolskify
@bolskify 3 года назад
​@@dmz985 "most bleeding edge language features" do you have an example? What was introduced into ES, that wasn't in TS, or even already part of it? Typescript has the ability to play by different rules. They can jump the gun on the proposals and introduce language features that don't even exist in the standard. So curious where they might have missed the boat.
@dmz985
@dmz985 3 года назад
@@bolskify Babel used to have experimental stuff way before Typescript. If I remember correctly, Babel had generator functions and async-await shortly after the proposal came out, and people wanted to use them, so they used Babel's transpiled output for Typescript's input. Nowadays this approach may be redundant for the exact reasons you mentioned. This was a thing before Typescript was so established and mature.
@brampelberg9335
@brampelberg9335 11 месяцев назад
they taught me java in my first year, then they teached us javascript, and then I discovered typescript. It helps me so much.
@scr4932
@scr4932 3 года назад
TS is one of the few creations of Microsoft that I actually appreciate a lot.
@espressothoughts
@espressothoughts 2 года назад
+ VS Code
@PatricioHondagneuRoig
@PatricioHondagneuRoig 3 года назад
I had to stand up and applaud after that ending. Like everything that I have to do, I didn't do it, but the ending was that good.
@WrittenInFilm
@WrittenInFilm 3 года назад
But what happens when something better than typescript comes along and you are left with yet another dead framework webbed into your entire codebase?
@TheDiegolopez007
@TheDiegolopez007 5 месяцев назад
You adjust and move on.
@WrittenInFilm
@WrittenInFilm 5 месяцев назад
​@@TheDiegolopez007 ive been programming 20 years, all these new school devs thinking know better are in for a hard lesson. Using 3rd party solutions to bridge gaps that native languages, breeds instability. There's a reason typescript hasnt become standardized in ECMA JS, if typescript were THE solution, it would have been added to native js yeaaars ago. Microsoft, who made TS, has already admitted they will phase out TS with a better JS typing system in native JS. JS was never intended to as a strict language, those using it as such are simply, noobs. The proper way to use typing in a language designed to be loose (and loose for a reason), would be to implement the typing in a manner that isn't infesting your code base. An example being, putting type declarations into comments, where your IDE can handle the type restrictions for you, removing the messy moving parts of a separate compiler. Requiring another compiler for your code just to convert what should be a comment, into native code, is a stupid idea, and the masses who think TS is good solution are all just following a hype trend. So good luck with "adjusting a moving on", i wont be needing to do that.
@arwahsapi
@arwahsapi 3 года назад
As a C# developer TypeScript is my confidence booster for client-side frameworks
@Jamiered18
@Jamiered18 3 года назад
I like Typescript especially, because it's types are actually more powerful and flexible than classic typed languages once you get into advanced types. Though of course, without the speed benefits of runtime types.
@codinginflow
@codinginflow 2 года назад
It's funny how JavaScript developers are blown away by this and Kotlin/Android/Java developers don't know anything else lol
@msob7y
@msob7y Год назад
this made me realize how easy dart actually made things, thanks dart & flutter team
@xfuttex
@xfuttex 3 года назад
Damn Fireship, you can't leave us hanging like that with that ending! 😂
@averagedev7768
@averagedev7768 2 года назад
I am still in process of learning JavaScript and all the 99999 frameworks. But my first language i learned was C# and the moment i saw TypeScript syntax i imediatly fell in love. I have JavaScript just bc its really really underifined in lot of ways compared to other languages. Also the code is much more readable in TS
@bdotsamir
@bdotsamir 3 года назад
you never fail with the scary timing my guy
@InfinityNeo
@InfinityNeo 2 года назад
Great thing about TypeScript is that it helps me catch errors like undefined variables and missing imports without running the code in the browser.
@PieterWigboldus
@PieterWigboldus 8 месяцев назад
Really? Does your ide not found it in js? Then you have to check your ide, and maybe add some JSDoc. And what your tests? That is where you should catch errors. That is a runtime simulation. Typescript does a static analyse in your code, it can be in ts but also on js code.
@shapelessed
@shapelessed 3 года назад
Meanwhile when I'm just learning Svelte the whole internet is shouting at me USE REACT!!!...
@KooShnoo
@KooShnoo 3 года назад
Let them shout.
@Fireship
@Fireship 3 года назад
The status quo is usually wrong
@hglbrg
@hglbrg 3 года назад
why not both? I do. They both have their uses and are not mutually exclusive. Then again I understand when you're starting out you kinda want to focus on one thing but later on, pick them both up, and then some more. People will always call you out on it, but typically these are the people that picks a hammer and then thinks they can use it on anything to fix it. :)
@shapelessed
@shapelessed 3 года назад
@@Polsson65 I dare to say Svelte is so easy more companies will adopt it over time. As working with it is so quick.
@Polsson65
@Polsson65 3 года назад
@@shapelessed I honestly wouldn’t be surprised. I’m doing all of my side projects in Svelte going forward.
@dembambodjdiack1924
@dembambodjdiack1924 2 года назад
It really just makes you code better, specialy when your redux state starts getting a more complex.
@tacowilco7515
@tacowilco7515 3 года назад
Ok, I like TS and I like JS. When you write code in JS, your brain moves away from static type paradigm. You don't rely on intellisense anymore. You write functions and clients that just require object and properties in a certain way and it just works. It was so hard to code JS after Java, but once you get a taste of it, it changes your perspective.
@viallymboma9874
@viallymboma9874 2 года назад
Yes
@Anonymous-vh9tc
@Anonymous-vh9tc 2 года назад
Except it becomes a nightmare when you take over a pure js codebase.
@arpitpatel5312
@arpitpatel5312 2 года назад
JS is amazing man, i tried my hand with JS after being a C++ developer and i was just so confused, i didnt get the language at all. but once i did, i do not want to go back to strict typing, and shitty languages that dont have the destructuring operator anymore. JS gives u way more freedom than anything else and i do not understand why people want to reduce their freedom with Typescript.
@mouniswar7
@mouniswar7 Год назад
Js is good but it takes time to become good at it.
@cobalt2334
@cobalt2334 Год назад
@@arpitpatel5312 because freedom in programming isnt always good. Every pattern limits freedom, but probably you should follow one instead of exercising your freedom.
@PieMongo
@PieMongo 2 года назад
Got a "learn Typescript - full course" video suggested to me after that ending, so I guess I got my answer
@techyleviathan2054
@techyleviathan2054 3 года назад
I swear I could see my brain from the ungodly eye-roll that I unconsciously performed upon seeing the title. The whole video boils down to "Do you want to stay Monke or write an extra line of code that can save you tons of hours of debugging and god knows what else". To some, the answer is always Monke. But typescript patches almost all the holes of Javascript and that's why we love it.
@ciphercodes7627
@ciphercodes7627 3 года назад
I was just thinking since last couple of days like should i start back with react with js or ts? This helped me a lot! 🎉
@skylark.kraken
@skylark.kraken 3 года назад
JS for when you just want to feel busy but the project is never going to be finished, TS for everything else.
@everythingisfine9988
@everythingisfine9988 3 года назад
Reverse that and your right
@kerimgueney
@kerimgueney 3 года назад
TS for when you want your team members to spend exorbitant amount of time creating arcane type definitions, whose benefits are at best marginal. Just check out Redux' type definitions that none of their devs even understand anymore. Also TS is for if you want to fix missing (or worse simply wrong type definitions) of third-party packages. Many developers just use "any" in those situations, literally defeating the whole point of type safety. Add to that the horrendously slow compilation time that even the Chrome DevTools developers cry about and regret after switching the DevTools' code to TS (there is a video from Google on that). TS is web development for Java developers. Worse even, because at least Java doesn't have header files, which type definition files basically are.
@DEVDerr
@DEVDerr 3 года назад
​@@kerimgueney The implementation of the type definitions is completely up-to-you. It depend on developer how well did he write them. There are some good examples (like React Hooks) and bad examples as well (like Redux you've mentioned). Some devs obviously are overusing fancy features of TS type definitions where there is no need - and you can't blame technology/language that gives you lots of features to do your job (otherwise you would need to also agree that JS Developers overuse bad practices because JS allows them to do so) When you have properly defined type definitions - then your code doesn't look like Java. Heck, in best cases it looks almost exactly the same like JS, because with proper types you would have pretty good type inference, so in those cases - you have JS code with TS benefits. "Add to that the horrendously slow compilation time that even the Chrome DevTools developers cry about and regret after switching the DevTools' code to TS (there is a video from Google on that)." - it completely depends on the tools and module bundlers you're using to compile it. When properly configures, it can be blazly fast ;) (look at esbuild)
@kerimgueney
@kerimgueney 3 года назад
@@DEVDerr Your first arguments are essentially, "Just do it correctly, man", which can be said about JS .... or any other language, really. "it completely depends on the tools and module bundlers you're using to compile it" I trust that the Chrome DevTools Team did in fact squeeze out as much performance as they could. The compilation is still orders of magnitude slower than the old Google Clojure compiler. Again, I recommend the recent video by Google about their switch to TS for the DevTools source. Oh and cherry on top, when they contacted Microsoft about how painfully slow the compilation is, Microsoft basically responded with, "It's intentional. Deal with it" lol
@danielegvi
@danielegvi 3 года назад
@@kerimgueney TS for when you want your team members to get instant intellisense on their editor instead of having them dig through documentation and pollute the slack channels.
@ralphv130
@ralphv130 Год назад
You are the absolute best at explaining thank you soo much!
@a-fletcher
@a-fletcher 3 года назад
You give a very good argument, recently been heavily considering what language I want to use good picked the other way, but the improved error notification is great and the auto documentation sold me
@msaurabh1
@msaurabh1 3 года назад
Hahaha, the ending!! Reminded me of Schitt's Creek Moira answering if they should extend 30 mins for daycare.... My answer "absolutely"
@pranavdabre1816
@pranavdabre1816 2 года назад
I love the comment section for the fact that it gives me more clarity about the topic than the video
@koushikchhetri8883
@koushikchhetri8883 3 года назад
You should avoid using FC mostly because of two reasons 1. If the component does not expect any children and still it is passed, TS won't throw any error. 2. It throws error while using default props.
@codesymphony
@codesymphony 2 года назад
what is an alternative
@henriquefinger935
@henriquefinger935 Год назад
@@codesymphony You don't need to use it at all. You can also explicit the type of the props to be the interface/type you created.
@CyTic5
@CyTic5 2 года назад
Fantastic video, please never stop making them. This is fast becoming my number one place for programming related learning and entertainment. :)
@Valiant600
@Valiant600 3 года назад
My experience with very large applications was not ideal. Too many custom types, a lot of unnecessary code, usually we would struggle to find the error type instead of writing code. My personal opinion is that a mixture of proper code reviews, unit testing, JSdoc can do wonders. If you have to use TS, then I believe that for props and mapping ajax calls is useful. Again completely personal opinion.
@Slashx92
@Slashx92 2 года назад
It depends on the complexity of your type definitions and how you organize them, in my opinion. For example: Props and state interfaces of a class component should be in the same file as the class component. There is no need for 2 extra files with 4 lines of code. Another problem that can arise is over-engineer your types. TS is to make javascript applications, mostly for presentation purposes. There is no need to have 4-layers of inherentance to define an API response
@OubaydaKhayata
@OubaydaKhayata 3 года назад
Anybody except me immediately tried to figure out how the JS function at the beginning of the video works? 0:09 😂 Great video BTW 💙
@alanGaMeRhorror
@alanGaMeRhorror 3 года назад
hated it at the beginning, now that I understand it I love it! and since I'm obliged to heckin use oop is much better than js
@egzonberisha9906
@egzonberisha9906 3 года назад
I had to verify twice the end of the video thinking I am having a connection problem, nice one 😂
@lastink444
@lastink444 2 года назад
"After using TypeScript i never wanted to go back" - no truer words have ever been spoken
@Dorumin
@Dorumin 3 года назад
Typescript with react is great, especially with redux. Typing redux is a joy and it makes it even better to use
@spankyspork5808
@spankyspork5808 2 года назад
I went straight to TypeScript when I learned React and holy hell I couldn't imagine using Redux in vanilla JS, it's bad enough with types (you still don't even get full type safety on everything, like actions in the reducers)
@Dorumin
@Dorumin 2 года назад
@@spankyspork5808 Are you using redux toolkit? I personally type my actions with OR types, like type CounterActions = IncrementAction | DecrementAction;, and then define my Action type from all the *Actions types
@heelercs
@heelercs 3 года назад
That ending 😂❤️
@siroccomask
@siroccomask 2 года назад
The real question is whether the image at the end is labelling typescript and javascript correctly. Seems like the top image could be ts, but I can see it either way and now I don't know anymore...!!
@aArcziMetin2
@aArcziMetin2 3 года назад
Been using it for 4 years 😎
@gerardoardila6104
@gerardoardila6104 3 года назад
Your explanations are really good short and concise, can you make a video on why to do testing with a little example of a real react project, sometimes testing doesn’t have sense to me
@avi12
@avi12 3 года назад
I recently tried to migrate one of my projects to TypeScript, but I discovered that in that particular project it just adds some boilerplate of casting operations that makes the code look more complicated than it actually is
@mariopavlov8183
@mariopavlov8183 3 года назад
if you are constantly casting typea, it might be, that you are not using typescript correctly
@INAVACL
@INAVACL 2 года назад
like learning anything new, it's a curve, but it's always for the best! :D
@ninjaasmoke
@ninjaasmoke 3 года назад
This speaks to me I just didn't understand why anyone would use ts over js, but now I can't use js anywhere because I love ts! Obviously,
@geralt36
@geralt36 3 года назад
Obviously... a YES! Honestly I can't imagine web dev without TypeScript. Javascript just provides way too much freedom than you as a dev should have. If it wasn't for Typescript I probably would have went back to being an Android dev.
@jaazielcrb
@jaazielcrb Год назад
Dude, wtf with the final of that video! Jajajajajja you’re awesome
@GermanBlueMax
@GermanBlueMax 3 года назад
Hey man, I think you accidentally uploaded an unfinished version of your video. Just thought I would be a good guy and let you know.
@user-lp8ky5kk4o
@user-lp8ky5kk4o 3 года назад
He missed one word at the end. The word was "yes".
@kushakjafry1329
@kushakjafry1329 3 года назад
I had once started react + ts then just dumped the idea because of lot of code. But now I am thinking to start again.👍
@nicolaiveliki1409
@nicolaiveliki1409 3 года назад
I do have a few projects where the type security would reduce the frustration level significantly
@ganapwitheli
@ganapwitheli 3 года назад
That ending got me pressed the subscribe button
@bogdankarpus181
@bogdankarpus181 2 года назад
Thank for the truthly possition in the end of video!
@complex5372
@complex5372 3 года назад
TS is cool in itself but I don't feel good about using a Microsoft language in a Microsoft IDE to push code to Microsoft's GitHub, and packages to Microsoft's NPM. I feel like our code country was just colonized by the Empire of Microsoft. I'll pass ONLY for that reason.
@jitpackjoyride
@jitpackjoyride 3 года назад
No one seems to be mentioning how FC is not recommended anymore due to the automatic children prop, just use PropsWithChildren instead, and usually type inference is good enough for the return type.
@Elenthiriel
@Elenthiriel 3 года назад
As a typescript user, i can tell that he is amazing. Although you write a bit more code, you make your life absolutely more easy when your project starts to grow.
@sandeepkosta5750
@sandeepkosta5750 3 года назад
I have worked with both react and angular as well. And I love angular more than react
@indiansoftwareengineer4899
@indiansoftwareengineer4899 3 года назад
Loved the video and also Quote by Charles Bukowski, which motivates me always...
@WTHBrou
@WTHBrou 3 года назад
TypeScript is bae. it's been 8 months and I never went back to plain JS development. Lots of suffering during the first weeks, but it pays!
@SteinGauslaaStrindhaug
@SteinGauslaaStrindhaug 2 года назад
Most type errors that appears in production comes from the API suddenly returning unexpected data, having type checking at compile time has no effect on that.
@kunalsoni7681
@kunalsoni7681 3 года назад
Your way of explaining is superb 💗😊 thanks for sharing with us this information video
@borislavyanev1542
@borislavyanev1542 3 года назад
My favorite youtuber. I'll pay for the lifetime on your website and learn lots of stuff!
@actuallyatiger
@actuallyatiger 3 года назад
Have you done a video on Gatsby? If not then have you considered it?
@exoflame8763
@exoflame8763 3 года назад
if you write jsdocs editors pick those up too. so you dont need typescript for that also jsdocs can give you type errors if you define types.
@ddruganov
@ddruganov 3 года назад
for anyone wondering what the statement in the beginning evaluates to, it is 'fail '
@carlosleite2786
@carlosleite2786 3 года назад
Something's missing in the end ........ is there a 2nd part to this video? :)
Далее
Google Sheets… Your Next Database?
7:16
Просмотров 397 тыс.
Every React Concept Explained in 12 Minutes
11:53
Просмотров 662 тыс.
pumpkins #shorts
00:39
Просмотров 7 млн
КАК БОМЖУ ЗАРАБОТАТЬ НА ТАЧКУ
1:36:32
TypeScript in React - COMPLETE Tutorial (Crash Course)
53:21
I built 10 web apps... with 10 different languages
14:23
Big projects are ditching TypeScript… why?
3:38
Просмотров 1,3 млн
7 ways to deal with CSS
6:23
Просмотров 1,1 млн
Learn TypeScript Generics In 13 Minutes
12:52
Просмотров 266 тыс.
Learn Typescript with React | Quick Crash Course
16:59
JavaScript Framework Tier List
40:57
Просмотров 341 тыс.
10 CSS Pro Tips - Code this, NOT that!
9:39
Просмотров 2,2 млн
God-Tier Developer Roadmap
16:42
Просмотров 7 млн