WEBVTT

1
00:00:02.700 --> 00:00:06.780
<00:00:02.700>So <00:00:02.787>I <00:00:02.875>want <00:00:02.962>to <00:00:03.050>talk <00:00:03.137>to <00:00:03.225>you <00:00:03.312>about <00:00:03.400>type <00:00:03.487>safety <00:00:03.575>and <00:00:03.662>how <00:00:03.750>it's <00:00:03.837>a <00:00:03.925>language <00:00:04.012>that <00:00:04.100>allows

2
00:00:06.780 --> 00:00:08.140
<00:00:06.780>you <00:00:07.086>to <00:00:07.392>develop <00:00:07.698>really <00:00:08.004>fast,

3
00:00:08.560 --> 00:00:12.260
<00:00:08.560>but <00:00:08.676>still <00:00:08.793>be <00:00:08.910>really <00:00:09.026>type <00:00:09.143>safe <00:00:09.260>and <00:00:09.376>really <00:00:09.493>secure <00:00:09.610>and <00:00:09.726>like <00:00:09.843>feel <00:00:09.960>really

4
00:00:12.260 --> 00:00:15.580
<00:00:12.260>comfortable, <00:00:12.540>uh, <00:00:12.820>deploying. <00:00:13.100>So <00:00:13.379>I'm <00:00:13.660>Ys.

5
00:00:15.840 --> 00:00:20.420
<00:00:15.840>I'm <00:00:15.967>a <00:00:16.094>senior <00:00:16.221>software <00:00:16.349>engineer <00:00:16.476>at <00:00:16.603>DataCamp. <00:00:16.730>Um, <00:00:16.858>you <00:00:16.985>can <00:00:17.112>find <00:00:17.240>me@entropy.com.

6
00:00:20.480 --> 00:00:24.020
<00:00:20.480>You <00:00:20.567>can <00:00:20.655>find <00:00:20.742>the <00:00:20.830>slides <00:00:20.917>there <00:00:21.005>already <00:00:21.092>if <00:00:21.180>you <00:00:21.267>want <00:00:21.355>to <00:00:21.442>follow <00:00:21.530>along <00:00:21.617>or <00:00:21.705>if <00:00:21.792>you <00:00:21.880>want

7
00:00:24.020 --> 00:00:28.300
<00:00:24.020>to <00:00:24.120>tweet <00:00:24.220>at <00:00:24.320>me <00:00:24.419>or <00:00:24.520>something, <00:00:24.620>you <00:00:24.720>find <00:00:24.820>my <00:00:24.919>handles, <00:00:25.020>et <00:00:25.120>cetera <00:00:25.220>on <00:00:25.320>there. <00:00:25.419>Um,

8
00:00:28.720 --> 00:00:32.100
<00:00:28.720>so <00:00:28.860>for <00:00:29.000>today, <00:00:29.140>uh, <00:00:29.279>I'll <00:00:29.419>start <00:00:29.560>with <00:00:29.700>a <00:00:29.840>quick <00:00:29.979>TypeScript <00:00:30.119>introduction.

9
00:00:32.100 --> 00:00:34.100
<00:00:32.100>For <00:00:32.255>those <00:00:32.411>of <00:00:32.566>you <00:00:32.722>who <00:00:32.877>are <00:00:33.033>not <00:00:33.188>familiar <00:00:33.344>with <00:00:33.500>it,

10
00:00:34.360 --> 00:00:36.380
<00:00:34.360>to <00:00:34.640>quickly <00:00:34.920>explain <00:00:35.200>what <00:00:35.480>TypeScript <00:00:35.760>is,

11
00:00:36.810 --> 00:00:38.940
<00:00:36.810>then <00:00:36.985>I'll <00:00:37.160>talk <00:00:37.335>like <00:00:37.510>why <00:00:37.685>is <00:00:37.860>it <00:00:38.035>actually <00:00:38.210>different,

12
00:00:39.050 --> 00:00:41.980
<00:00:39.050>like <00:00:39.205>what <00:00:39.361>makes <00:00:39.516>it <00:00:39.672>so <00:00:39.827>powerful? <00:00:39.983>And <00:00:40.138>then <00:00:40.294>I'll <00:00:40.449>uh,

13
00:00:41.980 --> 00:00:43.740
<00:00:41.980>be <00:00:42.260>talking <00:00:42.540>through <00:00:42.819>three <00:00:43.099>use <00:00:43.379>cases,

14
00:00:44.150 --> 00:00:47.980
<00:00:44.150>which <00:00:44.277>really <00:00:44.404>showcase <00:00:44.531>that <00:00:44.659>TypeScript <00:00:44.786>can <00:00:44.913>be <00:00:45.040>as <00:00:45.168>powerful <00:00:45.295>as <00:00:45.422>rust, <00:00:45.550>uh,

15
00:00:48.120 --> 00:00:52.120
<00:00:48.120>in <00:00:48.220>terms <00:00:48.320>of <00:00:48.419>type <00:00:48.519>safety. <00:00:48.620>And <00:00:48.720>then <00:00:48.820>at <00:00:48.919>the <00:00:49.019>end <00:00:49.120>I'll <00:00:49.220>do <00:00:49.320>a <00:00:49.419>short <00:00:49.519>evaluation.

16
00:00:52.980 --> 00:00:57.030
<00:00:52.980>So <00:00:53.154>first <00:00:53.330>off, <00:00:53.504>a <00:00:53.680>quick <00:00:53.855>TypeScript <00:00:54.029>introduction. <00:00:54.205>So <00:00:54.379>in,

17
00:00:57.030 --> 00:01:00.430
<00:00:57.030>is <00:00:57.185>it <00:00:57.341>essence <00:00:57.496>Java <00:00:57.652>A <00:00:57.807>TypeScript <00:00:57.963>is <00:00:58.118>JavaScript <00:00:58.274>plus <00:00:58.430>types.

18
00:01:01.130 --> 00:01:02.230
<00:01:01.130>So <00:01:01.460>there <00:01:01.790>is <00:01:02.120>not,

19
00:01:02.610 --> 00:01:05.590
<00:01:02.610>in <00:01:02.737>the <00:01:02.864>beginning <00:01:02.991>there <00:01:03.119>were <00:01:03.246>a <00:01:03.373>bunch <00:01:03.500>of <00:01:03.628>extra <00:01:03.755>features <00:01:03.882>in <00:01:04.010>TypeScript,

20
00:01:05.590 --> 00:01:07.590
<00:01:05.590>but <00:01:05.790>that's <00:01:05.990>not <00:01:06.190>the <00:01:06.390>case <00:01:06.590>anymore. <00:01:06.790>Right <00:01:06.990>now.

21
00:01:07.640 --> 00:01:12.190
<00:01:07.640>Types <00:01:07.747>kit <00:01:07.855>is <00:01:07.963>really <00:01:08.070>adding <00:01:08.178>types <00:01:08.286>to <00:01:08.393>the <00:01:08.501>JavaScripts <00:01:08.609>and <00:01:08.716>if <00:01:08.824>you're <00:01:08.932>wondering <00:01:09.040>what

22
00:01:12.190 --> 00:01:16.270
<00:01:12.190>is <00:01:12.317>types, <00:01:12.444>what <00:01:12.571>are <00:01:12.699>type, <00:01:12.826>what <00:01:12.953>are <00:01:13.080>types <00:01:13.208>doing, <00:01:13.335>they're <00:01:13.462>basically <00:01:13.590>disallowing.

23
00:01:16.270 --> 00:01:18.350
<00:01:16.270>Certain <00:01:16.619>programs <00:01:16.970>that <00:01:17.320>are <00:01:17.670>syn,

24
00:01:18.350 --> 00:01:21.430
<00:01:18.350>technically <00:01:18.583>like <00:01:18.816>valids <00:01:19.050>but <00:01:19.283>are <00:01:19.516>are <00:01:19.750>meaningless.

25
00:01:21.780 --> 00:01:26.070
<00:01:21.780>They <00:01:21.873>contain <00:01:21.966>books <00:01:22.060>or <00:01:22.153>they're <00:01:22.246>just <00:01:22.340>like, <00:01:22.433>if <00:01:22.526>you <00:01:22.620>divide <00:01:22.713>a <00:01:22.806>string <00:01:22.900>by <00:01:22.993>by <00:01:23.086>a <00:01:23.180>date,

26
00:01:26.100 --> 00:01:29.270
<00:01:26.100>that <00:01:26.227>doesn't <00:01:26.354>mean <00:01:26.481>anything. <00:01:26.609>Like <00:01:26.736>what, <00:01:26.863>what <00:01:26.990>is <00:01:27.118>that <00:01:27.245>program <00:01:27.372>doing? <00:01:27.500>It,

27
00:01:29.300 --> 00:01:31.750
<00:01:29.300>it's <00:01:29.455>similar <00:01:29.611>to <00:01:29.766>natural <00:01:29.922>language. <00:01:30.077>The <00:01:30.233>house <00:01:30.388>eats <00:01:30.544>the <00:01:30.700>lake.

28
00:01:31.750 --> 00:01:34.310
<00:01:31.750>Like <00:01:31.950>what <00:01:32.150>does <00:01:32.350>that <00:01:32.550>sentence <00:01:32.750>mean? <00:01:32.950>Like <00:01:33.150>syn,

29
00:01:34.310 --> 00:01:38.430
<00:01:34.310>technically <00:01:34.485>it's <00:01:34.660>a <00:01:34.835>very <00:01:35.010>perfectly <00:01:35.185>valid <00:01:35.360>sentence, <00:01:35.535>but <00:01:35.710>grammar,

30
00:01:38.540 --> 00:01:41.150
<00:01:38.539>like <00:01:38.667>when <00:01:38.794>you <00:01:38.921>think <00:01:39.049>about <00:01:39.176>it, <00:01:39.303>it, <00:01:39.430>it <00:01:39.558>doesn't <00:01:39.685>make <00:01:39.812>any <00:01:39.940>sense.

31
00:01:41.690 --> 00:01:43.550
<00:01:41.690>And <00:01:41.865>that's <00:01:42.039>the <00:01:42.215>same <00:01:42.390>thing <00:01:42.565>with <00:01:42.740>TypeScript <00:01:42.914>and <00:01:43.090>types.

32
00:01:43.660 --> 00:01:47.830
<00:01:43.660>Like <00:01:43.767>there <00:01:43.875>are <00:01:43.983>certain <00:01:44.090>programs <00:01:44.198>that <00:01:44.306>just <00:01:44.413>don't <00:01:44.521>make <00:01:44.629>sense <00:01:44.736>and <00:01:44.844>we <00:01:44.952>want <00:01:45.060>to

33
00:01:48.180 --> 00:01:52.750
<00:01:48.180>exclude <00:01:48.296>them <00:01:48.413>and <00:01:48.530>not <00:01:48.646>count <00:01:48.763>as <00:01:48.880>valid. <00:01:48.996>Um, <00:01:49.113>when <00:01:49.230>we <00:01:49.346>think <00:01:49.463>about <00:01:49.580>types,

34
00:01:52.780 --> 00:01:56.150
<00:01:52.780>they <00:01:52.955>can <00:01:53.130>be <00:01:53.305>annotated <00:01:53.480>or <00:01:53.655>inferred. <00:01:53.830>So, <00:01:54.005>so <00:01:54.180>um,

35
00:01:56.980 --> 00:02:00.430
<00:01:56.979>here <00:01:57.107>you <00:01:57.234>see <00:01:57.361>the <00:01:57.489>colon <00:01:57.616>and <00:01:57.743>string, <00:01:57.870>they, <00:01:57.998>that's <00:01:58.125>the <00:01:58.252>type <00:01:58.380>annotation.

36
00:02:00.650 --> 00:02:04.280
<00:02:00.650>And <00:02:00.766>then <00:02:00.883>we <00:02:01.000>say <00:02:01.116>the <00:02:01.233>hella <00:02:01.350>world <00:02:01.466>variable <00:02:01.583>is <00:02:01.700>of <00:02:01.816>type <00:02:01.933>string. <00:02:02.050>Um,

37
00:02:04.740 --> 00:02:07.440
<00:02:04.740>we <00:02:04.914>have <00:02:05.089>very <00:02:05.265>simple <00:02:05.440>types <00:02:05.615>like <00:02:05.789>string <00:02:05.964>number <00:02:06.140>bullion.

38
00:02:07.440 --> 00:02:08.440
<00:02:07.440>They're <00:02:07.664>built <00:02:07.890>into <00:02:08.115>the <00:02:08.340>language,

39
00:02:08.700 --> 00:02:11.760
<00:02:08.699>but <00:02:08.839>we <00:02:08.979>can <00:02:09.119>use <00:02:09.259>those <00:02:09.399>to <00:02:09.539>build <00:02:09.679>more <00:02:09.820>complex <00:02:09.959>types. <00:02:10.100>Um,

40
00:02:12.060 --> 00:02:16.600
<00:02:12.060>we <00:02:12.153>can <00:02:12.246>even <00:02:12.340>make <00:02:12.433>a <00:02:12.526>type <00:02:12.620>aliens, <00:02:12.713>which <00:02:12.806>is <00:02:12.900>kind <00:02:12.993>of <00:02:13.086>like <00:02:13.180>a <00:02:13.273>variable <00:02:13.366>in <00:02:13.460>pipelines.

41
00:02:17.020 --> 00:02:21.160
<00:02:17.020>So <00:02:17.147>you <00:02:17.274>can <00:02:17.401>see <00:02:17.529>the <00:02:17.656>code <00:02:17.783>type <00:02:17.910>keyword <00:02:18.038>as <00:02:18.165>similar <00:02:18.292>to <00:02:18.420>con,

42
00:02:21.620 --> 00:02:24.960
<00:02:21.620>but <00:02:21.747>then <00:02:21.874>in <00:02:22.001>the <00:02:22.129>type <00:02:22.256>plans. <00:02:22.383>And <00:02:22.510>so <00:02:22.638>this <00:02:22.765>type <00:02:22.892>person, <00:02:23.020>um,

43
00:02:26.450 --> 00:02:31.060
<00:02:26.450>name <00:02:26.543>H <00:02:26.636>is <00:02:26.730>defining <00:02:26.823>an <00:02:26.916>object <00:02:27.010>type <00:02:27.103>with <00:02:27.196>a <00:02:27.290>name <00:02:27.383>field <00:02:27.476>and <00:02:27.570>an <00:02:27.663>H <00:02:27.756>fields. <00:02:27.850>Uh,

44
00:02:31.060 --> 00:02:34.700
<00:02:31.060>you <00:02:31.235>can <00:02:31.410>also <00:02:31.585>have <00:02:31.760>union <00:02:31.935>types <00:02:32.110>which <00:02:32.285>separate <00:02:32.460>like,

45
00:02:34.750 --> 00:02:36.100
<00:02:34.750>which <00:02:35.155>means <00:02:35.560>that <00:02:35.965>uh,

46
00:02:36.220 --> 00:02:40.180
<00:02:36.220>a <00:02:36.307>value <00:02:36.395>of <00:02:36.482>that <00:02:36.570>type <00:02:36.657>either <00:02:36.745>needs <00:02:36.832>to <00:02:36.920>be <00:02:37.007>a <00:02:37.095>string <00:02:37.182>or <00:02:37.270>a <00:02:37.357>number <00:02:37.445>or <00:02:37.532>whatever. <00:02:37.620>Uh,

47
00:02:40.240 --> 00:02:43.800
<00:02:40.240>you <00:02:40.380>put <00:02:40.520>in <00:02:40.660>the <00:02:40.800>union <00:02:40.940>you <00:02:41.080>have <00:02:41.220>array <00:02:41.360>types <00:02:41.500>to <00:02:41.640>um,

48
00:02:44.030 --> 00:02:47.610
<00:02:44.030>signify <00:02:44.230>like <00:02:44.430>your <00:02:44.630>to <00:02:44.830>type <00:02:45.030>your <00:02:45.230>arrays. <00:02:45.430>Uh,

49
00:02:47.630 --> 00:02:52.290
<00:02:47.630>and <00:02:47.730>they <00:02:47.829>can <00:02:47.930>be <00:02:48.030>annotated <00:02:48.130>using <00:02:48.230>the <00:02:48.329>square <00:02:48.430>brackets <00:02:48.530>or <00:02:48.630>you <00:02:48.730>can <00:02:48.829>also <00:02:48.930>use <00:02:49.030>array,

50
00:02:52.430 --> 00:02:54.970
<00:02:52.430>uh, <00:02:52.710>number <00:02:52.990>uh, <00:02:53.270>in <00:02:53.550>angular <00:02:53.830>brackets.

51
00:02:55.310 --> 00:02:58.690
<00:02:55.310>And <00:02:55.485>then <00:02:55.660>lastly <00:02:55.835>we <00:02:56.010>have <00:02:56.185>function <00:02:56.360>types <00:02:56.535>which <00:02:56.710>um,

52
00:02:59.180 --> 00:03:00.320
<00:02:59.180>are <00:02:59.436>to <00:02:59.693>type <00:02:59.949>your <00:03:00.206>functions.

53
00:03:00.340 --> 00:03:04.640
<00:03:00.340>And <00:03:00.467>what's <00:03:00.594>really <00:03:00.721>important <00:03:00.849>for <00:03:00.976>today <00:03:01.103>is <00:03:01.230>just <00:03:01.358>in <00:03:01.485>JavaScript <00:03:01.612>we, <00:03:01.740>uh,

54
00:03:04.980 --> 00:03:07.040
<00:03:04.980>notate <00:03:05.213>our <00:03:05.446>functions <00:03:05.679>using <00:03:05.913>this <00:03:06.146>error, <00:03:06.380>uh,

55
00:03:07.080 --> 00:03:10.690
<00:03:07.080>notation <00:03:07.280>that <00:03:07.480>will <00:03:07.680>come <00:03:07.880>back <00:03:08.080>later <00:03:08.280>on. <00:03:08.480>Um,

56
00:03:11.430 --> 00:03:16.280
<00:03:11.430>and <00:03:11.570>so <00:03:11.710>those <00:03:11.850>are <00:03:11.990>the <00:03:12.130>more <00:03:12.270>complex <00:03:12.410>types <00:03:12.550>that <00:03:12.690>are <00:03:12.830>still

57
00:03:16.280 --> 00:03:20.120
<00:03:16.280>relatively <00:03:16.435>simple. <00:03:16.591>Uh, <00:03:16.746>then <00:03:16.902>we <00:03:17.057>can <00:03:17.213>get <00:03:17.368>also <00:03:17.524>in <00:03:17.680>generics.

58
00:03:20.560 --> 00:03:24.890
<00:03:20.560>Generics <00:03:20.715>is <00:03:20.871>a <00:03:21.026>way <00:03:21.182>to <00:03:21.337>abstract <00:03:21.493>over <00:03:21.648>types <00:03:21.804>like <00:03:21.960>this.

59
00:03:25.030 --> 00:03:26.450
<00:03:25.030>In <00:03:25.285>this <00:03:25.541>case <00:03:25.796>the <00:03:26.052>box <00:03:26.308>example,

60
00:03:26.870 --> 00:03:29.810
<00:03:26.870>you <00:03:26.963>can <00:03:27.056>make <00:03:27.150>a <00:03:27.243>box <00:03:27.336>that <00:03:27.430>sometimes <00:03:27.523>you <00:03:27.616>want <00:03:27.710>to <00:03:27.803>put <00:03:27.896>string <00:03:27.990>in <00:03:28.083>and <00:03:28.176>sometimes <00:03:28.270>you

61
00:03:29.810 --> 00:03:31.810
<00:03:29.810>want <00:03:29.937>to <00:03:30.064>put <00:03:30.191>numbers <00:03:30.319>in, <00:03:30.446>but <00:03:30.573>if <00:03:30.700>you <00:03:30.828>have <00:03:30.955>a <00:03:31.082>number <00:03:31.210>box,

62
00:03:31.810 --> 00:03:33.730
<00:03:31.810>you <00:03:31.950>want <00:03:32.090>to <00:03:32.230>make <00:03:32.370>sure <00:03:32.510>that <00:03:32.650>you <00:03:32.790>can't <00:03:32.930>put <00:03:33.070>strings <00:03:33.210>in.

63
00:03:33.950 --> 00:03:37.970
<00:03:33.950>That's <00:03:34.066>where <00:03:34.183>generics <00:03:34.299>comes <00:03:34.416>in <00:03:34.533>and <00:03:34.649>it's <00:03:34.766>very <00:03:34.883>simple <00:03:35.000>to <00:03:35.116>the <00:03:35.233>array <00:03:35.350>example.

64
00:03:38.310 --> 00:03:39.450
<00:03:38.310>So <00:03:38.566>we <00:03:38.823>use <00:03:39.079>the <00:03:39.335>uh,

65
00:03:39.970 --> 00:03:43.810
<00:03:39.970>angular <00:03:40.086>brackets <00:03:40.203>again <00:03:40.320>and <00:03:40.436>you <00:03:40.553>see <00:03:40.670>that <00:03:40.786>the <00:03:40.903>array <00:03:41.020>number <00:03:41.136>that's <00:03:41.253>actually, <00:03:41.370>um,

66
00:03:44.070 --> 00:03:48.650
<00:03:44.070>the <00:03:44.163>notation <00:03:44.256>to <00:03:44.350>say <00:03:44.443>like <00:03:44.536>array <00:03:44.630>generic <00:03:44.723>in <00:03:44.816>number <00:03:44.910>and <00:03:45.003>you <00:03:45.096>can <00:03:45.190>put <00:03:45.283>any <00:03:45.376>other <00:03:45.470>type

