TypeScript Crash Course

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • In this TypeScript tutorial we will look at how to install the TypeScript Compiler, all of the different data types, functions, interfaces and classes

Комментарии • 328

  • @anabeatriz8835
    @anabeatriz8835 3 года назад +62

    SLIDES
    00:07 - What is TypeScript?
    01:12 - What does TypeScript offer?
    02:45 - Static type checking
    03:27 - TypeScript types
    04:07 - Class based objects
    05:02 - TypeScript compiler (TSC)
    GETTING STARTED
    06:01 - NodeJS and Visual Studio Code
    06:35 - Installing TypeScript
    07:41 - Opening project in text editor
    09:41 - DATA TYPES
    15:30 - Arrays
    18:52 - Tuple
    20:22 - void, undefined and null
    22:01 - FUNCTIONS
    22:47 - getSum function
    24:42 - mySum function
    27:28 - getName function
    29:25 - myVoid function
    30:16 - INTERFACES
    34:40 - CLASSES
    35:26 - User class
    41:05 - Member class
    44:37 - UserInterface interface

  • @CodingTutorials360
    @CodingTutorials360 7 лет назад +215

    Started a new job that uses TypeScript and Angular 4. Your crash courses are always the best to get up to speed asap.

    • @TraversyMedia
      @TraversyMedia  7 лет назад +32

      Thanks man :) Good luck with the new job

    • @peggy7744
      @peggy7744 6 лет назад +2

      Same here! Angular 4 and TS has been my life this week, haha :( These videos do help a lot though!

    • @SogMosee
      @SogMosee 6 лет назад +3

      How is the job going, 5 months later?

    • @CodingTutorials360
      @CodingTutorials360 6 лет назад +5

      Excellent!

    • @gopikrishnan4881
      @gopikrishnan4881 5 лет назад

      i just started

  • @attilagyen1446
    @attilagyen1446 5 лет назад +11

    just a little note: when you create a function you can use the lambda syntax so instead of
    function(x: number): number { return x }
    you can use
    let x = (x: number): number => { return x }
    p.s. thanks for this tutorial, it was really helpful

    • @amannan-123
      @amannan-123 3 года назад

      It is a good point but your example doesn't show the best use of lambda expressions.

  • @ja909
    @ja909 7 лет назад +39

    One of the key advantages with Typescript compared to Javascript is that it enables better tooling. The tools such as Visual Studio Code can provide intellisense, detect more errors prior to compiling, all due to the use of types.

    • @alenjose3903
      @alenjose3903 3 года назад

      what about now? Is classes and stuff now available in Javascript?

  •  7 лет назад +5

    In the past couple years I went from Lamp to Java to Mean. Now after a while, I'm slow learning Ionic 3 and consequentially Angular 4 and Typescript.
    I thought that my heart was JS but it's TS! Omg such elegant.
    For those Node developers out there, give a look into Nest!!

  • @pauls6277
    @pauls6277 3 года назад +1

    I started a new job like 1 week ago and this crash course has helped me a lot!
    Can't never go wrong with your videos, thank you! :D

  • @thriftsimple561
    @thriftsimple561 6 лет назад

    It's super rewarding after a month of learning programming to see so much of this and get one "aha" moment after another when things are clicking (ex I knew ahead that we'd need a super() call with the child class constructor, felt good). Soooo motivated now. Thanks Brad! Your stuff has been a huge contributor! Much appreciated!!

  • @retiar2111
    @retiar2111 6 лет назад +4

    I learned OOP in c++ and java and i was still unsecure about this. I thought theres more to it but actually its simple as it gets. TY BRAD!

  • @sarahmattar
    @sarahmattar 5 лет назад

    Short, sweet, and very informative! You're distilling down what takes others a few hours to explain. Thank you Brad!

  • @nanonerd100
    @nanonerd100 7 лет назад +19

    Nice intro to cover basics. Would be nice if at the end, you spent 30 sec to explain the point/benefit of creating the UserInterface interface. Thanks !

    • @sugaadai
      @sugaadai 5 лет назад +2

      Because class User is not a type

    • @NeuePerspektiveCH
      @NeuePerspektiveCH 5 лет назад +1

      Was just going to write the same exact thing .... last 4 or 5min were a bit fast and feel incomplete

    • @TroenderTass
      @TroenderTass 4 года назад +3

      Yeah, It's not explained, only demonstrated. But for those that might not be aware. Interfaces are implemented to make a commonality between different classes.
      Person class/type and a Car class/type might not have anything in common, but they both might need a method to wash. So they both can implement an Interface that enforces these classes to implement a wash method. The implimentation of this interface might not be that useful to these two classes, but it is very useful for a third class that stores a collection of classes that implements this method.
      This class might have a collection/list/array of items that it wants to perform some kind of cleanup on. In order for it to do this it loops trough each item and perform their own wash method. If the items don't have a wash method then this class can't perform what it was intended to do on multiple item. So it can say it want a type/class that implements the interface that enforces the wash method. That's all intefaces does, they enforces a set ot properties and methods, and other classes can enforce implementation of this, if they find it nessasary. That means it can perform a wash on the Car class, Person class and any kind of class that implements that interface that inforce the wash method. Might not make that much sense in javascript, since encaptulation and class inherritance is not that common.

  •  4 года назад

    Came here to learn TS in order to understand better the Deno JS engine. Thanks for sharing. 👏🏽
    The TS classes remind me the time developing using Java on the university projects. ;) Good old times I could say. 😊

  • @uhN0id
    @uhN0id 3 года назад

    As always, thank you! You speak at such a perfect pace. For people like me who are experienced programmers we can speed up the video 1.5x without it sounding sped up and weird while others can listen at your normal pace so they can retain it better. Thanks for everything you do! Such a good channel!

  • @DEVDerr
    @DEVDerr 6 лет назад +91

    20:08 For guys watching this in 2018 => They already fixed it!

  • @asharma741
    @asharma741 4 года назад +1

    I'm a beginner but knows js and this video is really helpful to learn ts

  • @LookNumber9
    @LookNumber9 7 лет назад +6

    Great job, Brad! I was hoping that we'd see something from you on TypeScript. Very clear and concise, as usual.

  • @christopherbilliau1308
    @christopherbilliau1308 7 лет назад +1

    Very helpful and easily understood explanation of TS basics!

  • @mahmoudabdelfattah9019
    @mahmoudabdelfattah9019 5 лет назад +1

    Best crash course about TypeScript, thanks a lot.

  • @elciesstv
    @elciesstv 6 лет назад

    Like the others, i started work in a new JS/Angular5 project in my actual job, and i rly need to say ty for this crash course, i just love the way u explain. Already bougth Angular, bootstrap and JS courses at udemy!

  • @egro-marketplace
    @egro-marketplace 5 лет назад

    Your courses are always efficient and clear !!!Your courses are always efficient and clear !!!

  • @pavzutube
    @pavzutube 7 лет назад

    console.log can take arguments, so its not required to concatenate strings. great tutorial for starting in typescript

  • @coding_ss632
    @coding_ss632 7 лет назад

    I'm doing angular2 these days and this video is helpful ... Thank you very much brad. Keep posting awesome crash course & tutorials like this.

  • @muzafferhassan
    @muzafferhassan 7 лет назад +3

    thanks for this introduction video of Typescript... you guys are doing well....

  • @ZenOfTube
    @ZenOfTube 6 лет назад

    For those who question its value, note that if you are looking for work using Angular you will need TypeScript. Brad has great Angular tutorials, too. Note that in this tutorial you may get the squiggly line error "[ts] Cannot redeclare block-scoped variable..." which is easily fixed by making your TypeScript file into a module. Do this with an empty export statement (export {};) at the top of your file and the annoying errors will go away.

    • @danielstoicamusic
      @danielstoicamusic 5 лет назад +1

      In this case you will get an error in your browser console.

  • @alaaaltounji6374
    @alaaaltounji6374 3 года назад

    best crash course for learning typescript keep going

  • @User-beta8347
    @User-beta8347 7 лет назад +1

    Great Video Tutorial. I have used Sublime Editor for working the TypeScript. I would like to say thankyou for providing this video tutorial.

  • @ThePCxbox
    @ThePCxbox 3 года назад

    Thank you ive been developing games forever which mainly uses C based languages, and ive been following your node.js crash course videos to branch out my knowledge of computers. Its always bugged me that in js you dont declare the variable type ahead of time. Its not exactly as smooth as c based languages but i think i found my new favorite framework/tool or whatever you want to call it :)

  • @daniel71626
    @daniel71626 5 лет назад +1

    I am going to use typescript on my job, So this is nice to have.

  • @volodymyrselevertov
    @volodymyrselevertov 4 года назад

    I started learn angular and for work with it I need to know TypeScript
    Thank you, Brad, now I have basic knowledge about TS :)

  • @DiegoArcega1
    @DiegoArcega1 5 лет назад +1

    Your crash courses are the best

  • @albertoakpos8595
    @albertoakpos8595 4 года назад

    Short and to the point. Nice work Brad!

  • @PezhvakIMV
    @PezhvakIMV 6 лет назад

    that was awesome just one thing, you didn't need to put payInvoice in the User class, it belonged to Member class and that was a great example for those who don't know what Inheritance is and they can extend the base class. i'm a teacher myself i think maybe those who just started coding get confused. anyway, this 46minutes worth by all means. i just understood typescript. thank you.

  • @mehmedbazdar9038
    @mehmedbazdar9038 7 лет назад +14

    Great tutorial as always. It looks like the syntax of TypeScript is similar to that of C# and Java :D

  • @mostafafawzy2681
    @mostafafawzy2681 4 года назад

    always your crash courses are the best choices for me to start learning any new technology, so I ask you to make another crash course of using TypeScript with React, please

  • @pascalcasehkv
    @pascalcasehkv 3 года назад

    Typescript versions are getting updated and it will be nice if you've specified the used version here in the description for a particular video.

  • @davidofug
    @davidofug 5 лет назад

    I have to admit, your courses are the best. Thank you Brad.

  • @phanirithvij
    @phanirithvij 5 лет назад

    We can use
    var x : typename[ ] ;
    instead of
    var x : Array;
    example:
    var a : number[];
    a.push(2,3,4,2);

  • @mahmoudhosain9542
    @mahmoudhosain9542 3 года назад

    Great Content always 👌😍

  • @allecoqqq
    @allecoqqq 7 лет назад

    Hmm, another good point you kind of missed is the autocompletion that the IDE offers. For instance when u created interface for Todo and passed it as an argument type for showTodo(), it automatically knew which fields are available of todo object.

  • @ad_asquare
    @ad_asquare 3 года назад

    Great tutorial. Thanks Brad👍

  • @samuelweb6595
    @samuelweb6595 7 лет назад +3

    Great tutorials Sir. God Bless You!!

  • @ibrahimmohammed3484
    @ibrahimmohammed3484 7 лет назад

    2 days ago i was searching for something similar as long as i didn't see it in your channel, thanx brad :)

  • @GaryParkin
    @GaryParkin 7 лет назад

    Thank you! Finally I understand why I'd want to use TypeScript.

  • @pcmckar
    @pcmckar 5 лет назад

    Totally useful. Nice and in a nutshell, things explained very well! Not sure why disliked this ?

  • @pmahesh6789
    @pmahesh6789 4 года назад

    Nice video... Simplest way of explanation. I am sure if you add one video on generics then beginners will enjoy & increase there confidence. I was confused with generics when i was learn TypeScript first time even i have experience in C#. So, I am also interested....

  • @applesaucebiatch
    @applesaucebiatch 7 лет назад +4

    vs code has a built in cmd prompt to access it press the hotkey control and backtick( tilda key not single quote)
    ctrl + `

  • @CamdenBloke
    @CamdenBloke 4 года назад

    @26:00 Just always parseInt or parseFloat. If you provide an int it will return the same. Also, it's no quicker to run the typeOf test first, I'm just javascript does that internally on parseInt, except on a lowe level.

  • @warunsharma3995
    @warunsharma3995 3 года назад

    Great content.

  • @btcls
    @btcls 5 лет назад

    The simple and the best course ever find

  • @rennishj
    @rennishj 6 лет назад +1

    Thank you for taking the time to do a very nice intro

  • @idynxcode6390
    @idynxcode6390 4 года назад

    Excellent!

  • @atepoc7412
    @atepoc7412 6 лет назад

    Thanks! Learning something new in every video you create!!

  • @nilanjanmajumder8508
    @nilanjanmajumder8508 4 года назад

    great video

  • @Drag0n_Master_
    @Drag0n_Master_ 7 лет назад

    Thanks for the video, it's a nice overview of TypeScript - exactly what I was looking for!

  • @curiousprogrammer90
    @curiousprogrammer90 7 лет назад +4

    Thanks Brad! :) Keep em coming!

  • @FredoCorleone
    @FredoCorleone 6 лет назад

    Watch it 2x speed, good overview! I've enjoyed it

  • @razorsharpshady
    @razorsharpshady 7 лет назад

    great tutorial.. very neat n clean

  • @Enzarro
    @Enzarro 7 лет назад +176

    Come getSum()

  • @elorating
    @elorating 4 года назад

    As in Jan, 2020. Tuples has to match length as well. So at 20:40, strNumTuple = ["Hello", 4,3,4] will cause an error.

  • @joakimkarlberg9289
    @joakimkarlberg9289 4 года назад

    Congrats on 1 million subscribers!

  • @lianglyu4237
    @lianglyu4237 6 лет назад +1

    Nice beginner tutorial! keep it up!

  • @iltafkhalid5146
    @iltafkhalid5146 6 лет назад

    Perfect, very much to the point tutorial.

  • @ASoftwareEngineer
    @ASoftwareEngineer 7 лет назад

    thanks so much, been learning much from your playlist, keep up the great work. Great for FE community

  • @oras4940
    @oras4940 6 лет назад +1

    wonderful crash course!

  • @leg875
    @leg875 7 лет назад

    Its a real crashcourse, short and sweet :)

  • @hamzasadouk4741
    @hamzasadouk4741 3 года назад

    as c# developer i was kinda lazy to learn javascript because it means I have to forget lot of key aspects and principles of programming I learned in c# but with typescript i felt at home and I can code in JS without using JS.

  • @eddiehernandez70
    @eddiehernandez70 4 года назад

    Amazing video. Great primer man. Thanks!

  • @JoshYates
    @JoshYates 7 лет назад +4

    I replaced 'let' with 'var' to eliminate the 'Cannot redeclare block-scoped variable 'myString', 'myNum', etc.

    • @ericdecolsales3066
      @ericdecolsales3066 6 лет назад

      my hero. Way better then creating an explicit lib property in tsconfig.json without DOM

    • @tjblackman08
      @tjblackman08 5 лет назад

      I just wrapped my code in an IIFE

  • @TheKievsash
    @TheKievsash 4 года назад

    Thanks! Waiting for advanced Generics types video

  • @sudhanmadhu1251
    @sudhanmadhu1251 4 года назад

    Thank you so much .this great one for new guys..

  • @surajmistry4034
    @surajmistry4034 7 лет назад

    Sir Brad You doing amazing great helpful tutorials.Would like you to do project tutorial for Laravel with admin panel please.Thank you so much for your great tutorials.. :)👍

  • @Thaidakarium
    @Thaidakarium 7 лет назад +9

    God, finally I understand xD, thanks Traversy!

  • @azimjonsodikov
    @azimjonsodikov 6 лет назад +5

    Run `tsc --init` if you are getting weird type errors in VS code

  • @daymaker_trading
    @daymaker_trading 4 года назад

    Thank you soo much!!! Such an awesome crash course!

  • @abdelbakibelhajslimene8278
    @abdelbakibelhajslimene8278 7 лет назад

    Thanks Brad, a fantastic work and clear explanations

  • @CodingPhase
    @CodingPhase 7 лет назад

    I've been wanting to jump to typescript

  • @Seb16291629
    @Seb16291629 3 года назад +1

    Hi Brad, i followed your MERN courses, how would you deploy to heroku when you add typescript ? I am very confused with the scripts and concurrently -watch etc . Could you please provide a tuto? It s very difficult to find online how to do for this setup with typescript. Thanks

  • @aaronhall8039
    @aaronhall8039 5 лет назад +11

    Your link to the full course doesn't seem to be working.

    • @NeuePerspektiveCH
      @NeuePerspektiveCH 5 лет назад

      Still not working (August 2019)

    • @qwang6038
      @qwang6038 4 года назад +1

      I believe this is the one: www.eduonix.com/courses/Web-Development/the-complete-typescript-programming-guide-for-web-developers

  • @hassaneoutouaya
    @hassaneoutouaya Год назад

    I am coming from 2022 :)
    Thank you so much !

  • @user-hd2bn4vp9r
    @user-hd2bn4vp9r 4 года назад

    Have watched this vedio, thank you

  • @generalg007
    @generalg007 7 лет назад

    Brad, good job and well explained. Thanks a lot!

  • @rsruo8331
    @rsruo8331 4 года назад

    useful course

  • @RushSonictron
    @RushSonictron 5 лет назад

    You crash courses are the best :)

  • @braker37
    @braker37 4 года назад +7

    I think you got confused there with the payInvoice() function in the Member class. The way you implemented it, it doesn't even need to be there, since you put it in the super class first. It would've been more useful if you had shown overriding instead of that. Other than that - great video. 1.5x speed recommended.

  • @KresnaPermana
    @KresnaPermana 4 года назад

    Stright to the point as always

  • @pola478
    @pola478 5 лет назад

    great, clear tutorial. Thanks

  • @jonasdevries7260
    @jonasdevries7260 7 лет назад

    Thanks Brad!!!! Way to go!!!!

  • @skrezwan12
    @skrezwan12 6 лет назад

    I am your fan forever.......

  • @knivesoutbitch
    @knivesoutbitch 5 лет назад

    Just a heads up with classes -- interfaces do not support private / protected types, so keep that in mind when using them.

  • @boujemaa8059
    @boujemaa8059 7 лет назад

    Brad You Are the Rock!

  • @FitLife6767
    @FitLife6767 6 лет назад

    This is wonderful...thank you

  • @maskman4821
    @maskman4821 6 лет назад

    awesome tutorial, you are the best!

  • @Chetan.Kothari
    @Chetan.Kothari 3 года назад

    Thank you so much!!!

  • @iancarr3923
    @iancarr3923 5 лет назад

    Very helpful as usual!

  • @alekseikorkh9010
    @alekseikorkh9010 7 лет назад

    amazing video. Thanks a lot

  • @proit324techlead9
    @proit324techlead9 5 лет назад

    As always, it is really awesome.

  • @AionAngell
    @AionAngell 5 лет назад

    Reaaly great video, Thanks a lot!

  • @dreznik
    @dreznik 6 лет назад

    at 43:30 do you have to implement payInvoice() in the child class? in C# it would automatically inherit that method from the parent!

  • @sergiumare7259
    @sergiumare7259 4 года назад

    Good tutorial!

  • @ghazwan2568
    @ghazwan2568 6 лет назад

    Great one

  • @raazs35
    @raazs35 7 лет назад

    Thanks a lot.. i've been waiting for this you are awesome man.