1
00:00:01,010 --> 00:00:04,910
In this video, we're going to move on to our next big subject, which is type annotations and type

2
00:00:04,910 --> 00:00:05,360
inference.

3
00:00:05,910 --> 00:00:09,980
These are technically two different systems inside of TypeScript, but we're going to talk about them

4
00:00:09,980 --> 00:00:14,240
in parallel for a very good reason, just to make things a little bit more complicated as well.

5
00:00:14,330 --> 00:00:20,000
These two different features apply slightly differently to variable declarations, functions and objects.

6
00:00:20,630 --> 00:00:24,380
So we're going to first talk about type annotations and inference as applied to variables.

7
00:00:24,890 --> 00:00:28,970
And we'll take a break and talk about them applied to functions and then objects and so on.

8
00:00:30,140 --> 00:00:33,980
For each of these different subjects, we're going to once again through go through some plain definition

9
00:00:33,980 --> 00:00:34,700
and overview.

10
00:00:35,240 --> 00:00:38,370
Well, then take a look at some different code examples that we're going to write out together.

11
00:00:38,530 --> 00:00:40,910
You'll notice I swap these two steps right here this time around.

12
00:00:41,210 --> 00:00:45,620
So we'll then talk about why we care about this annotation and infant stuff and we'll discuss when to

13
00:00:45,620 --> 00:00:46,000
use it.

14
00:00:46,640 --> 00:00:47,570
So let's get to it.

15
00:00:48,560 --> 00:00:54,770
First off, some plane definitions, so type annotations, what is that a type annotation is some tiny

16
00:00:54,770 --> 00:01:00,830
bit of code that you and I are going to write to tell typescript what type of value a variable refers

17
00:01:00,830 --> 00:01:01,070
to.

18
00:01:02,490 --> 00:01:06,390
All right, now, before expanding on that definition, let's talk about what type inferences, so it's

19
00:01:06,390 --> 00:01:12,150
type inference, TypeScript, is going to attempt to automatically figure out what type of value a variable

20
00:01:12,150 --> 00:01:12,740
refers to.

21
00:01:13,560 --> 00:01:17,550
And you'll notice that the kind of definition of both these are very similar in both cases.

22
00:01:17,550 --> 00:01:21,180
It's what type of valuable, what type of value, a variable.

23
00:01:21,180 --> 00:01:22,200
What will it refer to?

24
00:01:22,830 --> 00:01:27,360
So the interesting thing about type annotations and type of inference is that they're kind of at odds

25
00:01:27,360 --> 00:01:27,960
with each other.

26
00:01:28,350 --> 00:01:34,230
In one case, you and I are adding in a little bit of code to tell TypeScript what different types we

27
00:01:34,230 --> 00:01:36,570
are working with, with type inference.

28
00:01:36,570 --> 00:01:39,430
We are relying upon TypeScript to do that work for us.

29
00:01:40,080 --> 00:01:45,210
So these two features are a question of are you and I are going to do everything manually or are we

30
00:01:45,210 --> 00:01:46,800
going to leave it up to TypeScript?

31
00:01:47,170 --> 00:01:48,990
That's what the big question here is.

32
00:01:49,200 --> 00:01:53,220
And that's why what is going to be the big focus of our discussion about, you know, why we care about

33
00:01:53,220 --> 00:01:54,770
these features and when to use them?

34
00:01:55,640 --> 00:01:56,970
Let's take a quick pause right here.

35
00:01:57,000 --> 00:02:00,690
We're going to come back to the next video and start taking a look at a couple of different code samples.

36
00:02:00,690 --> 00:02:02,580
So quick pause and I'll see you in just a minute.