67
00:03:48.650 --> 00:03:52.780
<00:03:48.650>in <00:03:48.930>there. <00:03:49.210>Uh, <00:03:49.490>and <00:03:49.770>then <00:03:50.050>types,

68
00:03:52.800 --> 00:03:56.260
<00:03:52.800>it <00:03:52.907>also <00:03:53.015>has <00:03:53.123>really <00:03:53.230>weird <00:03:53.338>string <00:03:53.446>types. <00:03:53.553>So <00:03:53.661>we <00:03:53.769>already <00:03:53.876>saw <00:03:53.984>the <00:03:54.092>string <00:03:54.200>type,

69
00:03:56.260 --> 00:03:58.340
<00:03:56.260>which <00:03:56.493>is <00:03:56.726>like <00:03:56.959>representing <00:03:57.193>all <00:03:57.426>possible <00:03:57.660>strings,

70
00:03:58.760 --> 00:04:02.660
<00:03:58.760>but <00:03:58.867>in <00:03:58.975>TypeScript <00:03:59.083>type <00:03:59.190>plans <00:03:59.298>you <00:03:59.406>can <00:03:59.513>even <00:03:59.621>have <00:03:59.729>the <00:03:59.836>string <00:03:59.944>type <00:04:00.052>Hello <00:04:00.160>worlds.

71
00:04:02.880 --> 00:04:06.700
<00:04:02.880>And <00:04:02.996>the <00:04:03.113>only <00:04:03.230>possible <00:04:03.346>allow <00:04:03.463>failure <00:04:03.579>for <00:04:03.696>that <00:04:03.813>type <00:04:03.930>is <00:04:04.046>the <00:04:04.163>literal <00:04:04.280>string.

72
00:04:06.700 --> 00:04:10.420
<00:04:06.700>Hello <00:04:06.799>worlds. <00:04:06.899>So <00:04:07.000>any <00:04:07.100>other <00:04:07.200>string <00:04:07.299>would <00:04:07.399>be <00:04:07.500>illegal. <00:04:07.600>You <00:04:07.700>can't <00:04:07.799>assign <00:04:07.899>it <00:04:08.000>to <00:04:08.100>its,

73
00:04:10.720 --> 00:04:15.300
<00:04:10.720>it <00:04:10.813>can <00:04:10.906>be <00:04:11.000>for <00:04:11.093>example, <00:04:11.186>useful <00:04:11.280>to <00:04:11.373>represent <00:04:11.466>AUMs. <00:04:11.560>Like <00:04:11.653>if <00:04:11.746>you <00:04:11.840>have <00:04:11.933>the <00:04:12.026>color <00:04:12.120>red,

74
00:04:15.300 --> 00:04:19.630
<00:04:15.300>green, <00:04:15.455>blue, <00:04:15.611>that's <00:04:15.766>how <00:04:15.922>you <00:04:16.077>would <00:04:16.233>uh, <00:04:16.388>represent <00:04:16.544>it. <00:04:16.700>Okay,

75
00:04:19.810 --> 00:04:23.190
<00:04:19.810>so <00:04:19.965>with <00:04:20.121>these <00:04:20.276>types <00:04:20.432>you <00:04:20.587>basically <00:04:20.743>have <00:04:20.898>a <00:04:21.054>very <00:04:21.209>simple,

76
00:04:23.300 --> 00:04:27.270
<00:04:23.300>like <00:04:23.400>we <00:04:23.500>just <00:04:23.600>added <00:04:23.700>types <00:04:23.800>to <00:04:23.900>JavaScript. <00:04:24.000>This <00:04:24.100>is <00:04:24.200>very <00:04:24.300>similar <00:04:24.400>to <00:04:24.500>Erbe <00:04:24.600>and <00:04:24.700>Ruby.

77
00:04:27.810 --> 00:04:31.910
<00:04:27.810>Uh, <00:04:27.910>p <00:04:28.010>s <00:04:28.110>P <00:04:28.210>has <00:04:28.310>types, <00:04:28.410>uh, <00:04:28.510>Python <00:04:28.610>has <00:04:28.710>types <00:04:28.810>like <00:04:28.910>l <00:04:29.010>ic <00:04:29.110>adding <00:04:29.210>types.

78
00:04:32.780 --> 00:04:37.110
<00:04:32.780>It's <00:04:32.880>not <00:04:32.979>different <00:04:33.080>than <00:04:33.179>any <00:04:33.280>of <00:04:33.380>these <00:04:33.479>types. <00:04:33.580>Um, <00:04:33.679>where <00:04:33.780>we <00:04:33.880>add <00:04:33.979>a <00:04:34.080>dynamic, <00:04:34.179>uh,

79
00:04:37.110 --> 00:04:40.670
<00:04:37.110>like <00:04:37.226>where <00:04:37.343>we <00:04:37.460>add <00:04:37.576>types <00:04:37.693>to <00:04:37.810>dynamic <00:04:37.926>language, <00:04:38.043>it's <00:04:38.160>not <00:04:38.276>different <00:04:38.393>so <00:04:38.510>far,

80
00:04:41.290 --> 00:04:44.390
<00:04:41.290>but <00:04:41.417>TypeScript <00:04:41.544>is <00:04:41.671>different <00:04:41.799>and <00:04:41.926>that's <00:04:42.053>what <00:04:42.180>this <00:04:42.308>next <00:04:42.435>section <00:04:42.562>is <00:04:42.690>about.

81
00:04:45.380 --> 00:04:48.280
<00:04:45.380>So <00:04:45.613>in <00:04:45.846>most <00:04:46.080>technically <00:04:46.313>compiled <00:04:46.546>languages, <00:04:46.780>um,

82
00:04:48.580 --> 00:04:53.560
<00:04:48.580>you <00:04:48.673>can <00:04:48.766>get <00:04:48.859>that <00:04:48.953>the <00:04:49.046>type <00:04:49.140>of <00:04:49.233>a <00:04:49.326>variable <00:04:49.419>at <00:04:49.513>compiled <00:04:49.606>time <00:04:49.700>using <00:04:49.793>in <00:04:49.886>Ava <00:04:49.979>annotation

83
00:04:53.560 --> 00:04:55.680
<00:04:53.560>processors <00:04:53.840>or <00:04:54.120>in <00:04:54.400>rust <00:04:54.680>with <00:04:54.960>macros.

84
00:04:56.180 --> 00:05:00.120
<00:04:56.180>And <00:04:56.280>also <00:04:56.380>at <00:04:56.480>runtime <00:04:56.580>you <00:04:56.680>can <00:04:56.780>get <00:04:56.880>the <00:04:56.980>type <00:04:57.080>of <00:04:57.180>a <00:04:57.280>variable <00:04:57.380>using <00:04:57.480>reflection <00:04:57.580>APIs

85
00:05:00.120 --> 00:05:02.360
<00:05:00.120>where <00:05:00.247>you <00:05:00.374>can <00:05:00.501>say <00:05:00.629>like <00:05:00.756>what <00:05:00.883>is <00:05:01.010>the <00:05:01.138>type <00:05:01.265>of <00:05:01.392>this <00:05:01.520>variable?

86
00:05:02.360 --> 00:05:06.560
<00:05:02.360>What <00:05:02.460>methods <00:05:02.560>does <00:05:02.660>it <00:05:02.760>have? <00:05:02.860>So <00:05:02.960>you <00:05:03.060>can <00:05:03.160>use <00:05:03.260>this, <00:05:03.360>um, <00:05:03.460>to <00:05:03.560>tweak <00:05:03.660>the <00:05:03.760>codes.

87
00:05:07.580 --> 00:05:11.560
<00:05:07.580>And <00:05:07.719>typescripts, <00:05:07.859>they <00:05:08.000>made <00:05:08.140>an <00:05:08.280>explicit <00:05:08.419>choice <00:05:08.560>to <00:05:08.700>not <00:05:08.840>allow, <00:05:08.979>um,

88
00:05:11.660 --> 00:05:14.600
<00:05:11.660>values <00:05:11.815>of <00:05:11.971>like <00:05:12.126>to <00:05:12.282>not <00:05:12.437>allow <00:05:12.593>types <00:05:12.748>at <00:05:12.904>run <00:05:13.060>type.

89
00:05:14.860 --> 00:05:19.160
<00:05:14.860>So <00:05:14.967>your <00:05:15.075>type <00:05:15.183>or <00:05:15.290>your <00:05:15.398>program <00:05:15.506>at <00:05:15.613>runtime <00:05:15.721>cannot <00:05:15.829>know <00:05:15.936>what <00:05:16.044>the <00:05:16.152>type <00:05:16.260>is.

90
00:05:19.460 --> 00:05:22.640
<00:05:19.460>And <00:05:19.560>the <00:05:19.659>reason <00:05:19.760>they <00:05:19.859>made <00:05:19.960>these <00:05:20.060>choice <00:05:20.159>is <00:05:20.260>because <00:05:20.359>they <00:05:20.460>don't <00:05:20.560>want <00:05:20.659>to <00:05:20.760>make <00:05:20.859>the

91
00:05:22.640 --> 00:05:25.680
<00:05:22.640>difference <00:05:22.780>between <00:05:22.919>Java <00:05:23.060>script <00:05:23.200>code <00:05:23.340>and <00:05:23.479>type <00:05:23.620>script <00:05:23.760>code <00:05:23.900>at <00:05:24.039>runtime.

92
00:05:26.260 --> 00:05:29.480
<00:05:26.260>So <00:05:26.415>by <00:05:26.571>stripping <00:05:26.726>the <00:05:26.882>types, <00:05:27.037>there <00:05:27.193>is <00:05:27.348>no <00:05:27.504>difference. <00:05:27.659>Um,

93
00:05:29.900 --> 00:05:34.720
<00:05:29.900>but <00:05:30.000>they <00:05:30.099>did <00:05:30.200>allow <00:05:30.299>to, <00:05:30.400>um, <00:05:30.500>get <00:05:30.599>the <00:05:30.700>type <00:05:30.799>of <00:05:30.900>a <00:05:31.000>program <00:05:31.099>in <00:05:31.200>type <00:05:31.299>plans.

94
00:05:35.100 --> 00:05:36.840
<00:05:35.100>So <00:05:35.300>you <00:05:35.500>can <00:05:35.700>use <00:05:35.900>the <00:05:36.100>type <00:05:36.300>of, <00:05:36.500>um,

95
00:05:38.470 --> 00:05:42.830
<00:05:38.470>keyboard <00:05:38.577>in <00:05:38.685>JavaScript <00:05:38.793>in <00:05:38.900>TypeScript <00:05:39.008>to <00:05:39.116>get <00:05:39.223>a <00:05:39.331>type <00:05:39.439>of <00:05:39.546>a <00:05:39.654>variable <00:05:39.762>into <00:05:39.870>type

96
00:05:42.830 --> 00:05:45.430
<00:05:42.830>plans. <00:05:42.969>So <00:05:43.109>you <00:05:43.250>have <00:05:43.390>a <00:05:43.530>variable <00:05:43.669>and <00:05:43.810>you <00:05:43.950>do <00:05:44.090>type <00:05:44.229>of,

97
00:05:45.490 --> 00:05:48.430
<00:05:45.490>and <00:05:45.606>then <00:05:45.723>you <00:05:45.840>know <00:05:45.956>what <00:05:46.073>the <00:05:46.190>type <00:05:46.306>will <00:05:46.423>be, <00:05:46.540>uh, <00:05:46.656>in <00:05:46.773>type <00:05:46.890>plans.

98
00:05:48.690 --> 00:05:53.150
<00:05:48.690>And <00:05:48.790>you <00:05:48.890>could <00:05:48.990>use <00:05:49.090>this <00:05:49.190>to <00:05:49.290>compute <00:05:49.390>types, <00:05:49.490>uh, <00:05:49.590>other <00:05:49.690>types <00:05:49.790>based <00:05:49.890>on <00:05:49.990>this <00:05:50.090>type.

99
00:05:53.570 --> 00:05:57.880
<00:05:53.570>And <00:05:53.677>this, <00:05:53.785>uh, <00:05:53.893>is <00:05:54.000>what <00:05:54.108>gives <00:05:54.216>the <00:05:54.323>key <00:05:54.431>power <00:05:54.539>to <00:05:54.646>typescripts <00:05:54.754>type <00:05:54.862>level <00:05:54.969>programming.

100
00:06:02.600 --> 00:06:05.380
<00:06:02.600>So <00:06:02.880>I <00:06:03.160>already <00:06:03.440>talked <00:06:03.720>about <00:06:04.000>generics,

101
00:06:05.800 --> 00:06:10.060
<00:06:05.800>but <00:06:05.907>let <00:06:06.015>me <00:06:06.123>write <00:06:06.230>it <00:06:06.338>slightly <00:06:06.446>different. <00:06:06.553>So <00:06:06.661>when <00:06:06.769>you <00:06:06.876>see <00:06:06.984>her <00:06:07.092>at <00:06:07.200>comments,

102
00:06:10.720 --> 00:06:14.540
<00:06:10.720>the <00:06:10.820>only <00:06:10.920>thing <00:06:11.020>I <00:06:11.120>moved <00:06:11.220>is <00:06:11.320>the <00:06:11.420>generic. <00:06:11.520>Uh, <00:06:11.620>I <00:06:11.720>moved <00:06:11.820>it <00:06:11.920>after <00:06:12.020>the <00:06:12.120>key,

103
00:06:14.600 --> 00:06:18.540
<00:06:14.600>the <00:06:14.727>eagle <00:06:14.854>sign <00:06:14.981>and <00:06:15.109>I <00:06:15.236>used <00:06:15.363>an <00:06:15.490>error, <00:06:15.618>uh, <00:06:15.745>a <00:06:15.872>different <00:06:16.000>error.

104
00:06:19.280 --> 00:06:23.860
<00:06:19.280>And <00:06:19.373>it <00:06:19.466>looks <00:06:19.559>a <00:06:19.653>lot <00:06:19.746>like <00:06:19.840>a <00:06:19.933>function <00:06:20.026>now <00:06:20.119>and <00:06:20.213>that's <00:06:20.306>exactly <00:06:20.400>because <00:06:20.493>of <00:06:20.586>this <00:06:20.679>entire

105
00:06:23.860 --> 00:06:28.090
<00:06:23.860>plans. <00:06:23.987>Generics <00:06:24.114>are <00:06:24.241>functions <00:06:24.369>and <00:06:24.496>that's <00:06:24.623>another <00:06:24.750>way <00:06:24.878>to <00:06:25.005>look <00:06:25.132>at <00:06:25.260>it.

106
00:06:28.350 --> 00:06:32.090
<00:06:28.350>So <00:06:28.477>when <00:06:28.604>we <00:06:28.731>call, <00:06:28.859>uh, <00:06:28.986>this <00:06:29.113>box <00:06:29.240>value, <00:06:29.368>we <00:06:29.495>call <00:06:29.622>it, <00:06:29.750>uh,

107
00:06:32.090 --> 00:06:36.130
<00:06:32.090>instead <00:06:32.206>of <00:06:32.323>with <00:06:32.440>coca <00:06:32.556>curly <00:06:32.673>braces, <00:06:32.790>with <00:06:32.906>angular <00:06:33.023>braces, <00:06:33.140>with <00:06:33.256>the <00:06:33.373>string <00:06:33.490>type,

108
00:06:36.230 --> 00:06:38.970
<00:06:36.230>we <00:06:36.370>get <00:06:36.510>exactly <00:06:36.650>this <00:06:36.790>back. <00:06:36.930>This <00:06:37.070>is <00:06:37.210>what <00:06:37.350>we <00:06:37.490>get <00:06:37.630>back.

109
00:06:39.150 --> 00:06:40.690
<00:06:39.150>And <00:06:39.427>that's <00:06:39.704>like <00:06:39.981>calling <00:06:40.258>the <00:06:40.536>function.

110
00:06:42.670 --> 00:06:46.120
<00:06:42.670>It's <00:06:42.777>a <00:06:42.885>really <00:06:42.993>different <00:06:43.100>way <00:06:43.208>to <00:06:43.316>look <00:06:43.423>at <00:06:43.531>it, <00:06:43.639>but <00:06:43.746>it's <00:06:43.854>exactly <00:06:43.962>the <00:06:44.070>same.

111
00:06:46.180 --> 00:06:50.680
<00:06:46.180>So <00:06:46.262>like <00:06:46.344>generics <00:06:46.427>are <00:06:46.509>a <00:06:46.591>way <00:06:46.674>to <00:06:46.756>take <00:06:46.838>one <00:06:46.921>or <00:06:47.003>more <00:06:47.085>types <00:06:47.168>as <00:06:47.250>an <00:06:47.332>argument <00:06:47.415>and <00:06:47.497>get <00:06:47.580>a

112
00:06:50.680 --> 00:06:55.140
<00:06:50.680>type <00:06:50.835>back, <00:06:50.991>uh, <00:06:51.146>as <00:06:51.302>a <00:06:51.457>return <00:06:51.613>type. <00:06:51.768>But <00:06:51.924>uh, <00:06:52.080>yeah,

113
00:06:55.440 --> 00:06:57.980
<00:06:55.440>and <00:06:55.615>even <00:06:55.790>type, <00:06:55.965>type <00:06:56.140>level <00:06:56.315>functions <00:06:56.490>can <00:06:56.665>have <00:06:56.840>arguments.

114
00:06:57.980 --> 00:07:01.060
<00:06:57.980>So <00:06:58.135>generics <00:06:58.291>can <00:06:58.446>have <00:06:58.602>type <00:06:58.757>bonds <00:06:58.913>using <00:06:59.068>the <00:06:59.224>extens <00:06:59.380>keywords,

115
00:07:01.640 --> 00:07:02.820
<00:07:01.640>but <00:07:01.852>if <00:07:02.064>we <00:07:02.277>write <00:07:02.489>it <00:07:02.702>differently,

116
00:07:03.080 --> 00:07:06.980
<00:07:03.080>we <00:07:03.180>can <00:07:03.280>use <00:07:03.380>the <00:07:03.479>colon <00:07:03.580>similar <00:07:03.680>to <00:07:03.780>how <00:07:03.880>we <00:07:03.979>would <00:07:04.080>use <00:07:04.180>it, <00:07:04.280>uh, <00:07:04.380>in <00:07:04.479>JavaScript.

117
00:07:07.360 --> 00:07:11.660
<00:07:07.360>So <00:07:07.453>like <00:07:07.546>basically <00:07:07.640>it's <00:07:07.733>saying <00:07:07.826>this <00:07:07.920>function <00:07:08.013>is <00:07:08.106>a <00:07:08.200>type <00:07:08.293>and <00:07:08.386>the <00:07:08.480>type <00:07:08.573>needs <00:07:08.666>to <00:07:08.760>be

118
00:07:12.620 --> 00:07:16.970
<00:07:12.620>somewhat <00:07:12.720>related <00:07:12.820>to <00:07:12.920>this <00:07:13.020>other <00:07:13.120>type. <00:07:13.220>It <00:07:13.320>needs <00:07:13.420>to <00:07:13.520>be <00:07:13.620>a <00:07:13.720>subtype <00:07:13.820>of <00:07:13.920>that. <00:07:14.020>Uh,

119
00:07:17.110 --> 00:07:20.570
<00:07:17.110>and <00:07:17.203>when <00:07:17.296>we <00:07:17.390>call <00:07:17.483>it <00:07:17.576>in, <00:07:17.670>in <00:07:17.763>practice, <00:07:17.856>so <00:07:17.950>for <00:07:18.043>example, <00:07:18.136>we <00:07:18.230>have <00:07:18.323>a <00:07:18.416>person <00:07:18.510>type,

120
00:07:21.230 --> 00:07:25.570
<00:07:21.230>if <00:07:21.312>we <00:07:21.394>do, <00:07:21.477>we <00:07:21.559>want <00:07:21.641>the <00:07:21.724>name <00:07:21.806>of <00:07:21.888>the <00:07:21.971>person <00:07:22.053>we <00:07:22.135>can <00:07:22.218>use <00:07:22.300>name <00:07:22.382>of, <00:07:22.465>and <00:07:22.547>then, <00:07:22.630>uh,

121
00:07:25.670 --> 00:07:29.010
<00:07:25.670>of <00:07:25.825>this <00:07:25.981>person <00:07:26.136>you'll <00:07:26.292>get <00:07:26.447>back <00:07:26.603>string <00:07:26.758>because <00:07:26.914>it <00:07:27.070>can,

122
00:07:29.150 --> 00:07:31.650
<00:07:29.150>the <00:07:29.289>possible <00:07:29.429>values <00:07:29.570>are <00:07:29.710>string, <00:07:29.849>but <00:07:29.989>if <00:07:30.130>you <00:07:30.270>want <00:07:30.409>to, <00:07:30.549>uh,

123
00:07:31.720 --> 00:07:33.450
<00:07:31.720>know <00:07:31.953>my <00:07:32.186>name <00:07:32.420>of <00:07:32.653>this <00:07:32.886>object <00:07:33.120>literal,

124
00:07:33.860 --> 00:07:37.930
<00:07:33.860>it'll <00:07:33.976>actually <00:07:34.093>get <00:07:34.210>back <00:07:34.326>the <00:07:34.443>string <00:07:34.560>literal <00:07:34.676>yas. <00:07:34.793>So <00:07:34.910>that's <00:07:35.026>how <00:07:35.143>powerful, <00:07:35.260>uh,

