Fireship · @fireship
TypeScript - The Basics
Uploaded November 29, 2018 · Length 12:01
Summary
Learn the basics of TypeScript, a superset of JavaScript, and its benefits for productivity and code quality.
- typescript basics
- javascript superset
- typescript benefits
- productivity with typescript
- typescript for web development
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
I can pretty easily say that the one
- 0:08
tool that's had the biggest impact on my
- 0:09
productivity as a web developer is
- 0:11
typescript and that's pretty amazing
- 0:13
considering a few years ago I had no
- 0:14
interest in learning it and was only
- 0:16
exposed to it because I had a client
- 0:17
that required an angular app in today's
- 0:19
video I'm gonna show you all the basic
- 0:20
concepts needed to be successful with
- 0:22
typescript and I'll throw in a few pro
- 0:24
tips here and there that I find
- 0:25
especially useful if you're new here
- 0:27
like and subscribe and there will be a
- 0:28
t-shirt giveaway with this video all you
- 0:30
have to do is leave a comment below and
- 0:31
we'll pick a random winner next week I
- 0:33
want to start with a shout-out to
- 0:35
basarat Syed who is the author of the
- 0:37
typescript deep dive book it's my go-to
- 0:39
resource for advanced concepts and it's
- 0:41
free and open source so originally I was
- 0:43
resistant to even learn typescript
- 0:45
because I wasn't super comfortable with
- 0:46
strong typed languages and I really
- 0:48
tried to avoid writing any more code
- 0:49
than I have to but this is the situation
- 0:51
where writing a little more code upfront
- 0:52
will pay big dividends as your project
- 0:54
grows the biggest benefit is actually
- 0:56
just tooling what you get in your IDE
- 0:58
like vs code when you use type
- 1:00
annotations or work with libraries that
- 1:02
are strong typed your code will be
- 1:03
automatically documented in the IDE so
- 1:05
you really have to refer back to online
- 1:07
documentation for the libraries that you
- 1:09
use in addition that compiler can catch
- 1:11
bugs in advance which is a far more
- 1:12
efficient way to refactor code
- 1:14
I think this reddit post says it best
- 1:16
would you rather have silly errors
- 1:17
during development or insanity inducing
- 1:19
errors in production another cool
- 1:21
benefit of typescript is that there's
- 1:23
virtually no learning curve if you know
- 1:24
JavaScript that's because it's a
- 1:26
superset of JavaScript so any valid jsk
- 1:29
is also valid in typescript so you can
- 1:31
learn it incrementally as you go and it
- 1:33
also allows us to write our code with
- 1:35
future JavaScript features without
- 1:36
having to worry about whether or not
- 1:38
this code will be supported in our
- 1:39
environment because we can transpile it
- 1:41
to multiple JavaScript flavors
- 1:43
now that you know typescript is awesome
- 1:44
let's go ahead and get started the first
- 1:46
thing you want to do is install
- 1:47
typescript globally with NPM doing this
- 1:50
will give you access to the TSC command
- 1:52
which will run the typescript compiler
- 1:54
at the time of this video I'm running
- 1:57
version 3.1 so the first thing we'll do
- 1:59
is create an indexed ES file and