125
00:07:37.980 --> 00:07:42.410
<00:07:37.980>types <00:07:38.067>get <00:07:38.155>this. <00:07:38.242>And <00:07:38.330>then <00:07:38.417>if <00:07:38.505>we <00:07:38.592>were <00:07:38.680>to <00:07:38.767>use <00:07:38.855>it <00:07:38.942>with <00:07:39.030>a <00:07:39.117>type <00:07:39.205>that <00:07:39.292>doesn't <00:07:39.380>match,

126
00:07:42.550 --> 00:07:46.090
<00:07:42.550>we <00:07:42.725>get <00:07:42.900>a <00:07:43.075>type <00:07:43.250>error. <00:07:43.425>So <00:07:43.600>even <00:07:43.775>these <00:07:43.950>generics,

127
00:07:46.120 --> 00:07:48.050
<00:07:46.120>like <00:07:46.320>they <00:07:46.520>have <00:07:46.720>type <00:07:46.920>checking <00:07:47.120>at <00:07:47.320>type <00:07:47.520>level,

128
00:07:49.700 --> 00:07:54.680
<00:07:49.700>but <00:07:49.800>it's <00:07:49.900>not <00:07:50.000>only <00:07:50.099>functions <00:07:50.200>that <00:07:50.300>we <00:07:50.400>have, <00:07:50.500>we <00:07:50.599>also <00:07:50.700>have <00:07:50.800>if <00:07:50.900>statements. <00:07:51.000>Um, <00:07:51.099>the,

129
00:07:55.100 --> 00:07:58.440
<00:07:55.100>the <00:07:55.227>syntax <00:07:55.354>is <00:07:55.481>really <00:07:55.609>horrible <00:07:55.736>because <00:07:55.863>you <00:07:55.990>always <00:07:56.118>have <00:07:56.245>to <00:07:56.372>use <00:07:56.500>turnery,

130
00:07:58.530 --> 00:08:03.320
<00:07:58.530>especially <00:07:58.637>if <00:07:58.745>you <00:07:58.853>have <00:07:58.960>to <00:07:59.068>nest <00:07:59.176>these <00:07:59.283>like <00:07:59.391>it <00:07:59.499>gets <00:07:59.606>ugly <00:07:59.714>uh, <00:07:59.822>very <00:07:59.929>quickly.

131
00:08:03.860 --> 00:08:08.160
<00:08:03.860>Um, <00:08:03.976>but <00:08:04.093>the <00:08:04.210>form <00:08:04.326>is <00:08:04.443>A <00:08:04.560>extends <00:08:04.676>B <00:08:04.793>question <00:08:04.910>mark, <00:08:05.026>C <00:08:05.143>column <00:08:05.260>D.

132
00:08:08.540 --> 00:08:12.720
<00:08:08.540>And <00:08:08.656>basically <00:08:08.773>it <00:08:08.890>means <00:08:09.006>if <00:08:09.123>A <00:08:09.240>is <00:08:09.356>a <00:08:09.473>subtype <00:08:09.590>of <00:08:09.706>B. <00:08:09.823>So <00:08:09.940>um,

133
00:08:14.190 --> 00:08:16.440
<00:08:14.190>then <00:08:14.390>we <00:08:14.590>get <00:08:14.790>the <00:08:14.990>type <00:08:15.190>C, <00:08:15.390>oh, <00:08:15.590>sorry,

134
00:08:17.030 --> 00:08:20.560
<00:08:17.030>then <00:08:17.117>we <00:08:17.205>get <00:08:17.292>the <00:08:17.380>type <00:08:17.467>C <00:08:17.554>back <00:08:17.642>and <00:08:17.729>otherwise <00:08:17.817>we <00:08:17.905>get <00:08:17.992>the <00:08:18.080>type <00:08:18.167>D <00:08:18.255>back. <00:08:18.342>So <00:08:18.429>again,

135
00:08:20.560 --> 00:08:24.360
<00:08:20.560>if <00:08:20.653>you <00:08:20.746>look <00:08:20.840>at <00:08:20.933>the <00:08:21.026>comments, <00:08:21.120>it's <00:08:21.213>kind <00:08:21.306>of <00:08:21.400>like <00:08:21.493>this. <00:08:21.586>If <00:08:21.680>T <00:08:21.773>is <00:08:21.866>a <00:08:21.960>person,

136
00:08:25.020 --> 00:08:29.540
<00:08:25.020>we <00:08:25.159>return <00:08:25.299>name <00:08:25.440>of <00:08:25.580>T <00:08:25.719>otherwise <00:08:25.859>return. <00:08:26.000>So <00:08:26.140>this <00:08:26.280>is, <00:08:26.419>um,

137
00:08:29.850 --> 00:08:32.300
<00:08:29.850>very <00:08:30.050>similar <00:08:30.250>uh, <00:08:30.450>to <00:08:30.650>the <00:08:30.850>above, <00:08:31.050>but <00:08:31.250>again,

138
00:08:32.420 --> 00:08:36.490
<00:08:32.419>a <00:08:32.559>bit <00:08:32.699>more <00:08:32.839>verbose <00:08:32.979>and <00:08:33.120>a <00:08:33.260>bit <00:08:33.400>more <00:08:33.539>nicer <00:08:33.679>syntax. <00:08:33.819>Um,

139
00:08:36.960 --> 00:08:40.730
<00:08:36.960>it's <00:08:37.060>not <00:08:37.160>just <00:08:37.260>if <00:08:37.360>statements <00:08:37.460>and <00:08:37.560>functions <00:08:37.660>we <00:08:37.760>have, <00:08:37.860>we <00:08:37.960>also <00:08:38.060>have <00:08:38.160>while <00:08:38.260>loops, <00:08:38.360>uh,

140
00:08:40.740 --> 00:08:44.090
<00:08:40.740>using <00:08:40.833>recursion. <00:08:40.926>So <00:08:41.020>this <00:08:41.113>is <00:08:41.206>a <00:08:41.299>very <00:08:41.393>large <00:08:41.486>example, <00:08:41.580>you <00:08:41.673>don't <00:08:41.766>need <00:08:41.860>to <00:08:41.953>look <00:08:42.046>at <00:08:42.140>it.

141
00:08:44.230 --> 00:08:47.490
<00:08:44.230>The <00:08:44.337>most <00:08:44.445>important <00:08:44.553>thing <00:08:44.660>you <00:08:44.768>need <00:08:44.876>to <00:08:44.983>look <00:08:45.091>at <00:08:45.199>is <00:08:45.306>actually <00:08:45.414>the <00:08:45.522>highlighted <00:08:45.630>lines

142
00:08:47.860 --> 00:08:50.210
<00:08:47.860>where <00:08:48.035>you <00:08:48.210>see <00:08:48.385>that <00:08:48.560>the <00:08:48.735>generic <00:08:48.910>is <00:08:49.085>called <00:08:49.260>again.

143
00:08:50.670 --> 00:08:54.450
<00:08:50.670>So <00:08:50.797>it's <00:08:50.924>calling <00:08:51.051>the <00:08:51.179>same <00:08:51.306>generic <00:08:51.433>from <00:08:51.560>the <00:08:51.688>body, <00:08:51.815>which <00:08:51.942>is <00:08:52.069>recursion.

144
00:08:54.750 --> 00:08:57.600
<00:08:54.750>And <00:08:54.877>basically <00:08:55.004>you <00:08:55.131>can <00:08:55.259>keep <00:08:55.386>looping <00:08:55.513>this <00:08:55.640>until <00:08:55.768>you <00:08:55.895>have <00:08:56.022>your <00:08:56.150>results.

145
00:08:57.820 --> 00:09:01.280
<00:08:57.820>And <00:08:57.960>that's <00:08:58.100>what <00:08:58.240>a <00:08:58.380>aval <00:08:58.520>loop <00:08:58.660>does. <00:08:58.800>Like <00:08:58.940>infinite <00:08:59.080>loop, <00:08:59.220>um,

146
00:09:01.660 --> 00:09:04.720
<00:09:01.660>it <00:09:01.800>types <00:09:01.939>is <00:09:02.079>taking <00:09:02.219>a <00:09:02.360>lot <00:09:02.500>of <00:09:02.640>things <00:09:02.780>from <00:09:02.920>functional <00:09:03.060>programming.

147
00:09:04.740 --> 00:09:06.760
<00:09:04.740>So <00:09:04.940>if <00:09:05.140>you're <00:09:05.340>not <00:09:05.540>used <00:09:05.740>to <00:09:05.940>functional <00:09:06.140>programming,

148
00:09:06.920 --> 00:09:10.720
<00:09:06.920>a <00:09:07.020>lot <00:09:07.120>of <00:09:07.219>these <00:09:07.319>things <00:09:07.420>might <00:09:07.520>look <00:09:07.620>very <00:09:07.719>weird <00:09:07.819>and <00:09:07.920>like <00:09:08.020>it's <00:09:08.120>a <00:09:08.219>different <00:09:08.319>paradigm,

149
00:09:10.720 --> 00:09:13.560
<00:09:10.720>that's <00:09:10.895>for <00:09:11.070>sure. <00:09:11.245>Uh, <00:09:11.420>the <00:09:11.595>syntax <00:09:11.770>is <00:09:11.945>also <00:09:12.120>horrible,

150
00:09:13.660 --> 00:09:18.390
<00:09:13.660>but <00:09:13.776>we <00:09:13.893>have <00:09:14.010>a <00:09:14.126>a <00:09:14.243>value <00:09:14.360>loop <00:09:14.476>kind <00:09:14.593>of <00:09:14.709>concept <00:09:14.826>in <00:09:14.943>here. <00:09:15.060>Um,

151
00:09:18.730 --> 00:09:22.230
<00:09:18.730>we <00:09:18.837>also <00:09:18.945>have <00:09:19.053>a <00:09:19.160>for <00:09:19.268>loop. <00:09:19.376>You <00:09:19.483>can <00:09:19.591>implement <00:09:19.699>it <00:09:19.806>through <00:09:19.914>using <00:09:20.022>recursion, <00:09:20.130>uh,

152
00:09:22.250 --> 00:09:27.110
<00:09:22.250>if <00:09:22.337>you <00:09:22.425>want <00:09:22.512>or <00:09:22.600>you <00:09:22.687>can <00:09:22.775>use <00:09:22.862>what <00:09:22.950>they <00:09:23.037>call <00:09:23.125>mapped <00:09:23.212>types <00:09:23.300>where <00:09:23.387>we <00:09:23.475>can <00:09:23.562>map <00:09:23.650>an

153
00:09:27.110 --> 00:09:30.910
<00:09:27.110>union <00:09:27.217>to <00:09:27.325>an <00:09:27.433>object <00:09:27.540>or <00:09:27.648>back <00:09:27.756>to <00:09:27.863>union. <00:09:27.971>So <00:09:28.079>this <00:09:28.186>is, <00:09:28.294>uh, <00:09:28.402>an <00:09:28.510>example.

154
00:09:31.730 --> 00:09:35.470
<00:09:31.730>So <00:09:31.870>we <00:09:32.010>have <00:09:32.150>op <00:09:32.290>option <00:09:32.430>names, <00:09:32.570>uh, <00:09:32.710>enable <00:09:32.850>AI <00:09:32.990>enable <00:09:33.130>music,

155
00:09:35.610 --> 00:09:39.150
<00:09:35.610>but <00:09:35.717>we <00:09:35.825>actually <00:09:35.933>want <00:09:36.040>to <00:09:36.148>have <00:09:36.256>like <00:09:36.363>an <00:09:36.471>object <00:09:36.579>records <00:09:36.686>where <00:09:36.794>for <00:09:36.902>every, <00:09:37.010>uh,

156
00:09:39.170 --> 00:09:42.590
<00:09:39.170>option <00:09:39.277>we <00:09:39.385>have <00:09:39.493>like <00:09:39.600>a <00:09:39.708>bullion, <00:09:39.816>uh, <00:09:39.923>that <00:09:40.031>says <00:09:40.139>where <00:09:40.246>the <00:09:40.354>feature <00:09:40.462>is <00:09:40.569>enabled.

157
00:09:42.980 --> 00:09:46.550
<00:09:42.980>What <00:09:43.067>we <00:09:43.155>can <00:09:43.242>do <00:09:43.330>is, <00:09:43.417>uh, <00:09:43.505>let's <00:09:43.592>skip <00:09:43.680>over <00:09:43.767>the <00:09:43.855>task <00:09:43.942>thing, <00:09:44.030>but <00:09:44.117>look <00:09:44.205>at <00:09:44.292>the <00:09:44.380>um,

158
00:09:47.130 --> 00:09:50.670
<00:09:47.130>co <00:09:47.285>comments <00:09:47.441>like <00:09:47.596>this <00:09:47.752>looks <00:09:47.907>a <00:09:48.063>lot <00:09:48.218>like <00:09:48.374>dictionary, <00:09:48.530>um,

159
00:09:50.820 --> 00:09:54.630
<00:09:50.820>comprehension <00:09:51.020>in <00:09:51.220>Python, <00:09:51.420>like <00:09:51.620>for <00:09:51.820>every <00:09:52.020>option, <00:09:52.220>uh,

160
00:09:54.740 --> 00:09:58.310
<00:09:54.740>it's <00:09:54.856>a <00:09:54.973>bullion <00:09:55.090>for <00:09:55.206>T <00:09:55.323>optioning <00:09:55.440>option. <00:09:55.556>So <00:09:55.673>for <00:09:55.790>every <00:09:55.906>option <00:09:56.023>we <00:09:56.140>have,

161
00:09:58.730 --> 00:10:03.430
<00:09:58.730>we <00:09:58.830>want <00:09:58.930>to <00:09:59.030>have <00:09:59.130>a <00:09:59.230>a <00:09:59.330>bullion <00:09:59.430>and <00:09:59.530>that's <00:09:59.630>how <00:09:59.730>we <00:09:59.830>map <00:09:59.930>to <00:10:00.030>um, <00:10:00.130>records.

162
00:10:03.610 --> 00:10:06.070
<00:10:03.610>But <00:10:03.785>we <00:10:03.960>can <00:10:04.135>also <00:10:04.310>map <00:10:04.485>back <00:10:04.660>to <00:10:04.835>uh, <00:10:05.010>unions.

163
00:10:06.210 --> 00:10:10.470
<00:10:06.210>So <00:10:06.297>we <00:10:06.385>imagine <00:10:06.472>that <00:10:06.560>we <00:10:06.647>have <00:10:06.735>the <00:10:06.822>features <00:10:06.910>in <00:10:06.997>AI <00:10:07.085>and <00:10:07.172>music <00:10:07.260>and <00:10:07.347>we <00:10:07.435>want <00:10:07.522>to <00:10:07.610>basically

164
00:10:10.470 --> 00:10:13.070
<00:10:10.470>have <00:10:10.645>like <00:10:10.820>a <00:10:10.995>union <00:10:11.170>of <00:10:11.345>enabled <00:10:11.520>AI <00:10:11.695>enabled <00:10:11.870>music.

165
00:10:13.490 --> 00:10:17.190
<00:10:13.490>We <00:10:13.590>can <00:10:13.690>do <00:10:13.790>something <00:10:13.890>similar <00:10:13.990>where <00:10:14.090>we <00:10:14.190>say <00:10:14.290>for <00:10:14.390>every <00:10:14.490>feature <00:10:14.590>we <00:10:14.690>want <00:10:14.790>to <00:10:14.890>have

166
00:10:17.190 --> 00:10:21.830
<00:10:17.190>enabled <00:10:17.306>the <00:10:17.423>feature, <00:10:17.540>uh, <00:10:17.656>as <00:10:17.773>a <00:10:17.890>string. <00:10:18.006>And <00:10:18.123>what's <00:10:18.240>really <00:10:18.356>powerful <00:10:18.473>is <00:10:18.590>here,

167
00:10:22.300 --> 00:10:27.030
<00:10:22.300>this <00:10:22.416>is <00:10:22.533>string <00:10:22.650>uh, <00:10:22.766>templating <00:10:22.883>in <00:10:23.000>types, <00:10:23.116>like <00:10:23.233>this <00:10:23.349>is <00:10:23.466>not <00:10:23.583>failure <00:10:23.699>land,

168
00:10:27.030 --> 00:10:31.590
<00:10:27.030>this <00:10:27.130>is <00:10:27.230>types <00:10:27.329>like <00:10:27.430>they <00:10:27.530>really <00:10:27.630>are <00:10:27.730>building <00:10:27.829>a <00:10:27.930>lot <00:10:28.030>of <00:10:28.130>features <00:10:28.230>that <00:10:28.329>you <00:10:28.430>expect

169
00:10:31.590 --> 00:10:35.230
<00:10:31.590>from <00:10:31.745>a <00:10:31.901>language <00:10:32.056>into <00:10:32.212>the <00:10:32.367>type <00:10:32.523>system <00:10:32.678>and <00:10:32.834>it's <00:10:32.990>really,

170
00:10:35.230 --> 00:10:39.070
<00:10:35.230>really <00:10:35.337>powerful <00:10:35.445>and <00:10:35.553>it's <00:10:35.660>really <00:10:35.768>insane <00:10:35.876>and <00:10:35.983>I <00:10:36.091>think <00:10:36.199>many <00:10:36.306>people <00:10:36.414>are <00:10:36.522>not <00:10:36.630>really

171
00:10:39.110 --> 00:10:41.110
<00:10:39.110>grasping <00:10:39.390>how <00:10:39.670>powerful <00:10:39.950>this <00:10:40.230>can <00:10:40.510>be.

172
00:10:42.500 --> 00:10:44.240
<00:10:42.500>So <00:10:42.966>in <00:10:43.433>general <00:10:43.900>type,

173
00:10:44.240 --> 00:10:48.120
<00:10:44.240>having <00:10:44.347>programming <00:10:44.455>is <00:10:44.563>the <00:10:44.670>idea <00:10:44.778>that <00:10:44.886>you <00:10:44.993>program <00:10:45.101>with <00:10:45.209>types <00:10:45.316>to <00:10:45.424>build <00:10:45.532>more <00:10:45.640>complex

174
00:10:48.120 --> 00:10:52.960
<00:10:48.120>types <00:10:48.275>and <00:10:48.431>really <00:10:48.586>the <00:10:48.742>combination <00:10:48.897>of <00:10:49.053>inferring <00:10:49.208>types <00:10:49.364>and <00:10:49.520>values,

175
00:10:53.340 --> 00:10:54.480
<00:10:53.340>having <00:10:53.853>conditional <00:10:54.366>types,

176
00:10:54.480 --> 00:10:58.920
<00:10:54.480>having <00:10:54.596>these <00:10:54.713>loops <00:10:54.830>through <00:10:54.946>map <00:10:55.063>types <00:10:55.180>and <00:10:55.296>recursion <00:10:55.413>like <00:10:55.530>makes <00:10:55.646>it <00:10:55.763>so <00:10:55.880>powerful

177
00:10:59.110 --> 00:11:00.360
<00:10:59.110>that <00:10:59.672>it's <00:11:00.235>insane.

178
00:11:01.150 --> 00:11:05.480
<00:11:01.150>It's <00:11:01.257>even <00:11:01.365>so <00:11:01.473>that <00:11:01.580>the <00:11:01.688>types <00:11:01.796>get <00:11:01.903>types <00:11:02.011>system <00:11:02.119>is <00:11:02.226>during <00:11:02.334>completes <00:11:02.442>that's <00:11:02.550>proven.

179
00:11:06.180 --> 00:11:08.000
<00:11:06.180>So <00:11:06.380>like <00:11:06.579>there <00:11:06.780>have <00:11:06.979>been <00:11:07.180>JSON <00:11:07.380>pars <00:11:07.579>types,

180
00:11:08.010 --> 00:11:11.120
<00:11:08.010>there <00:11:08.137>have <00:11:08.264>been <00:11:08.391>like <00:11:08.519>actually <00:11:08.646>somebody <00:11:08.773>making <00:11:08.900>a <00:11:09.028>Turing <00:11:09.155>machine <00:11:09.282>in <00:11:09.410>TypeScript

181
00:11:11.120 --> 00:11:13.280
<00:11:11.120>types. <00:11:11.295>Uh, <00:11:11.470>I'm <00:11:11.645>not <00:11:11.820>sure <00:11:11.995>how <00:11:12.170>long <00:11:12.345>it <00:11:12.520>took,

182
00:11:13.300 --> 00:11:17.080
<00:11:13.300>but <00:11:13.579>that's <00:11:13.859>really <00:11:14.140>insane <00:11:14.420>in <00:11:14.699>general,

183
00:11:17.190 --> 00:11:20.120
<00:11:17.190>it's <00:11:17.277>a <00:11:17.365>new <00:11:17.452>paradigm <00:11:17.540>you <00:11:17.627>have <00:11:17.715>to <00:11:17.802>think <00:11:17.890>about <00:11:17.977>if <00:11:18.065>you <00:11:18.152>want <00:11:18.240>to <00:11:18.327>program <00:11:18.415>in <00:11:18.502>it <00:11:18.590>because

184
00:11:20.230 --> 00:11:22.240
<00:11:20.230>it's <00:11:20.405>a <00:11:20.580>bit <00:11:20.755>functional <00:11:20.930>programming, <00:11:21.105>it's <00:11:21.280>set <00:11:21.455>based <00:11:21.630>programming,

185
00:11:22.240 --> 00:11:23.073
<00:11:22.240>it's <00:11:22.489>a <00:11:22.739>bit <00:11:22.989>different,

186
00:11:23.420 --> 00:11:26.920
<00:11:23.420>but <00:11:23.536>in <00:11:23.653>my <00:11:23.770>opinion <00:11:23.886>it's <00:11:24.003>still <00:11:24.120>easier <00:11:24.236>than <00:11:24.353>macros <00:11:24.469>because <00:11:24.586>you're <00:11:24.703>still <00:11:24.819>getting

187
00:11:27.280 --> 00:11:28.560
<00:11:27.280>functions. <00:11:27.510>You <00:11:27.740>still <00:11:27.971>have <00:11:28.201>if <00:11:28.431>statements,

188
00:11:28.560 --> 00:11:32.120
<00:11:28.560>you <00:11:28.687>still <00:11:28.814>have <00:11:28.941>like <00:11:29.069>precursion <00:11:29.196>that <00:11:29.323>you <00:11:29.450>might <00:11:29.578>know <00:11:29.705>from <00:11:29.832>normal <00:11:29.959>programming

189
00:11:32.240 --> 00:11:36.360
<00:11:32.240>languages. <00:11:32.415>It's <00:11:32.590>not, <00:11:32.765>uh, <00:11:32.940>as <00:11:33.115>different <00:11:33.290>in <00:11:33.465>general. <00:11:33.640>Uh,

190
00:11:36.440 --> 00:11:39.640
<00:11:36.440>I <00:11:36.533>would <00:11:36.626>say <00:11:36.720>that <00:11:36.813>synex <00:11:36.906>is <00:11:37.000>not <00:11:37.093>ideal <00:11:37.186>and <00:11:37.280>that's <00:11:37.373>I <00:11:37.466>hope <00:11:37.560>my <00:11:37.653>message <00:11:37.746>to <00:11:37.840>the

191
00:11:39.640 --> 00:11:43.040
<00:11:39.640>typescripts. <00:11:40.106>Um, <00:11:40.573>yeah, <00:11:41.040>uh,

192
00:11:43.120 --> 00:11:47.440
<00:11:43.120>builders <00:11:43.227>to <00:11:43.335>maybe <00:11:43.443>make <00:11:43.550>better <00:11:43.658>syntax <00:11:43.766>that's <00:11:43.873>a <00:11:43.981>bit <00:11:44.089>easier <00:11:44.196>and <00:11:44.304>more <00:11:44.412>friendly <00:11:44.520>to

193
00:11:47.600 --> 00:11:49.390
<00:11:47.600>beginners. <00:11:49.000>Um,

194
00:11:50.050 --> 00:11:54.360
<00:11:50.050>and <00:11:50.150>I <00:11:50.250>would <00:11:50.349>say <00:11:50.449>that <00:11:50.550>is <00:11:50.650>really <00:11:50.750>a <00:11:50.849>spectrum <00:11:50.949>like <00:11:51.050>in <00:11:51.150>TypeScript <00:11:51.250>you <00:11:51.349>can <00:11:51.449>make

195
00:11:54.360 --> 00:11:57.960
<00:11:54.360>programs <00:11:54.535>that <00:11:54.710>are <00:11:54.885>basically <00:11:55.060>JavaScripts <00:11:55.235>like <00:11:55.410>you <00:11:55.585>just, <00:11:55.760>you,

196
00:11:57.980 --> 00:11:59.960
<00:11:57.980>you <00:11:58.155>can <00:11:58.330>say <00:11:58.505>to <00:11:58.680>the <00:11:58.855>compiler, <00:11:59.030>this <00:11:59.205>is <00:11:59.380>fine,

197
00:11:59.960 --> 00:12:03.640
<00:11:59.960>this <00:12:00.100>is <00:12:00.240>fine <00:12:00.380>and <00:12:00.520>everything <00:12:00.660>is <00:12:00.800>is <00:12:00.940>not <00:12:01.080>typed. <00:12:01.220>That's <00:12:01.360>possible.

198
00:12:04.060 --> 00:12:07.360
<00:12:04.060>You <00:12:04.176>can <00:12:04.293>also <00:12:04.410>go <00:12:04.526>to <00:12:04.643>just <00:12:04.760>like <00:12:04.876>JavaScript <00:12:04.993>plus <00:12:05.109>types <00:12:05.226>like <00:12:05.343>in <00:12:05.459>Python,

199
00:12:07.470 --> 00:12:10.560
<00:12:07.470>like <00:12:07.625>in <00:12:07.781>ruby <00:12:07.936>like <00:12:08.092>in <00:12:08.247>many <00:12:08.403>other <00:12:08.558>dynamically <00:12:08.714>type <00:12:08.870>languages.

200
00:12:10.900 --> 00:12:14.280
<00:12:10.900>Or <00:12:11.016>you <00:12:11.133>can <00:12:11.250>go <00:12:11.366>to <00:12:11.483>like <00:12:11.600>extremely <00:12:11.716>types <00:12:11.833>of <00:12:11.949>APIs <00:12:12.066>even <00:12:12.183>for <00:12:12.300>the,

201
00:12:14.980 --> 00:12:16.880
<00:12:14.980>and <00:12:15.120>that's <00:12:15.260>what <00:12:15.400>we <00:12:15.540>are <00:12:15.680>going <00:12:15.820>to <00:12:15.960>be <00:12:16.100>talking <00:12:16.240>about <00:12:16.380>next.

202
00:12:22.390 --> 00:12:23.690
<00:12:22.390>So <00:12:22.975>input <00:12:23.560>validation,

203
00:12:24.560 --> 00:12:28.170
<00:12:24.560>this <00:12:24.676>is <00:12:24.793>basically <00:12:24.910>the <00:12:25.026>problem <00:12:25.143>where <00:12:25.260>if <00:12:25.376>you <00:12:25.493>have <00:12:25.609>any <00:12:25.726>data <00:12:25.843>crossing <00:12:25.959>boundaries,

204
00:12:28.390 --> 00:12:29.170
<00:12:28.390>you <00:12:28.624>can't <00:12:28.858>trust <00:12:29.092>it.

205
00:12:29.170 --> 00:12:32.130
<00:12:29.170>So <00:12:29.263>you <00:12:29.356>want <00:12:29.449>to <00:12:29.543>validate <00:12:29.636>that <00:12:29.729>the <00:12:29.823>data <00:12:29.916>you <00:12:30.010>have <00:12:30.103>is <00:12:30.196>actually <00:12:30.290>what <00:12:30.383>you <00:12:30.476>expect <00:12:30.569>to

206
00:12:32.130 --> 00:12:36.540
<00:12:32.130>be. <00:12:32.237>And <00:12:32.345>the <00:12:32.453>big <00:12:32.560>problem <00:12:32.668>is <00:12:32.776>that <00:12:32.883>there <00:12:32.991>is <00:12:33.099>a <00:12:33.206>mismatch <00:12:33.314>between <00:12:33.422>your <00:12:33.530>validation

207
00:12:36.820 --> 00:12:39.860
<00:12:36.820>functions <00:12:36.975>and <00:12:37.131>your <00:12:37.286>types <00:12:37.442>if <00:12:37.597>you <00:12:37.753>annotate <00:12:37.908>them, <00:12:38.064>uh, <00:12:38.220>separately.

208
00:12:40.320 --> 00:12:42.380
<00:12:40.320>And <00:12:40.520>so <00:12:40.720>for <00:12:40.920>example, <00:12:41.120>this <00:12:41.320>is <00:12:41.520>a, <00:12:41.720>um,

209
00:12:42.730 --> 00:12:46.900
<00:12:42.730>example <00:12:42.846>from <00:12:42.963>class <00:12:43.080>validator <00:12:43.196>from <00:12:43.313>an <00:12:43.430>old <00:12:43.546>version <00:12:43.663>where <00:12:43.780>there <00:12:43.896>is <00:12:44.013>a <00:12:44.130>mismatch

210
00:12:46.900 --> 00:12:48.300
<00:12:46.900>between <00:12:47.214>this <00:12:47.530>number <00:12:47.844>and <00:12:48.160>string.

211
00:12:48.850 --> 00:12:52.030
<00:12:48.850>Like <00:12:49.005>at <00:12:49.161>runtime <00:12:49.316>it <00:12:49.472>would <00:12:49.627>check <00:12:49.783>whether <00:12:49.938>it's <00:12:50.094>a <00:12:50.250>number,

212
00:12:52.050 --> 00:12:55.190
<00:12:52.050>but <00:12:52.143>you're <00:12:52.236>thinking <00:12:52.329>it's <00:12:52.423>a <00:12:52.516>string. <00:12:52.609>So <00:12:52.703>there <00:12:52.796>is <00:12:52.890>a <00:12:52.983>mismatch <00:12:53.076>and <00:12:53.170>you <00:12:53.263>will <00:12:53.356>get <00:12:53.449>bug.

213
00:12:55.690 --> 00:12:57.070
<00:12:55.690>That's <00:12:55.938>something <00:12:56.186>we <00:12:56.435>want <00:12:56.683>to <00:12:56.932>avoid.

214
00:12:57.820 --> 00:13:02.080
<00:12:57.820>And <00:12:57.927>the <00:12:58.035>idea <00:12:58.143>is <00:12:58.250>that <00:12:58.358>we <00:12:58.466>can <00:12:58.573>infer <00:12:58.681>the <00:12:58.789>type <00:12:58.896>from <00:12:59.004>the <00:12:59.112>validator. <00:12:59.220>Uh,

215
00:13:02.380 --> 00:13:06.860
<00:13:02.380>and <00:13:02.507>this <00:13:02.634>is <00:13:02.761>like <00:13:02.889>what <00:13:03.016>some <00:13:03.143>people <00:13:03.270>call <00:13:03.398>parsh <00:13:03.525>don't <00:13:03.652>validate. <00:13:03.780>So,

216
00:13:07.400 --> 00:13:09.700
<00:13:07.400>um, <00:13:07.600>this <00:13:07.800>is <00:13:08.000>code <00:13:08.199>from <00:13:08.400>the <00:13:08.600>Zot <00:13:08.800>library.

217
00:13:10.280 --> 00:13:14.660
<00:13:10.280>So <00:13:10.407>we <00:13:10.534>define <00:13:10.661>a <00:13:10.789>validator <00:13:10.916>called <00:13:11.043>person <00:13:11.170>and <00:13:11.298>we <00:13:11.425>say <00:13:11.552>like <00:13:11.680>everything

218
00:13:14.920 --> 00:13:19.830
<00:13:14.920>that's <00:13:15.013>a <00:13:15.106>valid <00:13:15.199>person <00:13:15.293>is <00:13:15.386>an <00:13:15.479>object <00:13:15.573>and <00:13:15.666>every <00:13:15.760>those <00:13:15.853>objects <00:13:15.946>need <00:13:16.040>to <00:13:16.133>have <00:13:16.226>a <00:13:16.319>name

219
00:13:19.830 --> 00:13:21.430
<00:13:19.830>and <00:13:20.110>an <00:13:20.390>H <00:13:20.670>and <00:13:20.950>they <00:13:21.230>need,

220
00:13:21.430 --> 00:13:23.870
<00:13:21.430>the <00:13:21.530>name <00:13:21.630>needs <00:13:21.729>to <00:13:21.829>be <00:13:21.930>a <00:13:22.030>string <00:13:22.130>and <00:13:22.229>a <00:13:22.329>h <00:13:22.430>needs <00:13:22.530>to <00:13:22.630>be <00:13:22.729>a <00:13:22.829>number.

221
00:13:24.760 --> 00:13:27.450
<00:13:24.760>Then <00:13:24.900>we <00:13:25.040>can <00:13:25.180>use <00:13:25.319>that <00:13:25.460>person <00:13:25.600>to <00:13:25.740>parse <00:13:25.880>a <00:13:26.020>certain <00:13:26.160>object.

222
00:13:28.070 --> 00:13:31.250
<00:13:28.070>And <00:13:28.270>this <00:13:28.470>me <00:13:28.670>type <00:13:28.870>will <00:13:29.070>be <00:13:29.270>correctly, <00:13:29.470>uh,

223
00:13:31.940 --> 00:13:36.490
<00:13:31.940>typed <00:13:32.067>like <00:13:32.194>what <00:13:32.321>you <00:13:32.449>expect <00:13:32.576>it <00:13:32.703>to <00:13:32.830>be <00:13:32.958>without <00:13:33.085>any <00:13:33.212>type <00:13:33.340>annotations,

224
00:13:36.790 --> 00:13:40.290
<00:13:36.790>uh, <00:13:36.897>as <00:13:37.005>you <00:13:37.113>might <00:13:37.220>see. <00:13:37.328>And <00:13:37.436>then <00:13:37.543>if <00:13:37.651>we <00:13:37.759>do <00:13:37.866>like <00:13:37.974>a <00:13:38.082>different <00:13:38.189>shape,

225
00:13:40.540 --> 00:13:43.490
<00:13:40.540>it'll <00:13:40.680>throw <00:13:40.819>an <00:13:40.959>error. <00:13:41.099>And <00:13:41.240>so <00:13:41.380>we <00:13:41.520>know <00:13:41.660>that <00:13:41.800>if <00:13:41.939>me,

226
00:13:43.870 --> 00:13:47.370
<00:13:43.870>if <00:13:43.952>we <00:13:44.034>get <00:13:44.117>a <00:13:44.199>me <00:13:44.281>variable <00:13:44.364>that <00:13:44.446>it's <00:13:44.528>of <00:13:44.611>a <00:13:44.693>certain <00:13:44.775>type <00:13:44.858>and <00:13:44.940>that <00:13:45.022>the <00:13:45.105>type <00:13:45.187>we <00:13:45.270>expect

227
00:13:47.370 --> 00:13:50.690
<00:13:47.370>it <00:13:47.486>to <00:13:47.603>be. <00:13:47.720>And <00:13:47.836>if <00:13:47.953>we <00:13:48.070>need <00:13:48.186>a <00:13:48.303>type <00:13:48.420>in <00:13:48.536>type <00:13:48.653>system <00:13:48.770>lens,

228
00:13:50.840 --> 00:13:52.450
<00:13:50.840>like <00:13:51.190>we <00:13:51.540>can <00:13:51.890>use <00:13:52.240>um,

229
00:13:53.030 --> 00:13:57.410
<00:13:53.030>the <00:13:53.130>type <00:13:53.230>of <00:13:53.329>keyboards <00:13:53.430>to <00:13:53.530>actually <00:13:53.630>get <00:13:53.730>the <00:13:53.829>type <00:13:53.930>of <00:13:54.030>the <00:13:54.130>validator <00:13:54.230>and <00:13:54.329>then <00:13:54.430>infer

230
00:13:57.430 --> 00:13:58.410
<00:13:57.430>the <00:13:57.723>type <00:13:58.017>of, <00:13:58.312>uh,

231
00:13:58.550 --> 00:14:01.650
<00:13:58.550>the <00:13:58.650>person <00:13:58.750>and <00:13:58.849>this <00:13:58.949>person <00:13:59.050>type <00:13:59.150>will <00:13:59.250>be <00:13:59.349>exactly <00:13:59.449>what <00:13:59.550>you <00:13:59.650>expect <00:13:59.750>it <00:13:59.849>to <00:13:59.949>be.

232
00:14:01.650 --> 00:14:05.970
<00:14:01.650>Like <00:14:01.777>an <00:14:01.904>object <00:14:02.031>which, <00:14:02.159>so <00:14:02.286>this <00:14:02.413>is <00:14:02.540>how <00:14:02.668>you <00:14:02.795>can <00:14:02.922>use <00:14:03.050>um,

233
00:14:06.220 --> 00:14:08.770
<00:14:06.220>TypeScript <00:14:06.570>to <00:14:06.920>really <00:14:07.270>there <00:14:07.620>is,

234
00:14:08.770 --> 00:14:11.730
<00:14:08.770>there <00:14:08.897>is <00:14:09.024>no <00:14:09.151>mismatch <00:14:09.279>possible <00:14:09.406>between <00:14:09.533>the <00:14:09.660>validator <00:14:09.788>and <00:14:09.915>type <00:14:10.042>annotations <00:14:10.170>because

235
00:14:11.730 --> 00:14:14.430
<00:14:11.730>there <00:14:12.010>are <00:14:12.290>no <00:14:12.570>type <00:14:12.850>annotations. <00:14:13.130>Um,

236
00:14:14.620 --> 00:14:17.270
<00:14:14.620>there's <00:14:14.760>three <00:14:14.900>libraries <00:14:15.040>that <00:14:15.180>I <00:14:15.320>know <00:14:15.460>of <00:14:15.600>that <00:14:15.740>really <00:14:15.880>do <00:14:16.020>this.

237
00:14:17.390 --> 00:14:21.630
<00:14:17.390>I <00:14:17.456>O <00:14:17.523>T <00:14:17.590>Ss <00:14:17.656>is <00:14:17.723>the <00:14:17.790>first <00:14:17.856>one. <00:14:17.923>Uh, <00:14:17.990>Zot <00:14:18.056>is <00:14:18.123>a <00:14:18.189>newer <00:14:18.256>one <00:14:18.323>that's <00:14:18.390>a <00:14:18.456>bit <00:14:18.523>nicer, <00:14:18.590>a <00:14:18.656>p <00:14:18.723>i, <00:14:18.790>uh,

238
00:14:21.630 --> 00:14:26.620
<00:14:21.630>but <00:14:21.805>then <00:14:21.980>effect <00:14:22.155>schema, <00:14:22.330>um, <00:14:22.505>is <00:14:22.680>another <00:14:22.855>version. <00:14:23.030>Okay,

239
00:14:26.800 --> 00:14:30.220
<00:14:26.800>so <00:14:26.907>that <00:14:27.015>was <00:14:27.123>one <00:14:27.230>use <00:14:27.338>case. <00:14:27.446>Uh, <00:14:27.553>let's <00:14:27.661>talk <00:14:27.769>about <00:14:27.876>the <00:14:27.984>next <00:14:28.092>use <00:14:28.199>case.

240
00:14:30.710 --> 00:14:34.420
<00:14:30.710>TypeScript <00:14:30.826>is <00:14:30.943>a <00:14:31.060>full <00:14:31.176>stack <00:14:31.293>language. <00:14:31.410>So <00:14:31.526>one <00:14:31.643>of <00:14:31.760>the <00:14:31.876>things <00:14:31.993>that <00:14:32.110>um,

241
00:14:35.160 --> 00:14:38.500
<00:14:35.160>we <00:14:35.260>do <00:14:35.360>internally <00:14:35.459>is <00:14:35.560>we <00:14:35.660>have <00:14:35.760>a <00:14:35.860>client <00:14:35.959>and <00:14:36.060>a <00:14:36.160>server <00:14:36.260>that's <00:14:36.360>bought <00:14:36.459>in <00:14:36.560>Typescripts.

242
00:14:38.920 --> 00:14:41.820
<00:14:38.920>And <00:14:39.013>we <00:14:39.106>want <00:14:39.199>to <00:14:39.293>make <00:14:39.386>sure <00:14:39.479>that <00:14:39.573>when <00:14:39.666>a <00:14:39.760>server, <00:14:39.853>when <00:14:39.946>the <00:14:40.040>client <00:14:40.133>calls <00:14:40.226>the <00:14:40.319>server,

243
00:14:42.410 --> 00:14:47.020
<00:14:42.410>it's <00:14:42.492>type <00:14:42.574>safe <00:14:42.657>that <00:14:42.739>the <00:14:42.821>type <00:14:42.904>we <00:14:42.986>expect <00:14:43.068>on <00:14:43.151>the <00:14:43.233>front <00:14:43.315>end <00:14:43.398>is <00:14:43.480>the <00:14:43.562>type <00:14:43.645>we <00:14:43.727>send <00:14:43.810>on

244
00:14:47.020 --> 00:14:47.900
<00:14:47.020>the, <00:14:47.284>on <00:14:47.548>the <00:14:47.812>backends.

245
00:14:48.920 --> 00:14:51.580
<00:14:48.920>And <00:14:49.020>so <00:14:49.120>we <00:14:49.219>want <00:14:49.319>to <00:14:49.420>share <00:14:49.520>the <00:14:49.620>types <00:14:49.719>within <00:14:49.819>the <00:14:49.920>front <00:14:50.020>end <00:14:50.120>and <00:14:50.219>the <00:14:50.319>server,

246
00:14:52.060 --> 00:14:55.530
<00:14:52.060>but <00:14:52.215>how <00:14:52.371>do <00:14:52.526>we <00:14:52.682>do <00:14:52.837>this? <00:14:52.993>Um, <00:14:53.148>and <00:14:53.304>that's, <00:14:53.459>um,

247
00:14:56.320 --> 00:14:58.010
<00:14:56.320>this <00:14:56.670>next <00:14:57.020>use <00:14:57.370>case. <00:14:57.720>Uh,

248
00:14:58.070 --> 00:15:02.370
<00:14:58.070>and <00:14:58.163>the <00:14:58.256>idea <00:14:58.350>is <00:14:58.443>we <00:14:58.536>can <00:14:58.630>actually <00:14:58.723>infer <00:14:58.816>the <00:14:58.910>rest <00:14:59.003>a <00:14:59.096>p <00:14:59.190>i <00:14:59.283>from <00:14:59.376>the <00:14:59.470>codes.

249
00:15:02.710 --> 00:15:06.450
<00:15:02.710>So <00:15:02.810>from <00:15:02.910>a <00:15:03.010>certain <00:15:03.110>server <00:15:03.210>implementation <00:15:03.310>or <00:15:03.410>from <00:15:03.510>a <00:15:03.610>schema <00:15:03.710>that <00:15:03.810>says <00:15:03.910>like <00:15:04.010>what <00:15:04.110>is

250
00:15:06.450 --> 00:15:08.450
<00:15:06.450>the <00:15:06.683>API <00:15:06.916>is <00:15:07.150>going <00:15:07.383>to <00:15:07.616>return? <00:15:07.850>Uh,

251
00:15:08.450 --> 00:15:12.850
<00:15:08.450>there <00:15:08.532>is <00:15:08.614>a <00:15:08.697>public <00:15:08.779>library <00:15:08.861>called <00:15:08.944>T <00:15:09.026>R <00:15:09.108>P <00:15:09.191>C <00:15:09.273>that <00:15:09.355>does <00:15:09.438>the <00:15:09.520>former <00:15:09.602>and <00:15:09.685>then <00:15:09.767>we <00:15:09.850>built

252
00:15:12.850 --> 00:15:15.410
<00:15:12.850>something <00:15:13.025>internally <00:15:13.200>two <00:15:13.375>years <00:15:13.550>and <00:15:13.725>a <00:15:13.900>half <00:15:14.075>ago. <00:15:14.250>Uh,

253
00:15:15.440 --> 00:15:17.810
<00:15:15.440>it's <00:15:15.615>called <00:15:15.790>A <00:15:15.965>P <00:15:16.140>I <00:15:16.315>T <00:15:16.490>S <00:15:16.665>internally. <00:15:16.840>Um,

254
00:15:17.900 --> 00:15:21.450
<00:15:17.900>reach <00:15:18.000>out <00:15:18.100>to <00:15:18.199>me <00:15:18.300>if <00:15:18.400>you <00:15:18.500>wanted <00:15:18.600>to <00:15:18.699>see <00:15:18.800>open <00:15:18.900>sourced. <00:15:19.000>Uh, <00:15:19.100>and <00:15:19.199>uh, <00:15:19.300>I'll,

255
00:15:21.450 --> 00:15:24.890
<00:15:21.450>I'll <00:15:21.543>be <00:15:21.636>talking <00:15:21.730>more <00:15:21.823>about <00:15:21.916>it <00:15:22.010>in <00:15:22.103>the <00:15:22.196>next <00:15:22.290>slides. <00:15:22.383>Uh, <00:15:22.476>if <00:15:22.570>you <00:15:22.663>look <00:15:22.756>at <00:15:22.850>rust,

256
00:15:25.750 --> 00:15:29.210
<00:15:25.750>you <00:15:25.890>see <00:15:26.030>that <00:15:26.170>uh, <00:15:26.310>rocket <00:15:26.450>Rs <00:15:26.590>uh, <00:15:26.730>has <00:15:26.870>some <00:15:27.010>similar <00:15:27.150>id,

257
00:15:29.630 --> 00:15:33.730
<00:15:29.630>but <00:15:29.730>of <00:15:29.830>course <00:15:29.930>rust <00:15:30.030>doesn't <00:15:30.130>really <00:15:30.230>run <00:15:30.330>on <00:15:30.430>the <00:15:30.530>front <00:15:30.630>end <00:15:30.730>so <00:15:30.830>the <00:15:30.930>comparison <00:15:31.030>doesn't

258
00:15:33.730 --> 00:15:35.720
<00:15:33.730>fully <00:15:34.430>go. <00:15:35.130>Uh,

259
00:15:35.740 --> 00:15:39.480
<00:15:35.740>and <00:15:35.840>so <00:15:35.940>the <00:15:36.040>main <00:15:36.140>advantage <00:15:36.240>that <00:15:36.340>we <00:15:36.440>see <00:15:36.540>is <00:15:36.640>that <00:15:36.740>there <00:15:36.840>is <00:15:36.940>no <00:15:37.040>time <00:15:37.140>mismatch.

260
00:15:39.480 --> 00:15:41.320
<00:15:39.480>We <00:15:39.635>don't <00:15:39.791>have <00:15:39.946>to <00:15:40.102>think <00:15:40.257>about <00:15:40.413>this <00:15:40.568>kind <00:15:40.724>of <00:15:40.880>problems,

261
00:15:41.320 --> 00:15:45.080
<00:15:41.320>we <00:15:41.413>don't <00:15:41.506>have <00:15:41.600>to <00:15:41.693>check <00:15:41.786>it <00:15:41.880>during <00:15:41.973>code <00:15:42.066>review <00:15:42.160>and <00:15:42.253>we <00:15:42.346>can <00:15:42.440>really <00:15:42.533>think <00:15:42.626>about, <00:15:42.720>uh,

262
00:15:45.080 --> 00:15:46.760
<00:15:45.080>our <00:15:45.280>rest <00:15:45.480>a <00:15:45.680>p <00:15:45.880>i <00:15:46.080>in <00:15:46.280>domain <00:15:46.480>terms.

263
00:15:46.940 --> 00:15:49.760
<00:15:46.940>So <00:15:47.080>we're <00:15:47.220>not <00:15:47.360>thinking <00:15:47.500>about <00:15:47.640>like <00:15:47.780>call <00:15:47.920>discuss <00:15:48.060>a <00:15:48.200>p <00:15:48.340>i,

264
00:15:49.760 --> 00:15:51.560
<00:15:49.760>we're <00:15:49.935>thinking <00:15:50.110>about <00:15:50.285>call <00:15:50.460>this <00:15:50.635>function <00:15:50.810>in <00:15:50.985>the <00:15:51.160>server.

265
00:15:52.500 --> 00:15:57.240
<00:15:52.500>We <00:15:52.582>get <00:15:52.664>a <00:15:52.747>free <00:15:52.829>a <00:15:52.911>p <00:15:52.994>i <00:15:53.076>clients, <00:15:53.158>we <00:15:53.241>get <00:15:53.323>a <00:15:53.405>free, <00:15:53.488>um, <00:15:53.570>a <00:15:53.652>p <00:15:53.735>I <00:15:53.817>documentation. <00:15:53.900>Um,

266
00:15:58.140 --> 00:16:00.320
<00:15:58.140>the <00:15:58.420>only <00:15:58.699>disadvantage <00:15:58.980>is <00:15:59.260>that <00:15:59.540>um,

267
00:16:00.980 --> 00:16:05.120
<00:16:00.980>at <00:16:01.087>run <00:16:01.195>there <00:16:01.303>is <00:16:01.410>a <00:16:01.518>certain <00:16:01.626>library <00:16:01.733>implementing <00:16:01.841>the <00:16:01.949>client <00:16:02.056>and <00:16:02.164>the <00:16:02.272>server <00:16:02.380>and

268
00:16:05.120 --> 00:16:07.720
<00:16:05.120>that's <00:16:05.353>actually <00:16:05.586>moving <00:16:05.820>backwards <00:16:06.053>on <00:16:06.286>the <00:16:06.520>spectrum.

269
00:16:08.140 --> 00:16:10.840
<00:16:08.140>So <00:16:08.340>the <00:16:08.540>library <00:16:08.740>implementation <00:16:08.939>is <00:16:09.140>more <00:16:09.340>Java <00:16:09.540>scripty,

270
00:16:11.030 --> 00:16:15.440
<00:16:11.030>like <00:16:11.137>it's <00:16:11.245>not <00:16:11.353>fully <00:16:11.460>tied <00:16:11.568>because <00:16:11.676>it's <00:16:11.783>too <00:16:11.891>hard. <00:16:11.999>Like <00:16:12.106>it's <00:16:12.214>so <00:16:12.322>type <00:16:12.430>safe,

271
00:16:15.440 --> 00:16:16.960
<00:16:15.440>it's <00:16:15.635>really <00:16:15.830>hard <00:16:16.026>to <00:16:16.221>prove <00:16:16.417>it's <00:16:16.612>type <00:16:16.808>safe.

272
00:16:17.100 --> 00:16:20.480
<00:16:17.100>So <00:16:17.193>we <00:16:17.286>have <00:16:17.380>to <00:16:17.473>say <00:16:17.566>to <00:16:17.660>the <00:16:17.753>type <00:16:17.846>script <00:16:17.940>compiler <00:16:18.033>like, <00:16:18.126>no, <00:16:18.220>trust <00:16:18.313>us, <00:16:18.406>it's <00:16:18.500>fine,

273
00:16:20.940 --> 00:16:24.200
<00:16:20.940>but <00:16:21.067>we <00:16:21.194>have <00:16:21.321>a <00:16:21.449>extensive <00:16:21.576>testing <00:16:21.703>et <00:16:21.830>cetera <00:16:21.958>going <00:16:22.085>on. <00:16:22.212>So <00:16:22.340>um,

274
00:16:25.580 --> 00:16:26.600
<00:16:25.580>we <00:16:25.809>should, <00:16:26.039>we <00:16:26.268>are <00:16:26.498>safe,

275
00:16:26.750 --> 00:16:31.160
<00:16:26.750>like <00:16:26.843>we're <00:16:26.936>sure <00:16:27.030>that <00:16:27.123>it's <00:16:27.216>safe <00:16:27.310>and <00:16:27.403>that <00:16:27.496>allows <00:16:27.590>us <00:16:27.683>to <00:16:27.776>move <00:16:27.870>the <00:16:27.963>actual <00:16:28.056>codes <00:16:28.150>like

276
00:16:31.230 --> 00:16:35.700
<00:16:31.230>much <00:16:31.323>more <00:16:31.416>to <00:16:31.510>drive <00:16:31.603>to <00:16:31.696>like <00:16:31.790>extremely <00:16:31.883>type <00:16:31.976>safe. <00:16:32.070>And <00:16:32.163>so <00:16:32.256>this <00:16:32.350>is <00:16:32.443>how <00:16:32.536>it <00:16:32.630>looks.

277
00:16:36.240 --> 00:16:39.260
<00:16:36.240>So <00:16:36.367>we <00:16:36.494>declare <00:16:36.621>a <00:16:36.749>workspace <00:16:36.876>object, <00:16:37.003>it's <00:16:37.130>kind <00:16:37.258>of <00:16:37.385>like <00:16:37.512>a <00:16:37.640>controller.

278
00:16:39.480 --> 00:16:42.140
<00:16:39.480>It <00:16:39.620>has <00:16:39.760>it <00:16:39.900>get <00:16:40.040>all <00:16:40.180>parts <00:16:40.320>and <00:16:40.460>it <00:16:40.600>says <00:16:40.740>like, <00:16:40.880>okay,

279
00:16:42.430 --> 00:16:46.580
<00:16:42.430>under <00:16:42.530>the <00:16:42.630>hood <00:16:42.729>you'll <00:16:42.829>call <00:16:42.930>slash <00:16:43.030>workspace <00:16:43.130>with <00:16:43.229>a <00:16:43.329>get <00:16:43.430>return <00:16:43.530>with <00:16:43.630>a <00:16:43.729>get <00:16:43.829>methods

280
00:16:46.800 --> 00:16:50.180
<00:16:46.800>and <00:16:46.916>it <00:16:47.033>returns <00:16:47.150>on <00:16:47.266>a <00:16:47.383>array <00:16:47.500>of <00:16:47.616>workspaces. <00:16:47.733>And <00:16:47.849>then <00:16:47.966>we <00:16:48.083>say, <00:16:48.199>okay,

281
00:16:50.180 --> 00:16:53.020
<00:16:50.180>that's <00:16:50.287>our <00:16:50.395>a <00:16:50.503>p <00:16:50.610>i <00:16:50.718>definition, <00:16:50.826>it <00:16:50.933>is <00:16:51.041>the <00:16:51.149>workspace <00:16:51.256>controller <00:16:51.364>and <00:16:51.472>some <00:16:51.579>others.

282
00:16:53.720 --> 00:16:57.300
<00:16:53.720>And <00:16:53.802>then <00:16:53.884>we <00:16:53.967>can <00:16:54.049>create <00:16:54.131>a <00:16:54.214>client <00:16:54.296>from <00:16:54.378>this <00:16:54.461>a <00:16:54.543>p <00:16:54.625>i <00:16:54.708>definition <00:16:54.790>and <00:16:54.872>we <00:16:54.955>can <00:16:55.037>just <00:16:55.120>do

283
00:16:57.300 --> 00:17:01.940
<00:16:57.300>client <00:16:57.407>total <00:16:57.515>workspace <00:16:57.623>dot <00:16:57.730>get <00:16:57.838>all, <00:16:57.946>and <00:16:58.053>this <00:16:58.161>will <00:16:58.269>have <00:16:58.376>the <00:16:58.484>correct <00:16:58.592>return <00:16:58.699>type.

284
00:17:01.960 --> 00:17:03.620
<00:17:01.960>So <00:17:02.135>it'll <00:17:02.310>know <00:17:02.485>that <00:17:02.660>it's <00:17:02.835>a <00:17:03.010>list <00:17:03.185>of, <00:17:03.360>uh,

285
00:17:03.670 --> 00:17:06.260
<00:17:03.670>workspaces <00:17:03.903>and <00:17:04.136>if <00:17:04.369>there <00:17:04.603>are <00:17:04.836>other <00:17:05.069>methods,

286
00:17:06.290 --> 00:17:09.580
<00:17:06.290>they <00:17:06.383>will <00:17:06.476>just <00:17:06.569>be <00:17:06.663>available <00:17:06.756>and <00:17:06.849>it's <00:17:06.943>fully <00:17:07.036>type <00:17:07.129>safe. <00:17:07.223>If <00:17:07.316>you <00:17:07.409>make <00:17:07.503>a <00:17:07.596>typo <00:17:07.690>here,

287
00:17:09.840 --> 00:17:12.620
<00:17:09.839>uh, <00:17:09.995>there <00:17:10.151>would <00:17:10.306>be <00:17:10.462>like <00:17:10.617>a <00:17:10.773>type <00:17:10.928>or <00:17:11.084>et <00:17:11.240>cetera.

288
00:17:13.120 --> 00:17:17.660
<00:17:13.119>And <00:17:13.227>similarly <00:17:13.335>on <00:17:13.443>the <00:17:13.550>server <00:17:13.658>we <00:17:13.766>can <00:17:13.873>do <00:17:13.981>create <00:17:14.089>controller, <00:17:14.196>uh, <00:17:14.304>for <00:17:14.412>this, <00:17:14.520>uh,

289
00:17:17.750 --> 00:17:18.780
<00:17:17.750>controller <00:17:18.676>definition.

290
00:17:19.080 --> 00:17:22.820
<00:17:19.079>And <00:17:19.167>we <00:17:19.254>say <00:17:19.342>like <00:17:19.429>get <00:17:19.517>all <00:17:19.605>and <00:17:19.692>we <00:17:19.780>return <00:17:19.867>like <00:17:19.954>an <00:17:20.042>empty <00:17:20.129>array <00:17:20.217>was <00:17:20.304>the <00:17:20.392>easiest <00:17:20.480>to

291
00:17:23.060 --> 00:17:26.940
<00:17:23.060>showcase, <00:17:23.176>but <00:17:23.293>if <00:17:23.409>we <00:17:23.526>return <00:17:23.643>something <00:17:23.760>that's <00:17:23.876>not <00:17:23.993>matching <00:17:24.109>the <00:17:24.226>uh, <00:17:24.343>return <00:17:24.460>type,

292
00:17:27.120 --> 00:17:28.500
<00:17:27.119>we <00:17:27.297>get <00:17:27.474>a <00:17:27.652>type <00:17:27.829>error <00:17:28.007>on <00:17:28.184>the <00:17:28.362>server.

293
00:17:29.160 --> 00:17:32.460
<00:17:29.160>And <00:17:29.253>this <00:17:29.346>really <00:17:29.440>ensures <00:17:29.533>us <00:17:29.626>that <00:17:29.720>the <00:17:29.813>type <00:17:29.906>of <00:17:30.000>the <00:17:30.093>front <00:17:30.186>end <00:17:30.280>and <00:17:30.373>the <00:17:30.466>backend <00:17:30.560>are

294
00:17:32.460 --> 00:17:34.290
<00:17:32.460>fully <00:17:32.926>in <00:17:33.393>sync. <00:17:33.860>Um,

295
00:17:34.670 --> 00:17:37.730
<00:17:34.670>and <00:17:34.786>so <00:17:34.903>like <00:17:35.020>our <00:17:35.136>backend <00:17:35.253>is <00:17:35.370>integrated <00:17:35.486>when <00:17:35.603>s <00:17:35.720>t <00:17:35.836>s <00:17:35.953>the <00:17:36.070>yeah,

296
00:17:37.730 --> 00:17:41.930
<00:17:37.730>we <00:17:37.807>have <00:17:37.885>a <00:17:37.963>free <00:17:38.041>a <00:17:38.118>p <00:17:38.196>i <00:17:38.274>clients <00:17:38.352>and <00:17:38.430>I <00:17:38.507>want <00:17:38.585>to <00:17:38.663>shout <00:17:38.741>out <00:17:38.818>to <00:17:38.896>Fable <00:17:38.974>promoting <00:17:39.052>where <00:17:39.130>we

297
00:17:41.930 --> 00:17:46.430
<00:17:41.930>originally <00:17:42.130>got <00:17:42.330>a <00:17:42.530>ID <00:17:42.730>from. <00:17:42.930>Uh, <00:17:43.130>yeah. <00:17:43.330>Uh,

298
00:17:46.690 --> 00:17:50.440
<00:17:46.690>and <00:17:46.845>that <00:17:47.001>was <00:17:47.156>a <00:17:47.312>very <00:17:47.467>simple <00:17:47.623>example, <00:17:47.778>but <00:17:47.934>for, <00:17:48.090>um,

299
00:17:50.660 --> 00:17:54.880
<00:17:50.660>to <00:17:50.767>showcase <00:17:50.875>some <00:17:50.983>of <00:17:51.090>the <00:17:51.198>more <00:17:51.306>advanced <00:17:51.413>examples <00:17:51.521>we <00:17:51.629>have <00:17:51.736>is <00:17:51.844>like <00:17:51.952>parts <00:17:52.060>parameters

300
00:17:54.880 --> 00:17:56.080
<00:17:54.880>like <00:17:55.240>this <00:17:55.600>id, <00:17:55.960>um,

301
00:17:56.960 --> 00:18:01.560
<00:17:56.960>property <00:17:57.053>like <00:17:57.146>it's <00:17:57.240>fully <00:17:57.333>type <00:17:57.426>safe <00:17:57.520>with <00:17:57.613>saying <00:17:57.706>that <00:17:57.800>this <00:17:57.893>needs <00:17:57.986>to <00:17:58.080>be <00:17:58.173>of <00:17:58.266>IU <00:17:58.360>ID

302
00:18:01.560 --> 00:18:04.280
<00:18:01.560>type. <00:18:01.687>So <00:18:01.814>if <00:18:01.941>you <00:18:02.069>make <00:18:02.196>an <00:18:02.323>a <00:18:02.450>typo <00:18:02.578>in <00:18:02.705>this <00:18:02.832>ID <00:18:02.960>parameter,

303
00:18:04.280 --> 00:18:07.880
<00:18:04.280>this <00:18:04.455>will <00:18:04.629>give <00:18:04.805>a <00:18:04.980>typo <00:18:05.155>or <00:18:05.330>vice <00:18:05.504>versa. <00:18:05.680>Um,

304
00:18:08.260 --> 00:18:12.800
<00:18:08.260>we <00:18:08.367>also <00:18:08.475>have <00:18:08.583>shared <00:18:08.690>middleware, <00:18:08.798>but <00:18:08.906>I, <00:18:09.013>I'll <00:18:09.121>be <00:18:09.229>skipping <00:18:09.336>that <00:18:09.444>today. <00:18:09.552>And <00:18:09.660>lastly,

305
00:18:13.100 --> 00:18:14.480
<00:18:13.100>we, <00:18:13.721>because <00:18:14.342>um,

306
00:18:14.620 --> 00:18:18.880
<00:18:14.620>we <00:18:14.736>can <00:18:14.853>really <00:18:14.969>have <00:18:15.086>show <00:18:15.203>control <00:18:15.320>over <00:18:15.436>our <00:18:15.553>types <00:18:15.669>of <00:18:15.786>front <00:18:15.903>and <00:18:16.020>backend,

307
00:18:18.880 --> 00:18:22.160
<00:18:18.880>we <00:18:19.007>can <00:18:19.134>have <00:18:19.261>expected <00:18:19.389>errors <00:18:19.516>like <00:18:19.643>workspace <00:18:19.770>get <00:18:19.898>by, <00:18:20.025>ID <00:18:20.152>can <00:18:20.280>fail,

308
00:18:22.160 --> 00:18:25.600
<00:18:22.160>like <00:18:22.267>the <00:18:22.375>workspace <00:18:22.483>cannot <00:18:22.590>exist <00:18:22.698>and <00:18:22.806>we <00:18:22.913>want <00:18:23.021>to <00:18:23.129>make <00:18:23.236>sure <00:18:23.344>that <00:18:23.452>the <00:18:23.560>frontend

309
00:18:25.600 --> 00:18:27.760
<00:18:25.600>handles <00:18:25.800>that <00:18:26.000>case, <00:18:26.199>that <00:18:26.399>the <00:18:26.600>workspace <00:18:26.800>doesn't <00:18:27.000>exist.

310
00:18:28.220 --> 00:18:32.440
<00:18:28.220>And <00:18:28.313>so <00:18:28.406>we <00:18:28.500>can <00:18:28.593>say <00:18:28.686>like <00:18:28.780>actually <00:18:28.873>there <00:18:28.966>is <00:18:29.060>a <00:18:29.153>possible <00:18:29.246>error <00:18:29.340>that <00:18:29.433>the <00:18:29.526>workspace <00:18:29.620>is

311
00:18:32.440 --> 00:18:34.680
<00:18:32.440>not <00:18:32.580>font. <00:18:32.720>And <00:18:32.860>then <00:18:33.000>on <00:18:33.140>the <00:18:33.280>server <00:18:33.420>we <00:18:33.560>can <00:18:33.700>use <00:18:33.840>it.

312
00:18:34.680 --> 00:18:36.880
<00:18:34.680>Like <00:18:34.880>we <00:18:35.080>just <00:18:35.280>say <00:18:35.480>it's <00:18:35.680>not <00:18:35.880>fund <00:18:36.080>error,

313
00:18:36.880 --> 00:18:39.720
<00:18:36.880>we <00:18:36.996>don't <00:18:37.113>have <00:18:37.230>to <00:18:37.346>care <00:18:37.463>about <00:18:37.580>how <00:18:37.696>it's <00:18:37.813>implemented <00:18:37.930>under <00:18:38.046>on <00:18:38.163>the <00:18:38.280>hoods,

314
00:18:39.720 --> 00:18:43.480
<00:18:39.720>which <00:18:39.813>error <00:18:39.906>is <00:18:40.000>drawn <00:18:40.093>and <00:18:40.186>on <00:18:40.280>this <00:18:40.373>fondant <00:18:40.466>we <00:18:40.560>know <00:18:40.653>we <00:18:40.746>have <00:18:40.840>to <00:18:40.933>handle <00:18:41.026>this <00:18:41.120>case.

315
00:18:46.010 --> 00:18:49.580
<00:18:46.010>And <00:18:46.150>so <00:18:46.290>we're <00:18:46.430>two <00:18:46.570>and <00:18:46.710>a <00:18:46.850>half <00:18:46.990>years <00:18:47.129>in <00:18:47.270>I <00:18:47.410>believe.

316
00:18:49.920 --> 00:18:54.060
<00:18:49.920>And <00:18:50.027>overall <00:18:50.135>I <00:18:50.243>think <00:18:50.350>we <00:18:50.458>changed <00:18:50.566>this <00:18:50.673>less <00:18:50.781>than <00:18:50.889>five <00:18:50.996>times. <00:18:51.104>Like <00:18:51.212>it's <00:18:51.320>been,

317
00:18:54.940 --> 00:18:57.720
<00:18:54.940>uh, <00:18:55.080>like <00:18:55.220>a <00:18:55.360>week <00:18:55.500>of <00:18:55.640>work. <00:18:55.780>I <00:18:55.920>would <00:18:56.060>say <00:18:56.200>something <00:18:56.340>to,

318
00:18:57.740 --> 00:19:01.560
<00:18:57.740>to <00:18:57.867>build <00:18:57.994>this <00:18:58.121>library <00:18:58.249>internally, <00:18:58.376>but <00:18:58.503>we, <00:18:58.630>we <00:18:58.758>are <00:18:58.885>barely <00:18:59.012>changing <00:18:59.140>it.

319
00:19:01.620 --> 00:19:05.880
<00:19:01.620>So <00:19:01.727>like <00:19:01.835>while <00:19:01.943>it's <00:19:02.050>a <00:19:02.158>lot <00:19:02.266>of <00:19:02.373>codes <00:19:02.481>that <00:19:02.589>is <00:19:02.696>not <00:19:02.804>necessarily <00:19:02.912>very <00:19:03.020>maintainable,

320
00:19:05.880 --> 00:19:09.520
<00:19:05.880>that's <00:19:06.007>not <00:19:06.134>very <00:19:06.261>type <00:19:06.389>safe, <00:19:06.516>it's <00:19:06.643>code <00:19:06.770>that <00:19:06.898>we're <00:19:07.025>not <00:19:07.152>touching <00:19:07.280>it.

321
00:19:09.620 --> 00:19:14.320
<00:19:09.620>So <00:19:09.713>like <00:19:09.806>we're <00:19:09.899>gaining <00:19:09.993>a <00:19:10.086>lot <00:19:10.179>in <00:19:10.273>all <00:19:10.366>the <00:19:10.459>code <00:19:10.553>that <00:19:10.646>we're <00:19:10.739>changing <00:19:10.833>daily <00:19:10.926>while <00:19:11.020>we

322
00:19:14.320 --> 00:19:16.680
<00:19:14.320>have <00:19:14.475>this <00:19:14.631>piece <00:19:14.786>of <00:19:14.942>code <00:19:15.097>that's <00:19:15.253>not <00:19:15.408>very <00:19:15.564>big. <00:19:15.720>That's,

323
00:19:16.820 --> 00:19:18.800
<00:19:16.820>we <00:19:16.975>don't <00:19:17.131>have <00:19:17.286>to <00:19:17.442>change <00:19:17.597>often <00:19:17.753>that's <00:19:17.908>not <00:19:18.064>type <00:19:18.220>safe,

324
00:19:19.060 --> 00:19:22.810
<00:19:19.060>but <00:19:19.215>that's <00:19:19.371>a <00:19:19.526>trade <00:19:19.682>off <00:19:19.837>we're <00:19:19.993>willing <00:19:20.148>to <00:19:20.304>make. <00:19:20.460>Um,

325
00:19:23.510 --> 00:19:26.690
<00:19:23.510>and <00:19:23.710>then <00:19:23.910>lastly, <00:19:24.110>um, <00:19:24.310>type <00:19:24.510>safe <00:19:24.710>access <00:19:24.910>control.

326
00:19:27.190 --> 00:19:31.570
<00:19:27.190>So <00:19:27.290>in <00:19:27.390>data <00:19:27.490>company <00:19:27.590>we <00:19:27.690>have <00:19:27.790>a <00:19:27.890>workspace <00:19:27.990>product <00:19:28.090>and <00:19:28.190>it's <00:19:28.290>basically <00:19:28.390>an <00:19:28.490>online <00:19:28.590>data

327
00:19:31.570 --> 00:19:34.650
<00:19:31.570>science <00:19:31.710>notebook, <00:19:31.850>uh, <00:19:31.990>where <00:19:32.129>we <00:19:32.270>have <00:19:32.409>access <00:19:32.550>to <00:19:32.689>company <00:19:32.830>data, <00:19:32.970>uh,

328
00:19:34.650 --> 00:19:38.890
<00:19:34.650>other <00:19:34.750>company's <00:19:34.850>data <00:19:34.950>and <00:19:35.050>we <00:19:35.150>don't <00:19:35.250>want <00:19:35.350>to <00:19:35.450>expose <00:19:35.550>companies <00:19:35.650>a <00:19:35.750>data <00:19:35.850>that <00:19:35.950>company <00:19:36.050>B

329
00:19:39.000 --> 00:19:41.770
<00:19:39.000>that <00:19:39.155>will <00:19:39.311>be <00:19:39.466>a <00:19:39.622>really, <00:19:39.777>really <00:19:39.933>problem <00:19:40.088>matic, <00:19:40.244>uh, <00:19:40.400>bug.

330
00:19:42.790 --> 00:19:45.410
<00:19:42.790>And <00:19:42.930>so <00:19:43.070>we <00:19:43.210>need <00:19:43.350>to <00:19:43.490>make <00:19:43.629>really <00:19:43.770>sure <00:19:43.909>that <00:19:44.050>we <00:19:44.190>are,

331
00:19:45.710 --> 00:19:47.770
<00:19:45.710>we <00:19:45.885>double <00:19:46.060>check <00:19:46.235>who's <00:19:46.410>allowed <00:19:46.585>to <00:19:46.760>take <00:19:46.935>which <00:19:47.110>action.

332
00:19:48.230 --> 00:19:50.410
<00:19:48.230>But <00:19:48.357>the <00:19:48.484>problem <00:19:48.611>is <00:19:48.739>where <00:19:48.866>do <00:19:48.993>we <00:19:49.120>check <00:19:49.248>this <00:19:49.375>on <00:19:49.502>the <00:19:49.630>backend?

333
00:19:50.640 --> 00:19:54.090
<00:19:50.640>Like <00:19:50.733>we <00:19:50.826>can <00:19:50.920>check <00:19:51.013>this <00:19:51.106>in <00:19:51.200>the <00:19:51.293>controller <00:19:51.386>or <00:19:51.480>we <00:19:51.573>can <00:19:51.666>check <00:19:51.760>this <00:19:51.853>in <00:19:51.946>service <00:19:52.040>classes

334
00:19:54.200 --> 00:19:56.650
<00:19:54.200>that <00:19:54.340>we <00:19:54.480>call <00:19:54.620>from <00:19:54.760>the <00:19:54.900>controller <00:19:55.040>and <00:19:55.180>from <00:19:55.320>other <00:19:55.460>service <00:19:55.600>classes.

335
00:19:58.000 --> 00:19:59.540
<00:19:58.000>And <00:19:58.173>in <00:19:58.346>any <00:19:58.519>case, <00:19:58.693>if <00:19:58.866>we <00:19:59.039>make <00:19:59.212>a <00:19:59.386>book,

336
00:19:59.690 --> 00:20:03.260
<00:19:59.690>this <00:19:59.777>is <00:19:59.865>like <00:19:59.952>a <00:20:00.040>huge <00:20:00.127>security <00:20:00.215>issue <00:20:00.302>and <00:20:00.390>like <00:20:00.477>could <00:20:00.565>even <00:20:00.652>be <00:20:00.740>the <00:20:00.827>end <00:20:00.915>of <00:20:01.002>the <00:20:01.090>company

337
00:20:03.320 --> 00:20:07.060
<00:20:03.320>or <00:20:03.427>like <00:20:03.535>of <00:20:03.643>our <00:20:03.750>product <00:20:03.858>because <00:20:03.966>people <00:20:04.073>won't <00:20:04.181>trust <00:20:04.289>us <00:20:04.396>anymore <00:20:04.504>once <00:20:04.612>we <00:20:04.720>start

338
00:20:07.290 --> 00:20:11.700
<00:20:07.290>leaking <00:20:07.406>uh, <00:20:07.523>company <00:20:07.639>like <00:20:07.756>the <00:20:07.873>wrong <00:20:07.990>data. <00:20:08.106>But <00:20:08.223>if <00:20:08.340>you <00:20:08.456>check <00:20:08.573>in <00:20:08.690>boats,

339
00:20:11.700 --> 00:20:14.900
<00:20:11.700>like <00:20:11.800>all <00:20:11.900>the <00:20:12.000>code <00:20:12.100>is <00:20:12.200>loaded <00:20:12.300>with <00:20:12.400>this <00:20:12.500>access <00:20:12.600>check <00:20:12.700>and <00:20:12.800>we <00:20:12.900>have <00:20:13.000>this <00:20:13.100>performance

340
00:20:14.900 --> 00:20:18.020
<00:20:14.900>penalty <00:20:15.007>of <00:20:15.115>constantly <00:20:15.223>having <00:20:15.330>to <00:20:15.438>check. <00:20:15.546>So <00:20:15.653>that's <00:20:15.761>something <00:20:15.869>we <00:20:15.976>didn't <00:20:16.084>want <00:20:16.192>to <00:20:16.300>do.

341
00:20:18.970 --> 00:20:23.840
<00:20:18.970>And <00:20:19.070>if <00:20:19.170>we <00:20:19.270>only <00:20:19.370>check <00:20:19.470>on <00:20:19.570>the <00:20:19.670>controller <00:20:19.770>then <00:20:19.870>like <00:20:19.970>it's <00:20:20.070>very <00:20:20.170>easy <00:20:20.270>to <00:20:20.370>accidentally

342
00:20:23.840 --> 00:20:26.160
<00:20:23.840>call <00:20:24.040>the <00:20:24.240>wrong <00:20:24.439>service <00:20:24.639>and <00:20:24.840>leaking <00:20:25.040>permissions <00:20:25.240>again,

343
00:20:26.750 --> 00:20:28.600
<00:20:26.750>similarly <00:20:26.950>if <00:20:27.150>you <00:20:27.350>only <00:20:27.550>call <00:20:27.750>it <00:20:27.950>in <00:20:28.150>services,

344
00:20:28.750 --> 00:20:33.040
<00:20:28.750>like <00:20:28.837>which <00:20:28.925>permissions <00:20:29.012>do <00:20:29.100>you <00:20:29.187>need <00:20:29.275>to <00:20:29.362>call <00:20:29.450>the <00:20:29.537>a <00:20:29.625>P <00:20:29.712>i <00:20:29.800>and <00:20:29.887>then <00:20:29.975>maybe <00:20:30.062>also <00:20:30.150>a

345
00:20:33.040 --> 00:20:37.000
<00:20:33.040>service <00:20:33.147>is <00:20:33.255>calling <00:20:33.363>another <00:20:33.470>service <00:20:33.578>and <00:20:33.686>like <00:20:33.793>there <00:20:33.901>is <00:20:34.009>a <00:20:34.116>mismatch <00:20:34.224>and <00:20:34.332>it's <00:20:34.440>like

346
00:20:37.140 --> 00:20:38.840
<00:20:37.140>for <00:20:37.420>some <00:20:37.700>use <00:20:37.980>cases <00:20:38.260>not <00:20:38.540>working.

347
00:20:42.270 --> 00:20:46.250
<00:20:42.270>So <00:20:42.377>what <00:20:42.485>did <00:20:42.593>we <00:20:42.700>do? <00:20:42.808>We <00:20:42.916>decided <00:20:43.023>to <00:20:43.131>just <00:20:43.239>call <00:20:43.346>it <00:20:43.454>in <00:20:43.562>a <00:20:43.670>controller.

348
00:20:46.670 --> 00:20:50.000
<00:20:46.670>So <00:20:46.770>we <00:20:46.870>say <00:20:46.970>like <00:20:47.070>when <00:20:47.170>we <00:20:47.270>want <00:20:47.370>to <00:20:47.470>uh, <00:20:47.570>get <00:20:47.670>a <00:20:47.770>workspace, <00:20:47.870>we <00:20:47.970>say <00:20:48.070>okay,

349
00:20:50.000 --> 00:20:50.840
<00:20:50.000>get <00:20:50.252>it <00:20:50.504>with <00:20:50.755>permissions.

350
00:20:50.840 --> 00:20:54.600
<00:20:50.840>And <00:20:50.947>we <00:20:51.055>say <00:20:51.163>for <00:20:51.270>this <00:20:51.378>endpoint <00:20:51.486>you <00:20:51.593>just <00:20:51.701>need <00:20:51.809>added <00:20:51.916>permission <00:20:52.024>so <00:20:52.132>that <00:20:52.240>it's

351
00:20:54.720 --> 00:20:56.440
<00:20:54.720>renaming <00:20:54.920>a <00:20:55.120>workspace. <00:20:55.320>We <00:20:55.520>just <00:20:55.720>need <00:20:55.920>added <00:20:56.120>permission.

352
00:20:56.980 --> 00:21:00.920
<00:20:56.980>And <00:20:57.073>here <00:20:57.166>you <00:20:57.260>see <00:20:57.353>again <00:20:57.446>this <00:20:57.540>expected <00:20:57.633>error <00:20:57.726>I <00:20:57.820>was <00:20:57.913>talking <00:20:58.006>about <00:20:58.100>like <00:20:58.193>if <00:20:58.286>it's <00:20:58.380>a

353
00:21:00.920 --> 00:21:02.800
<00:21:00.920>failure, <00:21:01.153>like <00:21:01.386>maybe <00:21:01.620>the <00:21:01.853>workspace <00:21:02.086>didn't <00:21:02.320>exist,

354
00:21:02.800 --> 00:21:06.680
<00:21:02.800>maybe <00:21:02.927>the <00:21:03.054>user <00:21:03.181>didn't <00:21:03.309>have <00:21:03.436>access, <00:21:03.563>we <00:21:03.690>throw <00:21:03.818>this <00:21:03.945>not <00:21:04.072>fund <00:21:04.200>error,

355
00:21:07.030 --> 00:21:08.040
<00:21:07.030>this <00:21:07.257>is <00:21:07.484>an <00:21:07.711>expected <00:21:07.938>error,

356
00:21:08.060 --> 00:21:12.960
<00:21:08.060>we <00:21:08.167>don't <00:21:08.275>show <00:21:08.383>it <00:21:08.490>a <00:21:08.598>4 <00:21:08.706>0 <00:21:08.813>4 <00:21:08.921>in <00:21:09.029>this <00:21:09.136>very <00:21:09.244>domain <00:21:09.352>codes <00:21:09.460>like

357
00:21:12.960 --> 00:21:14.200
<00:21:12.960>that's <00:21:13.239>handled <00:21:13.518>under <00:21:13.797>the <00:21:14.076>hoods.

358
00:21:15.060 --> 00:21:18.160
<00:21:15.060>And <00:21:15.167>then <00:21:15.275>we <00:21:15.383>just <00:21:15.490>paused <00:21:15.598>along <00:21:15.706>to <00:21:15.813>the <00:21:15.921>workspace <00:21:16.029>that <00:21:16.136>we <00:21:16.244>named <00:21:16.352>service <00:21:16.460>class.

359
00:21:18.620 --> 00:21:23.330
<00:21:18.620>We <00:21:18.719>just <00:21:18.820>pause <00:21:18.919>along <00:21:19.020>this <00:21:19.120>workspace <00:21:19.219>and <00:21:19.320>so <00:21:19.419>it <00:21:19.520>looks <00:21:19.620>like <00:21:19.719>we're <00:21:19.820>only <00:21:19.919>checking <00:21:20.020>in

360
00:21:23.330 --> 00:21:24.250
<00:21:23.330>in <00:21:23.744>a <00:21:24.158>controller,

361
00:21:25.110 --> 00:21:29.810
<00:21:25.110>but <00:21:25.265>actually <00:21:25.421>on <00:21:25.576>TypeScript <00:21:25.732>types <00:21:25.887>we're <00:21:26.043>doing <00:21:26.198>something <00:21:26.354>really <00:21:26.510>clever

362
00:21:30.400 --> 00:21:33.620
<00:21:30.400>that <00:21:30.866>this, <00:21:31.333>oh <00:21:31.800>sorry,

363
00:21:35.280 --> 00:21:39.620
<00:21:35.280>uh, <00:21:35.420>sorry. <00:21:35.560>Um, <00:21:35.700>this <00:21:35.840>workspace <00:21:35.980>with <00:21:36.120>permissions, <00:21:36.260>you <00:21:36.399>get <00:21:36.540>hot <00:21:36.680>here,

364
00:21:40.280 --> 00:21:42.450
<00:21:40.280>it's <00:21:40.513>typed <00:21:40.746>differently <00:21:40.980>than <00:21:41.213>you <00:21:41.446>would <00:21:41.680>expect.

365
00:21:42.620 --> 00:21:46.930
<00:21:42.620>There <00:21:42.727>is <00:21:42.835>a <00:21:42.943>certain <00:21:43.050>type <00:21:43.158>annotation <00:21:43.266>added <00:21:43.373>to <00:21:43.481>it <00:21:43.589>that <00:21:43.696>says <00:21:43.804>which <00:21:43.912>permissions, <00:21:44.020>uh,

366
00:21:47.080 --> 00:21:47.913
<00:21:47.080>were <00:21:47.829>checked.

367
00:21:48.350 --> 00:21:52.690
<00:21:48.350>And <00:21:48.437>we <00:21:48.524>we're <00:21:48.612>saying <00:21:48.699>here <00:21:48.787>we <00:21:48.875>need <00:21:48.962>to <00:21:49.050>have <00:21:49.137>a <00:21:49.225>workspace <00:21:49.312>where <00:21:49.399>we <00:21:49.487>are <00:21:49.574>sure <00:21:49.662>of <00:21:49.750>that

368
00:21:52.690 --> 00:21:54.610
<00:21:52.690>data <00:21:52.970>does <00:21:53.250>at <00:21:53.530>least <00:21:53.810>added <00:21:54.090>permission.

369
00:21:55.160 --> 00:21:56.850
<00:21:55.160>Like <00:21:55.335>it <00:21:55.510>can <00:21:55.685>have <00:21:55.860>other <00:21:56.035>permissions <00:21:56.210>that <00:21:56.385>we <00:21:56.560>checked,

370
00:21:56.850 --> 00:21:59.290
<00:21:56.850>but <00:21:56.966>at <00:21:57.083>least <00:21:57.199>we <00:21:57.316>need <00:21:57.433>to <00:21:57.550>be <00:21:57.666>sure <00:21:57.783>that <00:21:57.899>added <00:21:58.016>permissions <00:21:58.133>are <00:21:58.250>checked.

371
00:21:59.790 --> 00:22:03.210
<00:21:59.790>And <00:21:59.889>so <00:21:59.990>in <00:22:00.090>the <00:22:00.190>rename <00:22:00.290>service <00:22:00.389>we <00:22:00.490>only <00:22:00.590>need <00:22:00.690>to <00:22:00.790>think <00:22:00.889>about <00:22:00.990>like <00:22:01.090>which <00:22:01.190>permissions

372
00:22:03.210 --> 00:22:04.043
<00:22:03.210>do <00:22:03.584>you <00:22:03.959>need?

373
00:22:04.150 --> 00:22:08.610
<00:22:04.150>And <00:22:04.250>like <00:22:04.350>s <00:22:04.450>compiler <00:22:04.550>or <00:22:04.650>type <00:22:04.750>system <00:22:04.850>is <00:22:04.950>going <00:22:05.050>to <00:22:05.150>double <00:22:05.250>check <00:22:05.350>that <00:22:05.450>the <00:22:05.550>controller

374
00:22:08.740 --> 00:22:11.610
<00:22:08.740>controller <00:22:08.915>matches <00:22:09.090>with <00:22:09.265>the <00:22:09.440>service <00:22:09.615>clause. <00:22:09.790>If <00:22:09.965>we <00:22:10.140>call,

375
00:22:11.610 --> 00:22:14.770
<00:22:11.610>call <00:22:11.784>it <00:22:11.959>document <00:22:12.135>different <00:22:12.310>service <00:22:12.485>from <00:22:12.659>this <00:22:12.834>service <00:22:13.010>clause,

376
00:22:15.100 --> 00:22:18.330
<00:22:15.100>again <00:22:15.207>the <00:22:15.315>the <00:22:15.423>compiler <00:22:15.530>is <00:22:15.638>going <00:22:15.746>to <00:22:15.853>check <00:22:15.961>like <00:22:16.069>does <00:22:16.176>it <00:22:16.284>all <00:22:16.392>match <00:22:16.500>up?

377
00:22:18.350 --> 00:22:21.330
<00:22:18.350>And <00:22:18.449>if <00:22:18.550>it <00:22:18.649>doesn't <00:22:18.750>we <00:22:18.850>get <00:22:18.949>a <00:22:19.050>typer <00:22:19.149>and <00:22:19.250>we <00:22:19.350>can <00:22:19.449>figure <00:22:19.550>out <00:22:19.649>like, <00:22:19.750>okay,

378
00:22:21.600 --> 00:22:25.330
<00:22:21.600>what <00:22:21.693>is <00:22:21.786>actually <00:22:21.879>the <00:22:21.973>truth <00:22:22.066>here? <00:22:22.159>Like <00:22:22.253>what <00:22:22.346>is <00:22:22.439>the <00:22:22.533>bug, <00:22:22.626>how <00:22:22.719>do <00:22:22.813>we <00:22:22.906>solve <00:22:23.000>it?

379
00:22:25.510 --> 00:22:28.690
<00:22:25.510>And <00:22:25.603>we <00:22:25.696>have <00:22:25.790>to <00:22:25.883>think <00:22:25.976>very <00:22:26.070>locally <00:22:26.163>and <00:22:26.256>don't <00:22:26.350>have <00:22:26.443>to <00:22:26.536>do <00:22:26.629>the, <00:22:26.723>like <00:22:26.816>this <00:22:26.910>whole,

380
00:22:29.160 --> 00:22:32.610
<00:22:29.160>this <00:22:29.287>controller <00:22:29.414>calls <00:22:29.541>this <00:22:29.669>service <00:22:29.796>like <00:22:29.923>what <00:22:30.050>does <00:22:30.178>it <00:22:30.305>mean <00:22:30.432>for <00:22:30.560>permissions,

381
00:22:32.870 --> 00:22:33.703
<00:22:32.870>et <00:22:33.619>cetera.

382
00:22:34.520 --> 00:22:38.700
<00:22:34.520>And <00:22:34.620>so <00:22:34.720>we <00:22:34.820>are <00:22:34.920>basically <00:22:35.020>checking <00:22:35.120>once <00:22:35.220>at <00:22:35.320>runtime <00:22:35.420>and <00:22:35.520>then <00:22:35.620>passing <00:22:35.720>a <00:22:35.820>token. <00:22:35.920>Um,

383
00:22:38.760 --> 00:22:42.620
<00:22:38.760>and <00:22:38.876>so <00:22:38.993>the <00:22:39.110>controller <00:22:39.226>checks <00:22:39.343>the <00:22:39.460>permission <00:22:39.576>and <00:22:39.693>reveals <00:22:39.810>the <00:22:39.926>permission <00:22:40.043>in <00:22:40.160>the

384
00:22:42.630 --> 00:22:44.500
<00:22:42.630>codes. <00:22:42.863>We <00:22:43.096>can <00:22:43.330>just <00:22:43.563>read <00:22:43.796>the <00:22:44.030>controller,

385
00:22:44.500 --> 00:22:48.380
<00:22:44.500>know <00:22:44.616>you <00:22:44.733>need <00:22:44.850>added <00:22:44.966>permission <00:22:45.083>for <00:22:45.200>that <00:22:45.316>controller <00:22:45.433>and <00:22:45.550>in <00:22:45.666>the <00:22:45.783>service <00:22:45.900>clause,

386
00:22:49.280 --> 00:22:51.260
<00:22:49.280>um, <00:22:49.480>we <00:22:49.680>could <00:22:49.879>be <00:22:50.080>checking <00:22:50.280>it <00:22:50.480>at <00:22:50.680>runtime,

387
00:22:51.260 --> 00:22:55.420
<00:22:51.260>but <00:22:51.360>then <00:22:51.460>we'd <00:22:51.560>have <00:22:51.660>these <00:22:51.760>checks <00:22:51.860>everywhere <00:22:51.960>in <00:22:52.060>the <00:22:52.160>codes <00:22:52.260>like <00:22:52.360>do <00:22:52.460>you <00:22:52.560>have <00:22:52.660>added

388
00:22:55.420 --> 00:22:57.820
<00:22:55.420>permission <00:22:55.620>or <00:22:55.820>if <00:22:56.020>no <00:22:56.220>return <00:22:56.420>error, <00:22:56.620>et <00:22:56.820>cetera.

389
00:22:58.660 --> 00:23:03.450
<00:22:58.660>While <00:22:58.787>we <00:22:58.914>know <00:22:59.041>it <00:22:59.169>shouldn't <00:22:59.296>happen <00:22:59.423>anyway <00:22:59.550>because <00:22:59.678>we <00:22:59.805>can <00:22:59.932>guarantee <00:23:00.060>using

390
00:23:03.470 --> 00:23:06.410
<00:23:03.470>the <00:23:03.610>type <00:23:03.750>system <00:23:03.890>that <00:23:04.030>you <00:23:04.170>have <00:23:04.310>checked <00:23:04.450>it <00:23:04.590>in <00:23:04.730>the <00:23:04.870>controller.

391
00:23:06.670 --> 00:23:10.090
<00:23:06.670>So <00:23:06.763>this <00:23:06.856>is <00:23:06.950>a <00:23:07.043>really <00:23:07.136>nice <00:23:07.230>way <00:23:07.323>to <00:23:07.416>not <00:23:07.510>literal <00:23:07.603>our <00:23:07.696>codes <00:23:07.790>and <00:23:07.883>to <00:23:07.976>allow <00:23:08.070>the

392
00:23:10.090 --> 00:23:11.730
<00:23:10.090>TypeScript <00:23:10.370>to <00:23:10.649>checker <00:23:10.929>to <00:23:11.209>do <00:23:11.490>this.

393
00:23:12.310 --> 00:23:16.050
<00:23:12.310>And <00:23:12.403>this <00:23:12.496>is <00:23:12.590>something <00:23:12.683>that <00:23:12.776>you <00:23:12.870>cannot <00:23:12.963>do <00:23:13.056>in <00:23:13.149>rust <00:23:13.243>as <00:23:13.336>far <00:23:13.429>as <00:23:13.523>I <00:23:13.616>know. <00:23:13.710>Uh,

394
00:23:16.050 --> 00:23:19.970
<00:23:16.050>it <00:23:16.205>was <00:23:16.361>modeled <00:23:16.516>after <00:23:16.672>OCaml <00:23:16.827>polymorphic <00:23:16.983>variance, <00:23:17.138>but <00:23:17.294>if <00:23:17.450>you,

395
00:23:20.230 --> 00:23:21.450
<00:23:20.230>you <00:23:20.413>want <00:23:20.596>to <00:23:20.779>copy <00:23:20.962>this <00:23:21.145>to <00:23:21.328>rust,

396
00:23:21.650 --> 00:23:26.560
<00:23:21.650>I <00:23:21.757>think <00:23:21.865>you <00:23:21.973>will <00:23:22.080>find <00:23:22.188>a <00:23:22.296>hard <00:23:22.403>time <00:23:22.511>implementing <00:23:22.619>something <00:23:22.726>like <00:23:22.834>this. <00:23:22.942>And <00:23:23.050>so,

397
00:23:26.630 --> 00:23:29.740
<00:23:26.630>okay, <00:23:26.910>uh, <00:23:27.190>where <00:23:27.470>does <00:23:27.750>TypeScript <00:23:28.030>stands?

398
00:23:30.440 --> 00:23:35.340
<00:23:30.440>So <00:23:30.567>and <00:23:30.694>TypeScript <00:23:30.821>can <00:23:30.949>build <00:23:31.076>really <00:23:31.203>extremely <00:23:31.330>type <00:23:31.458>safe <00:23:31.585>APIs <00:23:31.712>and <00:23:31.840>anything

399
00:23:35.360 --> 00:23:40.190
<00:23:35.360>can <00:23:35.459>be <00:23:35.560>dive <00:23:35.659>safe <00:23:35.760>really <00:23:35.860>because <00:23:35.959>you <00:23:36.060>have <00:23:36.159>this <00:23:36.260>during <00:23:36.360>complete <00:23:36.459>type <00:23:36.560>system <00:23:36.659>and <00:23:36.760>it

400
00:23:40.190 --> 00:23:43.550
<00:23:40.190>allows <00:23:40.297>you <00:23:40.405>to <00:23:40.513>have <00:23:40.620>really <00:23:40.728>fast <00:23:40.836>feedback <00:23:40.943>and <00:23:41.051>you <00:23:41.159>can <00:23:41.266>stop <00:23:41.374>thinking <00:23:41.482>more <00:23:41.590>details.

401
00:23:43.580 --> 00:23:45.640
<00:23:43.580>Like <00:23:43.707>we <00:23:43.834>are <00:23:43.961>not <00:23:44.089>thinking <00:23:44.216>about <00:23:44.343>our <00:23:44.470>rest <00:23:44.598>a <00:23:44.725>p <00:23:44.852>I <00:23:44.980>anymore.

402
00:23:45.810 --> 00:23:48.320
<00:23:45.810>We're <00:23:45.985>not <00:23:46.159>thinking <00:23:46.335>about <00:23:46.510>access <00:23:46.685>control <00:23:46.860>as <00:23:47.034>much <00:23:47.210>anymore.

403
00:23:48.590 --> 00:23:50.880
<00:23:48.590>Like <00:23:48.823>it's <00:23:49.056>very <00:23:49.290>easy <00:23:49.523>to <00:23:49.756>do <00:23:49.990>the,

404
00:23:51.450 --> 00:23:55.790
<00:23:51.450>to <00:23:51.543>look <00:23:51.636>at <00:23:51.730>the <00:23:51.823>business <00:23:51.916>logic <00:23:52.010>and <00:23:52.103>really <00:23:52.196>focus <00:23:52.290>on <00:23:52.383>that <00:23:52.476>and <00:23:52.570>adding <00:23:52.663>value <00:23:52.756>to <00:23:52.850>the

405
00:23:55.790 --> 00:24:00.270
<00:23:55.790>company. <00:23:55.906>Um, <00:23:56.023>the <00:23:56.139>downside <00:23:56.256>is <00:23:56.373>that <00:23:56.490>sometimes <00:23:56.606>you <00:23:56.723>have <00:23:56.840>to <00:23:56.956>move <00:23:57.073>back, <00:23:57.190>uh,

406
00:24:00.290 --> 00:24:02.430
<00:24:00.290>for <00:24:00.523>your <00:24:00.756>implementation <00:24:00.990>to <00:24:01.223>the <00:24:01.456>JavaScript <00:24:01.690>site,

407
00:24:02.770 --> 00:24:06.990
<00:24:02.770>but <00:24:02.877>it's <00:24:02.985>usually <00:24:03.093>very <00:24:03.200>contained <00:24:03.308>and <00:24:03.416>you <00:24:03.523>can <00:24:03.631>really <00:24:03.739>make <00:24:03.846>sure <00:24:03.954>that <00:24:04.062>you <00:24:04.170>unit

408
00:24:06.990 --> 00:24:10.030
<00:24:06.990>tested <00:24:07.223>that <00:24:07.456>part <00:24:07.690>really <00:24:07.923>well. <00:24:08.156>And <00:24:08.390>anyway,

409
00:24:10.030 --> 00:24:12.190
<00:24:10.030>you're <00:24:10.157>using <00:24:10.284>it <00:24:10.411>so <00:24:10.539>often <00:24:10.666>that <00:24:10.793>you <00:24:10.920>will <00:24:11.048>see <00:24:11.175>that <00:24:11.302>there <00:24:11.430>are,

410
00:24:12.190 --> 00:24:16.440
<00:24:12.190>when <00:24:12.306>there <00:24:12.423>are <00:24:12.540>bricks <00:24:12.656>you'll <00:24:12.773>probably <00:24:12.890>notice <00:24:13.006>it <00:24:13.123>anyway. <00:24:13.240>The <00:24:13.356>other <00:24:13.473>downside <00:24:13.590>is,

411
00:24:16.500 --> 00:24:18.560
<00:24:16.500>uh, <00:24:16.640>the <00:24:16.780>syntax <00:24:16.920>that <00:24:17.060>I <00:24:17.200>mentioned <00:24:17.340>about <00:24:17.480>in <00:24:17.620>the <00:24:17.760>second <00:24:17.900>part,

412
00:24:18.830 --> 00:24:23.760
<00:24:18.830>like <00:24:18.929>really <00:24:19.030>I <00:24:19.129>would <00:24:19.230>love <00:24:19.330>Fort <00:24:19.429>two <00:24:19.530>to <00:24:19.629>have <00:24:19.730>better <00:24:19.830>syntax. <00:24:19.929>I <00:24:20.030>think <00:24:20.129>that's <00:24:20.230>um,

413
00:24:23.910 --> 00:24:27.790
<00:24:23.910>something <00:24:24.050>that's <00:24:24.190>um, <00:24:24.330>it's <00:24:24.470>not <00:24:24.610>up <00:24:24.750>to <00:24:24.890>us <00:24:25.030>or <00:24:25.170>whatever. <00:24:25.310>So,

414
00:24:29.120 --> 00:24:31.020
<00:24:29.120>uh, <00:24:29.399>and <00:24:29.679>then <00:24:29.959>for <00:24:30.239>limitations, <00:24:30.520>uh,

415
00:24:31.160 --> 00:24:34.780
<00:24:31.160>if <00:24:31.253>you <00:24:31.346>really <00:24:31.440>go <00:24:31.533>into <00:24:31.626>this <00:24:31.720>you'll <00:24:31.813>see <00:24:31.906>that <00:24:32.000>sometimes <00:24:32.093>you <00:24:32.186>can <00:24:32.280>get <00:24:32.373>into <00:24:32.466>a <00:24:32.560>like

416
00:24:34.780 --> 00:24:37.100
<00:24:34.780>basically <00:24:34.980>types <00:24:35.180>it <00:24:35.379>saying <00:24:35.580>I <00:24:35.780>cannot <00:24:35.980>compute <00:24:36.180>this,

417
00:24:37.100 --> 00:24:38.700
<00:24:37.100>like <00:24:37.300>what <00:24:37.500>you <00:24:37.699>gave <00:24:37.899>me <00:24:38.100>is <00:24:38.300>so <00:24:38.500>complex,

418
00:24:39.210 --> 00:24:44.020
<00:24:39.210>like <00:24:39.303>I <00:24:39.396>can't <00:24:39.490>compute <00:24:39.583>this <00:24:39.676>in <00:24:39.770>a <00:24:39.863>reasonable <00:24:39.956>time <00:24:40.050>and <00:24:40.143>like <00:24:40.236>I <00:24:40.330>want <00:24:40.423>the <00:24:40.516>type <00:24:40.610>checker

419
00:24:44.020 --> 00:24:48.180
<00:24:44.020>to <00:24:44.127>hands <00:24:44.235>reasonably, <00:24:44.343>like <00:24:44.450>I <00:24:44.558>don't <00:24:44.666>want <00:24:44.773>the <00:24:44.881>type <00:24:44.989>checker <00:24:45.096>to <00:24:45.204>take <00:24:45.312>an <00:24:45.420>hour.

420
00:24:48.520 --> 00:24:50.900
<00:24:48.520>So <00:24:48.647>like <00:24:48.774>I'm <00:24:48.901>just <00:24:49.029>going <00:24:49.156>to <00:24:49.283>say <00:24:49.410>like <00:24:49.538>this <00:24:49.665>is <00:24:49.792>an <00:24:49.920>error.

421
00:24:51.090 --> 00:24:54.740
<00:24:51.090>Like <00:24:51.217>can <00:24:51.344>you <00:24:51.471>make <00:24:51.599>this <00:24:51.726>easier <00:24:51.853>for <00:24:51.980>me? <00:24:52.108>Uh, <00:24:52.235>as <00:24:52.362>I <00:24:52.490>mentioned,

422
00:24:54.740 --> 00:24:59.460
<00:24:54.740>the <00:24:54.880>syntax <00:24:55.020>needs <00:24:55.160>improvements <00:24:55.300>and <00:24:55.440>then <00:24:55.580>where <00:24:55.720>I <00:24:55.860>think <00:24:56.000>rust <00:24:56.140>shines

423
00:24:59.560 --> 00:25:04.500
<00:24:59.560>is <00:24:59.687>um, <00:24:59.814>it <00:24:59.941>doesn't <00:25:00.069>have <00:25:00.196>escape <00:25:00.323>patches. <00:25:00.450>So <00:25:00.578>you <00:25:00.705>know <00:25:00.832>that <00:25:00.960>uh,

424
00:25:05.650 --> 00:25:08.600
<00:25:05.650>there <00:25:05.790>are <00:25:05.930>no <00:25:06.070>escape <00:25:06.210>patches. <00:25:06.350>If <00:25:06.490>it <00:25:06.630>compiles, <00:25:06.770>it's <00:25:06.910>probably <00:25:07.050>correct.

425
00:25:08.830 --> 00:25:12.600
<00:25:08.830>Like <00:25:08.937>your <00:25:09.045>colleagues <00:25:09.153>can't <00:25:09.260>have <00:25:09.368>editor <00:25:09.476>or <00:25:09.583>you <00:25:09.691>yourself <00:25:09.799>can't <00:25:09.906>have <00:25:10.014>edit <00:25:10.122>on <00:25:10.230>any

426
00:25:12.600 --> 00:25:15.320
<00:25:12.600>type <00:25:12.716>kind <00:25:12.833>of <00:25:12.949>say <00:25:13.066>like <00:25:13.183>this <00:25:13.300>is <00:25:13.416>fine. <00:25:13.533>But <00:25:13.649>on <00:25:13.766>the <00:25:13.883>other <00:25:14.000>hand,

427
00:25:15.480 --> 00:25:18.400
<00:25:15.480>I <00:25:15.580>think <00:25:15.680>these <00:25:15.780>escape <00:25:15.880>patches <00:25:15.980>are <00:25:16.080>also <00:25:16.180>one <00:25:16.280>of <00:25:16.380>the <00:25:16.480>things <00:25:16.580>that <00:25:16.680>makes <00:25:16.780>it <00:25:16.880>really

428
00:25:18.880 --> 00:25:23.780
<00:25:18.880>powerful <00:25:18.987>because <00:25:19.095>you <00:25:19.203>can <00:25:19.310>say <00:25:19.418>sometimes <00:25:19.526>like <00:25:19.633>actually <00:25:19.741>here <00:25:19.849>I <00:25:19.956>tell <00:25:20.064>you <00:25:20.172>it's <00:25:20.280>fine.

429
00:25:24.060 --> 00:25:25.140
<00:25:24.060>I <00:25:24.254>know <00:25:24.448>you <00:25:24.643>can't <00:25:24.837>prove <00:25:25.032>it,

430
00:25:25.360 --> 00:25:28.300
<00:25:25.360>but <00:25:25.447>just <00:25:25.534>assume <00:25:25.622>it <00:25:25.709>and <00:25:25.797>then <00:25:25.885>it's <00:25:25.972>going <00:25:26.060>to <00:25:26.147>be <00:25:26.235>really <00:25:26.322>type <00:25:26.409>save <00:25:26.497>on <00:25:26.584>the <00:25:26.672>other <00:25:26.760>end.

431
00:25:28.560 --> 00:25:32.300
<00:25:28.560>So <00:25:28.687>it's <00:25:28.814>like <00:25:28.941>both <00:25:29.069>a <00:25:29.196>limitation <00:25:29.323>and <00:25:29.450>a <00:25:29.578>power <00:25:29.705>and <00:25:29.832>um, <00:25:29.960>yeah.

432
00:25:33.530 --> 00:25:37.230
<00:25:33.530>So <00:25:33.646>I <00:25:33.763>think <00:25:33.879>if <00:25:33.996>you <00:25:34.113>want <00:25:34.230>to <00:25:34.346>move <00:25:34.463>fast <00:25:34.580>and <00:25:34.696>don't <00:25:34.813>break <00:25:34.930>things,

433
00:25:37.710 --> 00:25:41.670
<00:25:37.710>I <00:25:37.810>think <00:25:37.910>it <00:25:38.010>should <00:25:38.110>embrace <00:25:38.210>types <00:25:38.310>kits. <00:25:38.410>Uh, <00:25:38.510>if <00:25:38.610>you <00:25:38.710>want <00:25:38.810>to <00:25:38.910>know <00:25:39.010>how, <00:25:39.110>uh,

434
00:25:41.990 --> 00:25:45.430
<00:25:41.990>I <00:25:42.223>suggest <00:25:42.456>um, <00:25:42.690>these <00:25:42.923>three <00:25:43.156>uh, <00:25:43.390>resources,

435
00:25:45.620 --> 00:25:49.950
<00:25:45.620>they're <00:25:45.820>in <00:25:46.020>order <00:25:46.219>of, <00:25:46.419>um, <00:25:46.620>cost <00:25:46.820>and <00:25:47.020>yeah,

436
00:25:50.460 --> 00:25:53.830
<00:25:50.460>they <00:25:50.560>should <00:25:50.660>all <00:25:50.760>uh, <00:25:50.860>talk <00:25:50.960>about <00:25:51.060>these <00:25:51.160>kind <00:25:51.260>of <00:25:51.360>things <00:25:51.460>that <00:25:51.560>I <00:25:51.660>talked <00:25:51.760>about <00:25:51.860>today.

437
00:25:54.060 --> 00:25:57.790
<00:25:54.060>Like <00:25:54.187>how <00:25:54.314>to <00:25:54.441>apply <00:25:54.569>them, <00:25:54.696>how <00:25:54.823>to <00:25:54.950>like <00:25:55.078>get <00:25:55.205>them <00:25:55.332>more <00:25:55.460>them,

438
00:25:58.050 --> 00:25:59.670
<00:25:58.050>get <00:25:58.283>to <00:25:58.516>know <00:25:58.750>them <00:25:58.983>more <00:25:59.216>and <00:25:59.450>um,

439
00:26:00.730 --> 00:26:04.330
<00:26:00.730>act <00:26:00.857>practice <00:26:00.984>them <00:26:01.111>so <00:26:01.239>you <00:26:01.366>can <00:26:01.493>get <00:26:01.620>them <00:26:01.748>like <00:26:01.875>honor <00:26:02.002>your, <00:26:02.130>yeah,

440
00:26:05.110 --> 00:26:06.970
<00:26:05.110>and <00:26:05.389>I <00:26:05.669>think <00:26:05.949>that's <00:26:06.229>it. <00:26:06.510>So

441
00:26:11.710 --> 00:26:12.543
<00:26:11.710>Thank <00:26:11.959>you <00:26:12.209>so <00:26:12.459>much.

442
00:26:13.940 --> 00:26:18.280
<00:26:13.940>So <00:26:14.027>there <00:26:14.115>is <00:26:14.202>quite <00:26:14.290>some <00:26:14.377>questions <00:26:14.465>coming <00:26:14.552>in <00:26:14.640>and <00:26:14.727>we <00:26:14.815>do <00:26:14.902>have <00:26:14.990>time <00:26:15.077>for <00:26:15.165>some <00:26:15.252>of <00:26:15.340>them.

443
00:26:18.940 --> 00:26:23.520
<00:26:18.940>So <00:26:19.056>let's <00:26:19.173>start, <00:26:19.290>are <00:26:19.406>there <00:26:19.523>any <00:26:19.640>integrations <00:26:19.756>for <00:26:19.873>TypeScript <00:26:19.990>with <00:26:20.106>the <00:26:20.223>Java <00:26:20.340>backend?

444
00:26:24.400 --> 00:26:26.220
<00:26:24.400>Um, <00:26:24.680>not <00:26:24.960>that <00:26:25.240>I <00:26:25.520>know <00:26:25.800>of.

445
00:26:27.420 --> 00:26:30.790
<00:26:27.420>Okay. <00:26:27.653>Does <00:26:27.886>this <00:26:28.120>answer <00:26:28.353>your <00:26:28.586>question? <00:26:28.820>Uh,

446
00:26:31.360 --> 00:26:35.070
<00:26:31.360>would <00:26:31.487>you <00:26:31.614>recommend <00:26:31.741>using <00:26:31.869>enums <00:26:31.996>or <00:26:32.123>do <00:26:32.250>you <00:26:32.378>have <00:26:32.505>a <00:26:32.632>better <00:26:32.760>alternative?

447
00:26:35.730 --> 00:26:36.670
<00:26:35.730>Um, <00:26:36.576>yeah,

448
00:26:37.210 --> 00:26:41.390
<00:26:37.210>so <00:26:37.365>I'm <00:26:37.521>guessing <00:26:37.676>we're <00:26:37.832>talking <00:26:37.987>about <00:26:38.143>actual <00:26:38.298>TypeScript <00:26:38.454>ins. <00:26:38.610>Um,

449
00:26:42.090 --> 00:26:44.360
<00:26:42.090>for <00:26:42.370>us <00:26:42.649>we're <00:26:42.929>using <00:26:43.209>just <00:26:43.490>um,

450
00:26:45.950 --> 00:26:48.020
<00:26:45.950>union <00:26:46.416>types <00:26:46.883>instead. <00:26:47.350>Um,

451
00:26:49.030 --> 00:26:52.760
<00:26:49.030>there <00:26:49.205>like <00:26:49.379>some <00:26:49.555>people <00:26:49.730>prefer <00:26:49.905>ANUMs <00:26:50.080>but <00:26:50.254>um, <00:26:50.430>I,

452
00:26:52.880 --> 00:26:56.560
<00:26:52.880>I <00:26:52.973>think <00:26:53.066>union <00:26:53.160>types <00:26:53.253>are <00:26:53.346>so <00:26:53.440>powerful <00:26:53.533>that <00:26:53.626>there <00:26:53.720>is <00:26:53.813>no <00:26:53.906>really <00:26:54.000>need <00:26:54.093>for <00:26:54.186>ANUMs <00:26:54.280>and

453
00:26:56.560 --> 00:26:59.040
<00:26:56.560>then <00:26:56.700>you're <00:26:56.840>staying <00:26:56.980>away <00:26:57.120>from <00:26:57.260>this <00:26:57.399>feature <00:26:57.540>that's <00:26:57.679>is <00:26:57.820>more <00:26:57.960>types.

454
00:26:59.040 --> 00:27:02.920
<00:26:59.040>That's <00:26:59.139>one <00:26:59.240>of <00:26:59.340>those <00:26:59.440>feature <00:26:59.540>that <00:26:59.639>was <00:26:59.740>added <00:26:59.840>in <00:26:59.940>the <00:27:00.040>beginning <00:27:00.139>and <00:27:00.240>I <00:27:00.340>think <00:27:00.440>is

455
00:27:02.920 --> 00:27:06.320
<00:27:02.920>moving <00:27:03.047>away <00:27:03.174>from <00:27:03.301>adding, <00:27:03.429>adding <00:27:03.556>features <00:27:03.683>to <00:27:03.810>the <00:27:03.938>JavaScripts. <00:27:04.065>And <00:27:04.192>so, <00:27:04.320>uh,

456
00:27:06.350 --> 00:27:09.240
<00:27:06.350>enum <00:27:06.466>is <00:27:06.583>one <00:27:06.699>of <00:27:06.816>these <00:27:06.933>features <00:27:07.050>that <00:27:07.166>have <00:27:07.283>a <00:27:07.399>different <00:27:07.516>representation <00:27:07.633>at <00:27:07.750>runtime

457
00:27:09.580 --> 00:27:12.960
<00:27:09.580>and <00:27:09.696>so <00:27:09.813>that's <00:27:09.929>why <00:27:10.046>we <00:27:10.163>stay <00:27:10.280>away <00:27:10.396>from <00:27:10.513>it. <00:27:10.629>But <00:27:10.746>there's <00:27:10.863>no, <00:27:10.980>like,

458
00:27:12.960 --> 00:27:16.240
<00:27:12.960>it's <00:27:13.053>not <00:27:13.146>bad <00:27:13.240>if <00:27:13.333>you <00:27:13.426>use <00:27:13.520>it, <00:27:13.613>I <00:27:13.706>would <00:27:13.800>say. <00:27:13.893>Um, <00:27:13.986>it's <00:27:14.080>just <00:27:14.173>a <00:27:14.266>personal <00:27:14.360>preference.

459
00:27:17.560 --> 00:27:21.100
<00:27:17.560>Thanks. <00:27:17.760>If <00:27:17.960>you <00:27:18.159>need <00:27:18.360>to <00:27:18.560>use <00:27:18.760>arbitrary <00:27:18.960>types,

460
00:27:21.520 --> 00:27:25.340
<00:27:21.520>do <00:27:21.620>you <00:27:21.720>declare <00:27:21.820>them <00:27:21.920>in <00:27:22.020>the <00:27:22.120>same <00:27:22.220>file <00:27:22.320>where <00:27:22.420>they're <00:27:22.520>used <00:27:22.620>or <00:27:22.720>create <00:27:22.820>a <00:27:22.920>separate

461
00:27:25.450 --> 00:27:28.020
<00:27:25.450>file <00:27:25.730>which <00:27:26.010>only <00:27:26.290>contains <00:27:26.570>their <00:27:26.850>types?

462
00:27:29.040 --> 00:27:32.940
<00:27:29.040>Uh, <00:27:29.156>I <00:27:29.273>think <00:27:29.389>it <00:27:29.506>depends. <00:27:29.623>Uh, <00:27:29.740>it's <00:27:29.856>similar <00:27:29.973>to <00:27:30.090>quotes. <00:27:30.206>Like <00:27:30.323>I <00:27:30.440>would,

463
00:27:33.360 --> 00:27:36.220
<00:27:33.360>I'm <00:27:33.453>going <00:27:33.546>to <00:27:33.639>answer <00:27:33.733>like <00:27:33.826>where <00:27:33.919>would <00:27:34.013>you <00:27:34.106>put <00:27:34.199>a <00:27:34.293>function <00:27:34.386>that <00:27:34.479>you <00:27:34.573>only <00:27:34.666>use <00:27:34.760>in

464
00:27:36.270 --> 00:27:39.140
<00:27:36.270>amary <00:27:36.503>Places <00:27:36.736>like <00:27:36.970>types <00:27:37.203>are <00:27:37.436>just <00:27:37.670>codes,

465
00:27:39.170 --> 00:27:41.140
<00:27:39.170>like <00:27:39.450>it's <00:27:39.730>literally <00:27:40.010>type <00:27:40.290>level <00:27:40.570>programming,

466
00:27:41.160 --> 00:27:45.020
<00:27:41.160>but <00:27:41.253>the <00:27:41.346>types <00:27:41.440>are <00:27:41.533>programs <00:27:41.626>so <00:27:41.720>like <00:27:41.813>put <00:27:41.906>them <00:27:42.000>in <00:27:42.093>the <00:27:42.186>files <00:27:42.280>for <00:27:42.373>you <00:27:42.466>with <00:27:42.560>them,

467
00:27:45.080 --> 00:27:47.420
<00:27:45.080>put <00:27:45.280>your <00:27:45.480>normal <00:27:45.679>codes, <00:27:45.879>like <00:27:46.080>similar <00:27:46.280>rules <00:27:46.480>apply.

468
00:27:48.080 --> 00:27:51.060
<00:27:48.080>So <00:27:48.207>there's <00:27:48.334>also <00:27:48.461>request <00:27:48.589>if <00:27:48.716>you <00:27:48.843>could <00:27:48.970>post <00:27:49.098>the <00:27:49.225>resources <00:27:49.352>in <00:27:49.480>here.

469
00:27:51.160 --> 00:27:53.260
<00:27:51.160>So <00:27:51.360>maybe <00:27:51.560>where <00:27:51.760>can <00:27:51.960>they <00:27:52.160>get <00:27:52.360>the <00:27:52.560>resources?

470
00:27:53.960 --> 00:27:58.340
<00:27:53.960>Um, <00:27:54.087>like <00:27:54.214>you <00:27:54.341>could <00:27:54.469>I <00:27:54.596>put <00:27:54.723>a <00:27:54.850>in <00:27:54.978>the <00:27:55.105>beginning <00:27:55.232>my <00:27:55.360>uh

471
00:27:58.490 --> 00:28:00.620
<00:27:58.490>yeah.com. <00:27:59.890>Yeah,

472
00:28:00.620 --> 00:28:05.500
<00:28:00.620>Yeah, <00:28:00.727>exactly. <00:28:00.835>Could <00:28:00.943>you <00:28:01.050>please <00:28:01.158>share <00:28:01.266>it? <00:28:01.373>Thanks. <00:28:01.481>Yeah. <00:28:01.589>Uh, <00:28:01.696>okay, <00:28:01.804>next <00:28:01.912>one. <00:28:02.020>Um,

473
00:28:07.090 --> 00:28:10.230
<00:28:07.090>can <00:28:07.245>you <00:28:07.401>explain <00:28:07.556>in <00:28:07.712>more <00:28:07.867>detail <00:28:08.023>what <00:28:08.178>type <00:28:08.334>land <00:28:08.490>is?

474
00:28:10.780 --> 00:28:13.350
<00:28:10.780>Yeah. <00:28:11.060>Okay, <00:28:11.340>so <00:28:11.620>type <00:28:11.899>plans. <00:28:12.180>Um,

475
00:28:15.490 --> 00:28:19.590
<00:28:15.490>that's <00:28:15.645>a <00:28:15.801>really <00:28:15.956>good <00:28:16.112>question. <00:28:16.267>So <00:28:16.423>there <00:28:16.578>is <00:28:16.734>really, <00:28:16.890>oh,

476
00:28:21.730 --> 00:28:24.430
<00:28:21.730>so <00:28:21.905>when <00:28:22.080>I <00:28:22.255>say <00:28:22.430>tie <00:28:22.605>plant, <00:28:22.780>it's <00:28:22.955>because, <00:28:23.130>um,

477
00:28:25.090 --> 00:28:26.790
<00:28:25.090>you <00:28:25.370>have <00:28:25.649>failures <00:28:25.929>in <00:28:26.209>tie <00:28:26.490>plant,

478
00:28:26.790 --> 00:28:31.150
<00:28:26.790>which <00:28:26.917>are <00:28:27.044>basically <00:28:27.171>types <00:28:27.299>and <00:28:27.426>you <00:28:27.553>have <00:28:27.680>failures <00:28:27.808>in <00:28:27.935>in <00:28:28.062>code <00:28:28.190>lands,

479
00:28:31.150 --> 00:28:35.190
<00:28:31.150>which <00:28:31.243>is <00:28:31.336>what <00:28:31.430>you <00:28:31.523>have <00:28:31.616>left <00:28:31.710>over <00:28:31.803>at <00:28:31.896>runtime. <00:28:31.990>And <00:28:32.083>so <00:28:32.176>when <00:28:32.270>I <00:28:32.363>say <00:28:32.456>tie <00:28:32.550>plant,

480
00:28:35.210 --> 00:28:37.540
<00:28:35.210>it <00:28:35.676>means <00:28:36.143>like, <00:28:36.610>uh,

481
00:28:37.600 --> 00:28:41.260
<00:28:37.600>the <00:28:37.740>types <00:28:37.879>you <00:28:38.020>like <00:28:38.159>in <00:28:38.300>pipeline <00:28:38.439>is <00:28:38.580>it's <00:28:38.719>talking <00:28:38.860>about <00:28:39.000>types,

482
00:28:41.530 --> 00:28:43.780
<00:28:41.530>it's <00:28:41.685>not <00:28:41.841>talking <00:28:41.996>about <00:28:42.152>actual <00:28:42.307>values <00:28:42.463>they <00:28:42.618>have <00:28:42.774>at <00:28:42.930>runtime.

483
00:28:43.880 --> 00:28:46.300
<00:28:43.880>That's <00:28:44.055>kind <00:28:44.230>of <00:28:44.405>if <00:28:44.580>I <00:28:44.755>have <00:28:44.930>to <00:28:45.105>summarize <00:28:45.280>it.

484
00:28:47.410 --> 00:28:50.460
<00:28:47.410>Okay. <00:28:47.610>Type <00:28:47.810>versus <00:28:48.010>interface. <00:28:48.210>What <00:28:48.410>is <00:28:48.610>your <00:28:48.810>favorite?

485
00:28:51.700 --> 00:28:54.120
<00:28:51.700>Uh, <00:28:51.980>we <00:28:52.260>use <00:28:52.540>type <00:28:52.820>but <00:28:53.100>uh,

486
00:28:54.590 --> 00:28:57.920
<00:28:54.590>sometimes <00:28:54.730>we <00:28:54.870>use <00:28:55.010>interfaces <00:28:55.149>if <00:28:55.290>we <00:28:55.429>need <00:28:55.570>to <00:28:55.709>use <00:28:55.850>interface <00:28:55.990>merging.

487
00:29:00.590 --> 00:29:03.290
<00:29:00.590>And <00:29:00.764>what <00:29:00.939>do <00:29:01.115>you <00:29:01.290>think <00:29:01.465>of <00:29:01.639>namespace <00:29:01.814>in <00:29:01.990>TypeScript?

488
00:29:03.910 --> 00:29:06.570
<00:29:03.910>Uh, <00:29:04.085>I <00:29:04.260>would <00:29:04.435>say <00:29:04.610>similar <00:29:04.785>to <00:29:04.960>ANUMs. <00:29:05.135>Like, <00:29:05.310>um,

489
00:29:06.880 --> 00:29:10.690
<00:29:06.880>it's <00:29:07.055>an <00:29:07.230>old <00:29:07.405>feature <00:29:07.580>TypeScript <00:29:07.755>itself. <00:29:07.930>The <00:29:08.105>typescripts <00:29:08.280>uh,

490
00:29:10.740 --> 00:29:13.010
<00:29:10.740>types <00:29:10.895>checker <00:29:11.051>code <00:29:11.206>base <00:29:11.362>has <00:29:11.517>moved <00:29:11.673>away <00:29:11.828>from <00:29:11.984>them <00:29:12.140>recently.

491
00:29:13.550 --> 00:29:18.210
<00:29:13.550>So <00:29:13.649>I <00:29:13.750>think <00:29:13.850>that's <00:29:13.950>kind <00:29:14.050>of <00:29:14.149>like <00:29:14.250>a <00:29:14.350>hint <00:29:14.450>that <00:29:14.550>they <00:29:14.649>should <00:29:14.750>be <00:29:14.850>deprecated <00:29:14.950>and

492
00:29:18.550 --> 00:29:20.050
<00:29:18.550>you <00:29:18.742>should <00:29:18.935>try <00:29:19.128>to <00:29:19.321>move <00:29:19.514>away <00:29:19.707>from <00:29:19.899>them.

493
00:29:21.150 --> 00:29:23.040
<00:29:21.150>Okay. <00:29:21.325>So <00:29:21.500>the <00:29:21.675>last <00:29:21.850>one <00:29:22.025>is <00:29:22.200>a <00:29:22.375>bit <00:29:22.550>long.

494
00:29:23.280 --> 00:29:26.000
<00:29:23.280>I <00:29:23.420>would <00:29:23.560>say <00:29:23.700>so <00:29:23.840>there <00:29:23.980>is <00:29:24.120>one <00:29:24.260>that <00:29:24.399>I <00:29:24.540>actually <00:29:24.680>skipped,

495
00:29:26.000 --> 00:29:29.280
<00:29:26.000>which <00:29:26.107>is <00:29:26.215>when <00:29:26.323>to <00:29:26.430>use <00:29:26.538>enum <00:29:26.646>and <00:29:26.753>when <00:29:26.861>to <00:29:26.969>use <00:29:27.076>a <00:29:27.184>specific <00:29:27.292>string <00:29:27.400>type.

496
00:29:30.100 --> 00:29:34.520
<00:29:30.100>Um, <00:29:30.199>yeah, <00:29:30.300>that, <00:29:30.399>that's <00:29:30.500>similar <00:29:30.600>to <00:29:30.699>the <00:29:30.800>enum <00:29:30.899>one. <00:29:31.000>I <00:29:31.100>think <00:29:31.199>like <00:29:31.300>we <00:29:31.399>use <00:29:31.500>uh,

497
00:29:34.520 --> 00:29:39.210
<00:29:34.520>string <00:29:34.620>types, <00:29:34.720>uh, <00:29:34.820>very <00:29:34.920>like <00:29:35.020>a <00:29:35.120>lot <00:29:35.220>and <00:29:35.320>we <00:29:35.420>don't <00:29:35.520>have <00:29:35.620>a <00:29:35.720>problem <00:29:35.820>with <00:29:35.920>it,

498
00:29:39.270 --> 00:29:41.490
<00:29:39.270>but <00:29:39.503>yeah, <00:29:39.736>your <00:29:39.970>mileage <00:29:40.203>might <00:29:40.436>vary. <00:29:40.670>Awesome.

499
00:29:41.500 --> 00:29:44.490
<00:29:41.500>Thank <00:29:41.616>you <00:29:41.733>so <00:29:41.850>much. <00:29:41.966>That <00:29:42.083>was <00:29:42.200>almost <00:29:42.316>all. <00:29:42.433>Thank <00:29:42.550>you <00:29:42.666>all <00:29:42.783>for <00:29:42.900>coming.