WEBVTT

1
00:00:05.200 --> 00:00:09.720
<v Speaker 1>Hello, everybody, Welcome to another thrilling episode. I was going

2
00:00:09.800 --> 00:00:14.359
<v Speaker 1>to say, example episode of JavaScript. Jower, I am Steve Edwards,

3
00:00:14.359 --> 00:00:16.039
<v Speaker 1>the host with the face for radio and the voice

4
00:00:16.079 --> 00:00:18.480
<v Speaker 1>for being a mine, but Dan got to me the host,

5
00:00:18.480 --> 00:00:24.320
<v Speaker 1>so you're stuck with me speaking of panelists. Was I

6
00:00:24.359 --> 00:00:25.239
<v Speaker 1>speaking of panelists?

7
00:00:25.239 --> 00:00:25.640
<v Speaker 2>Now I am?

8
00:00:25.719 --> 00:00:28.600
<v Speaker 1>Anyway, Dan Shapiro is here with me. We are flying

9
00:00:28.600 --> 00:00:31.320
<v Speaker 1>solo today. How you doing, Dan, I'm doing great.

10
00:00:32.119 --> 00:00:33.640
<v Speaker 2>So let's do our usual weather report.

11
00:00:33.719 --> 00:00:38.079
<v Speaker 1>It is cool and rainy here in Portland, shocking for Oregon.

12
00:00:38.119 --> 00:00:39.159
<v Speaker 2>And in April, I know.

13
00:00:39.840 --> 00:00:43.840
<v Speaker 1>How tel Aviv guess warm and sunny?

14
00:00:44.640 --> 00:00:49.479
<v Speaker 3>How did you ever guess? We literally didn't really have

15
00:00:49.560 --> 00:00:52.039
<v Speaker 3>a winter this year, to be honest, it was more

16
00:00:52.159 --> 00:00:55.479
<v Speaker 3>like a bit of a fall. Not that you know,

17
00:00:56.679 --> 00:00:59.079
<v Speaker 3>we should have more rain than we did. But you know,

18
00:00:59.119 --> 00:01:02.320
<v Speaker 3>it's still lovely there at least that and it still

19
00:01:02.439 --> 00:01:05.040
<v Speaker 3>is lovely weather fabulous.

20
00:01:05.040 --> 00:01:06.959
<v Speaker 2>Well it's fabulous for you, it's jealous for me.

21
00:01:07.120 --> 00:01:10.959
<v Speaker 1>But anyway, so today we are going to be talking

22
00:01:11.079 --> 00:01:16.719
<v Speaker 1>about a practical application of pipescript in JavaScript. I'll let

23
00:01:16.799 --> 00:01:20.159
<v Speaker 1>Dan give the details, but we're going to talk about

24
00:01:20.519 --> 00:01:25.159
<v Speaker 1>everything that was involved in Was it a new project

25
00:01:25.200 --> 00:01:28.159
<v Speaker 1>I already forgot. Oh so yeah, I'll let you talk

26
00:01:28.159 --> 00:01:29.760
<v Speaker 1>from here so I don't mess it up anymore.

27
00:01:31.040 --> 00:01:38.840
<v Speaker 3>All good. So basically I had this interesting situation at work.

28
00:01:39.599 --> 00:01:45.599
<v Speaker 3>We have a large legacy JavaScript project that's still a

29
00:01:45.760 --> 00:01:51.280
<v Speaker 3>core part of our offering, and it's under active well

30
00:01:51.280 --> 00:01:55.879
<v Speaker 3>beyond maintenance. It's being actively developed and enhanced and improved

31
00:01:55.920 --> 00:02:00.319
<v Speaker 3>and whatnot. But it's all done in JavaScript on hundred

32
00:02:00.359 --> 00:02:04.640
<v Speaker 3>percent JavaScript because it was started more than eight years

33
00:02:04.640 --> 00:02:09.639
<v Speaker 3>ago and it was never moved over to typescript. It

34
00:02:09.840 --> 00:02:19.759
<v Speaker 3>just stayed JavaScript, and I was looking at introducing typescript

35
00:02:19.840 --> 00:02:24.719
<v Speaker 3>into that project. Actually that project has two parts. It

36
00:02:24.840 --> 00:02:29.360
<v Speaker 3>has a server that's just running on no JS with Express,

37
00:02:30.199 --> 00:02:34.199
<v Speaker 3>and it has a client or front end side, which

38
00:02:34.280 --> 00:02:40.479
<v Speaker 3>is implemented in React. That part actually again talking legacy.

39
00:02:41.319 --> 00:02:44.199
<v Speaker 3>Some years ago before I joined the company, they made

40
00:02:44.280 --> 00:02:48.560
<v Speaker 3>the kind of unfortunate choice to introduce flow into the

41
00:02:48.560 --> 00:02:51.800
<v Speaker 3>front end part for type safety, and they only did

42
00:02:51.879 --> 00:02:56.639
<v Speaker 3>it partially. I didn't want to touch flow yet, so

43
00:02:56.680 --> 00:03:00.919
<v Speaker 3>I was looking at introducing type script to the back

44
00:03:01.039 --> 00:03:04.479
<v Speaker 3>end part, to the no JS part of the project,

45
00:03:05.879 --> 00:03:09.360
<v Speaker 3>and it turned out that it was much more complicated

46
00:03:09.960 --> 00:03:12.560
<v Speaker 3>and error prone than I expected. There were a lot

47
00:03:12.599 --> 00:03:15.560
<v Speaker 3>of pitfalls and gutchas along the way. I kind of

48
00:03:15.599 --> 00:03:18.960
<v Speaker 3>thought that, you know, given that the whole idea of

49
00:03:19.000 --> 00:03:23.680
<v Speaker 3>typescript is to get JavaScript devs onto the bandwagon, that

50
00:03:23.800 --> 00:03:27.960
<v Speaker 3>it should be really easy and straightforward, and it wasn't.

51
00:03:28.520 --> 00:03:33.400
<v Speaker 3>And I even consulted with some typescript luminaries like Matt

52
00:03:33.439 --> 00:03:37.520
<v Speaker 3>Polcock had a lot of great advice and suggestions, but

53
00:03:37.639 --> 00:03:41.120
<v Speaker 3>it still wasn't easy. Also with Jack Harrington and others,

54
00:03:41.639 --> 00:03:45.319
<v Speaker 3>they all had great advice, but it still was much

55
00:03:45.479 --> 00:03:49.639
<v Speaker 3>more challenging than I expected. And the end result is

56
00:03:49.719 --> 00:03:53.000
<v Speaker 3>that I kind of documented the entire process, did a

57
00:03:53.039 --> 00:03:57.400
<v Speaker 3>bit something like an internal blog about it, and we

58
00:03:57.479 --> 00:03:59.960
<v Speaker 3>have this internal wiki. So I wrote the whole doc

59
00:04:00.360 --> 00:04:02.280
<v Speaker 3>about how to do it so that if and when

60
00:04:02.360 --> 00:04:07.560
<v Speaker 3>we do it in another project, it'll be much easier

61
00:04:07.599 --> 00:04:10.520
<v Speaker 3>that time around. And I thought that it would be

62
00:04:10.680 --> 00:04:13.520
<v Speaker 3>interesting and useful for our audience for me to show

63
00:04:13.560 --> 00:04:16.759
<v Speaker 3>this information. I hope that it is okay.

64
00:04:16.759 --> 00:04:20.319
<v Speaker 1>So just to clarify, we're on the front end, you're

65
00:04:20.319 --> 00:04:22.120
<v Speaker 1>still sticking with what was there, right, In other words,

66
00:04:22.120 --> 00:04:25.720
<v Speaker 1>you're going to go with the flow, should we say.

67
00:04:26.800 --> 00:04:29.040
<v Speaker 1>And then on the back end was where you're doing

68
00:04:29.040 --> 00:04:30.120
<v Speaker 1>your typescript upgrading.

69
00:04:30.879 --> 00:04:34.480
<v Speaker 3>Yeah, So the answer is actually that our ultimate intention

70
00:04:34.839 --> 00:04:39.360
<v Speaker 3>is to do typescript on both sides, but I wanted

71
00:04:39.399 --> 00:04:43.600
<v Speaker 3>to start somewhere, and it seemed easier to start with

72
00:04:44.120 --> 00:04:48.319
<v Speaker 3>the just JavaScript part because Flow and typescript, while they

73
00:04:48.360 --> 00:04:52.199
<v Speaker 3>are similar, they're not the same. They're not compatible, and

74
00:04:52.240 --> 00:04:54.680
<v Speaker 3>I didn't want to get into the whole mess of

75
00:04:54.759 --> 00:04:57.680
<v Speaker 3>how I get typescript and Flow working together in the

76
00:04:57.720 --> 00:04:58.759
<v Speaker 3>same project.

77
00:04:59.040 --> 00:05:02.680
<v Speaker 1>Oh you so you wouldn't. You wouldn't replace flow with tithescript.

78
00:05:03.040 --> 00:05:10.439
<v Speaker 3>I would, But these are large projects, so replacing well,

79
00:05:10.600 --> 00:05:15.720
<v Speaker 3>let's put it this way. I really wanted to do

80
00:05:15.800 --> 00:05:20.600
<v Speaker 3>everything gradually. It's important to emphasize this point. So for example,

81
00:05:20.720 --> 00:05:26.120
<v Speaker 3>talking about just to give an an understanding of the

82
00:05:26.160 --> 00:05:29.600
<v Speaker 3>size the scope of the project, So talking just about

83
00:05:29.759 --> 00:05:34.240
<v Speaker 3>the back end part that no JS project, we're talking

84
00:05:34.240 --> 00:05:39.000
<v Speaker 3>about close to one thousand files JavaScript files, about seventy

85
00:05:39.079 --> 00:05:46.519
<v Speaker 3>thousand lines of code, something like thirty five hundred commits

86
00:05:46.560 --> 00:05:50.160
<v Speaker 3>since the project started over seven close to eight years ago.

87
00:05:51.759 --> 00:05:56.639
<v Speaker 3>So it's not a small project. And obviously I can't

88
00:05:57.120 --> 00:06:02.399
<v Speaker 3>move all the JavaScript files over to typescript, all thousand

89
00:06:02.480 --> 00:06:05.920
<v Speaker 3>of all one thousand of them in one go. Now,

90
00:06:05.959 --> 00:06:10.959
<v Speaker 3>there are some automated tools that automatically move all your

91
00:06:11.199 --> 00:06:15.360
<v Speaker 3>JS files into TS and add types as best they can,

92
00:06:15.959 --> 00:06:19.040
<v Speaker 3>using all sorts of tricks and static analysis and whatnot.

93
00:06:19.560 --> 00:06:23.000
<v Speaker 3>I did not want to do that. I was looking.

94
00:06:23.079 --> 00:06:25.079
<v Speaker 3>The way that I wanted to go about it, and

95
00:06:25.199 --> 00:06:28.759
<v Speaker 3>especially after I spoke with some people, is to enable

96
00:06:28.959 --> 00:06:33.079
<v Speaker 3>a gradual migration. And I'll talk about the two ways

97
00:06:33.079 --> 00:06:38.120
<v Speaker 3>in which a gradual migration can be achieved. By the way,

98
00:06:38.399 --> 00:06:42.160
<v Speaker 3>if you want to understand why I'm looking at a

99
00:06:42.199 --> 00:06:46.439
<v Speaker 3>gradual migration, why I prefer this approach, you can also

100
00:06:46.519 --> 00:06:49.040
<v Speaker 3>listen to the interview that I did with Matt Pocock

101
00:06:49.079 --> 00:06:52.120
<v Speaker 3>a while back about typescript, and we also discussed this

102
00:06:52.279 --> 00:06:56.959
<v Speaker 3>aspect about migrating projects, although again we did not go

103
00:06:57.040 --> 00:07:01.959
<v Speaker 3>into the exact details that I'm intending to go into today.

104
00:07:02.079 --> 00:07:07.040
<v Speaker 3>So the idea was to basically introduce typescript into the

105
00:07:07.120 --> 00:07:10.920
<v Speaker 3>project so that we can do the actual migration of

106
00:07:10.959 --> 00:07:15.639
<v Speaker 3>the files slowly over time. It could literally take years.

107
00:07:15.879 --> 00:07:21.160
<v Speaker 3>Is that is that clear? I hope? Yes.

108
00:07:21.319 --> 00:07:23.399
<v Speaker 1>Sorry, I was looking at the Matt Pocock episode so

109
00:07:23.439 --> 00:07:24.560
<v Speaker 1>I could tell people what it was.

110
00:07:25.639 --> 00:07:30.199
<v Speaker 3>Yeah, we can probably put a link in the show notes. Yeah. Yeah,

111
00:07:30.199 --> 00:07:34.000
<v Speaker 3>it was an excellent episode, highly recommended. Wait a minute,

112
00:07:34.040 --> 00:07:35.800
<v Speaker 3>we did two episode with them. Are you looking at

113
00:07:35.839 --> 00:07:38.240
<v Speaker 3>the latest one, the one from like about a few

114
00:07:38.279 --> 00:07:41.680
<v Speaker 3>months ago, or an older one from like two years ago?

115
00:07:42.680 --> 00:07:45.800
<v Speaker 2>Uh? Yeah, five thirty eight.

116
00:07:45.800 --> 00:07:49.120
<v Speaker 3>It was probably a couple of years ago, so we

117
00:07:49.160 --> 00:07:50.600
<v Speaker 3>did more recent one.

118
00:07:51.199 --> 00:07:53.560
<v Speaker 2>Okay, we'll find those and mention them later.

119
00:07:54.360 --> 00:07:59.720
<v Speaker 3>Okay, So again we're talking about one hundred percent JavaScript

120
00:07:59.720 --> 00:08:04.800
<v Speaker 3>product built on top of NOGS with Express. Like AJ

121
00:08:05.120 --> 00:08:08.480
<v Speaker 3>likes it, it uses common JS rather than import, so

122
00:08:08.600 --> 00:08:13.000
<v Speaker 3>it requires it's a legacy project for an API with

123
00:08:13.120 --> 00:08:16.560
<v Speaker 3>the front end side, it actually uses a combination of

124
00:08:17.279 --> 00:08:22.199
<v Speaker 3>Swagger and open Api for public RESTful APIs and actually

125
00:08:22.360 --> 00:08:29.000
<v Speaker 3>graphql with Apolo for the internal private APIs. For unit

126
00:08:29.040 --> 00:08:34.159
<v Speaker 3>testing we used Moca and Chai and it has end

127
00:08:34.159 --> 00:08:38.759
<v Speaker 3>to end tests implemented mostly using Playwright, but that's less relevant.

128
00:08:39.759 --> 00:08:44.840
<v Speaker 3>As I said, almost one thousand JavaScript files, almost seventy

129
00:08:44.879 --> 00:08:49.879
<v Speaker 3>thousand lines of code, and around thirty five hundred commits

130
00:08:49.919 --> 00:08:53.919
<v Speaker 3>since the project started. And again we use squash, so

131
00:08:53.960 --> 00:08:58.840
<v Speaker 3>it's really thirty five hundred prs really rather than you know,

132
00:08:59.120 --> 00:09:00.919
<v Speaker 3>along the way the world a lot more commits, but

133
00:09:00.960 --> 00:09:02.679
<v Speaker 3>they were just squashed together.

134
00:09:03.240 --> 00:09:06.600
<v Speaker 1>By squash you mean, not the vegetable. But when you

135
00:09:06.720 --> 00:09:09.759
<v Speaker 1>do the get merging in, you squash multiple commits and

136
00:09:09.799 --> 00:09:12.039
<v Speaker 1>do one bigger commit exactly.

137
00:09:12.559 --> 00:09:15.679
<v Speaker 3>Just a clarify for yeah people, because you know, there

138
00:09:15.679 --> 00:09:17.799
<v Speaker 3>are a lot of small commits along the way. I'm

139
00:09:17.840 --> 00:09:20.679
<v Speaker 3>fixing this. I'm fixing that they're they're not that interesting

140
00:09:20.840 --> 00:09:23.639
<v Speaker 3>in most cases. You know, you can keep them if

141
00:09:23.639 --> 00:09:30.200
<v Speaker 3>they're really important, but in most cases they're not that interesting. Okay,

142
00:09:30.320 --> 00:09:34.519
<v Speaker 3>So I was looking to enable a gradual migration, which

143
00:09:34.600 --> 00:09:39.559
<v Speaker 3>means introducing Typescript into the project, but not actually moving

144
00:09:39.600 --> 00:09:43.639
<v Speaker 3>the entire project over to typescript. Maybe a few words

145
00:09:43.679 --> 00:09:48.480
<v Speaker 3>about why I wanted to do that. It's really funny.

146
00:09:49.120 --> 00:09:52.759
<v Speaker 3>I also spoke about this with Matt. When typescript first

147
00:09:53.000 --> 00:09:56.399
<v Speaker 3>was introduced, I had a kind of a negative attitude,

148
00:09:57.600 --> 00:10:02.120
<v Speaker 3>you know, when I came to JavaScript. Statically typed languages

149
00:10:02.960 --> 00:10:06.840
<v Speaker 3>like C plus plus and like Java, like C Sharp

150
00:10:07.399 --> 00:10:12.360
<v Speaker 3>and JavaScript. The dynamic nature of JavaScript afforded an amazing

151
00:10:12.399 --> 00:10:17.720
<v Speaker 3>amount of freedom, and I loved it. But as I

152
00:10:17.759 --> 00:10:23.480
<v Speaker 3>became ever more seasoned in JavaScript development, especially working in

153
00:10:23.679 --> 00:10:28.720
<v Speaker 3>larger teams, I came to realize and understand that for

154
00:10:28.919 --> 00:10:36.000
<v Speaker 3>larger projects involving larger teams, for production grade software, you

155
00:10:36.440 --> 00:10:41.519
<v Speaker 3>want something that's more structured and rigid, and you want

156
00:10:41.639 --> 00:10:48.960
<v Speaker 3>something that helps you avoid certain errors that can easily

157
00:10:49.080 --> 00:10:52.759
<v Speaker 3>happen if you're just using JavaScript. You know, the obvious

158
00:10:52.799 --> 00:10:57.440
<v Speaker 3>example is you just misspelled or mistype a property name

159
00:10:58.039 --> 00:11:02.200
<v Speaker 3>and you just get undefined instead of the actual value.

160
00:11:03.120 --> 00:11:06.960
<v Speaker 3>But there's no error in any other in you know,

161
00:11:07.000 --> 00:11:09.960
<v Speaker 3>in any other way, and it seems to run. It

162
00:11:10.159 --> 00:11:13.279
<v Speaker 3>just runs wrong, And that's one of those things that

163
00:11:13.840 --> 00:11:18.759
<v Speaker 3>typescript protects you from. Typescript. Also, the code is much better,

164
00:11:18.960 --> 00:11:22.919
<v Speaker 3>much more self documented, especially if you're talking about APIs,

165
00:11:24.039 --> 00:11:27.399
<v Speaker 3>Especially again if you're talking about larger teams that compose

166
00:11:27.600 --> 00:11:32.960
<v Speaker 3>software from parts, components or services together. You want APIs

167
00:11:33.000 --> 00:11:40.159
<v Speaker 3>that are much better structured and self documented. And the

168
00:11:40.200 --> 00:11:47.039
<v Speaker 3>integration with modern development tools like vis code especially that

169
00:11:48.039 --> 00:11:53.000
<v Speaker 3>does the much smarter autocomplete for you and puts squigglies

170
00:11:53.840 --> 00:11:58.720
<v Speaker 3>if you pass in wrong parameter types or the wrong

171
00:11:58.799 --> 00:12:03.399
<v Speaker 3>number of parameters or whatever. All these are super useful

172
00:12:03.480 --> 00:12:08.639
<v Speaker 3>tools when you're working, especially as I said, in an

173
00:12:08.759 --> 00:12:14.039
<v Speaker 3>enterprise type environment. And these days it's also better with

174
00:12:14.159 --> 00:12:18.960
<v Speaker 3>AI because it gives the AI greater context. By the way,

175
00:12:19.000 --> 00:12:21.039
<v Speaker 3>all that being said, if I need to solve a

176
00:12:21.080 --> 00:12:23.399
<v Speaker 3>lit code type problem, I'll probably just do it in

177
00:12:23.480 --> 00:12:27.720
<v Speaker 3>JavaScript and not mess about with the types. But for

178
00:12:27.799 --> 00:12:31.519
<v Speaker 3>everything else, I find that even though we are writing

179
00:12:31.600 --> 00:12:36.000
<v Speaker 3>those types that ultimately are evaporated out of the code,

180
00:12:36.039 --> 00:12:39.639
<v Speaker 3>because when Typescript is compiled to JavaScript, it basically just

181
00:12:39.919 --> 00:12:44.600
<v Speaker 3>strips out all the types. Despite that fact, I still

182
00:12:44.679 --> 00:12:51.000
<v Speaker 3>find it incredibly useful maintenance for the development and maintenance

183
00:12:51.039 --> 00:12:54.480
<v Speaker 3>of larger certainly of larger code bases, and especially in

184
00:12:54.559 --> 00:12:57.519
<v Speaker 3>this case, the fact that the project was done in

185
00:12:57.559 --> 00:13:02.960
<v Speaker 3>JavaScript and not Typescript was definitely hurting our developer experience.

186
00:13:04.480 --> 00:13:09.440
<v Speaker 3>Just recently, somebody literally introduced a bug that could not

187
00:13:09.559 --> 00:13:15.320
<v Speaker 3>have happened had the project been entirely done in Typescript,

188
00:13:15.879 --> 00:13:19.759
<v Speaker 3>and it didn't propagate all the way to production, but

189
00:13:19.919 --> 00:13:22.559
<v Speaker 3>it was only caught by an end to end test,

190
00:13:22.919 --> 00:13:27.919
<v Speaker 3>you know, later down the line, and it was much

191
00:13:28.000 --> 00:13:31.879
<v Speaker 3>more difficult and expensive to handle than if vis code

192
00:13:31.919 --> 00:13:35.639
<v Speaker 3>would just have put a squiggly under that offending instruction.

193
00:13:35.879 --> 00:13:37.919
<v Speaker 2>So far, so good, so far, so good.

194
00:13:38.039 --> 00:13:40.919
<v Speaker 3>By the way, I totally appreciate the fact that a

195
00:13:40.960 --> 00:13:46.440
<v Speaker 3>lot of front end developers or full stack developers still

196
00:13:46.480 --> 00:13:50.559
<v Speaker 3>preferred to work in JavaScript. You know, you do you

197
00:13:50.720 --> 00:13:54.600
<v Speaker 3>whatever works best for you. For me, after all these years,

198
00:13:54.679 --> 00:13:57.960
<v Speaker 3>I've come to the conclusion that again, for the larger

199
00:13:58.000 --> 00:14:05.360
<v Speaker 3>projects involving multiple developers, certainly I prefer you working in typescript. Okay,

200
00:14:05.480 --> 00:14:10.360
<v Speaker 3>So I have the project, it's pulled down to my computer,

201
00:14:11.080 --> 00:14:13.480
<v Speaker 3>and I want to start. The first thing that I

202
00:14:13.519 --> 00:14:17.240
<v Speaker 3>went about, again because it's a legacy project, is I

203
00:14:17.320 --> 00:14:21.039
<v Speaker 3>want to upgrade, to make sure that node is upgraded

204
00:14:21.080 --> 00:14:25.279
<v Speaker 3>to the latest possible version, ideally to the latest LTE

205
00:14:25.480 --> 00:14:33.159
<v Speaker 3>version LTLS version sorry, long term support version. And if

206
00:14:33.200 --> 00:14:35.600
<v Speaker 3>people are curious about what that means. We had that

207
00:14:36.399 --> 00:14:40.080
<v Speaker 3>conversation with the node guys about the nine pillars of note.

208
00:14:41.720 --> 00:14:46.279
<v Speaker 3>Hopefully you're using something like NVM, the node version management,

209
00:14:46.399 --> 00:14:49.360
<v Speaker 3>so you just you know, find the latest version you

210
00:14:49.360 --> 00:14:53.240
<v Speaker 3>support you can support idea, the latest LTS version and

211
00:14:53.279 --> 00:14:57.279
<v Speaker 3>put it in your NVMRC file. Update to that and

212
00:14:57.960 --> 00:15:01.000
<v Speaker 3>make sure that that it runs and that you can

213
00:15:01.080 --> 00:15:04.240
<v Speaker 3>work with it. Also make sure that obviously that you

214
00:15:04.320 --> 00:15:08.600
<v Speaker 3>were pulled on the latest version from you know, GitHub

215
00:15:08.759 --> 00:15:13.919
<v Speaker 3>or whatever, and that it appears to work properly in

216
00:15:13.960 --> 00:15:19.240
<v Speaker 3>your environment. The next step is to make sure it

217
00:15:19.279 --> 00:15:23.679
<v Speaker 3>seems obvious and explain why it isn't that your unit

218
00:15:23.720 --> 00:15:28.559
<v Speaker 3>tests work correctly. Now you might say, well, obviously, because

219
00:15:28.639 --> 00:15:32.840
<v Speaker 3>otherwise the project will be broken. But in our case,

220
00:15:32.840 --> 00:15:35.879
<v Speaker 3>at least, it turned out that some of the unit

221
00:15:35.960 --> 00:15:42.399
<v Speaker 3>tests had cross dependencies. What that means is that they

222
00:15:42.519 --> 00:15:46.600
<v Speaker 3>used mocks but didn't always properly cleaned the mocks up

223
00:15:47.399 --> 00:15:51.279
<v Speaker 3>the results. Some of the tests actually only passed when

224
00:15:51.320 --> 00:15:53.240
<v Speaker 3>they were run in a particular order.

225
00:15:54.440 --> 00:15:57.480
<v Speaker 1>No, yeah, I've ran into that before. I know exactly

226
00:15:57.480 --> 00:15:58.320
<v Speaker 1>what you're talking about.

227
00:15:59.039 --> 00:16:03.120
<v Speaker 3>Yeah, And it turns out that everything seemed to be

228
00:16:03.240 --> 00:16:07.240
<v Speaker 3>fine because when it was run in the JavaScript project,

229
00:16:07.840 --> 00:16:10.399
<v Speaker 3>it was it happened to run in the correct order.

230
00:16:10.440 --> 00:16:13.759
<v Speaker 3>Otherwise people would have noticed and fixed it a while ago.

231
00:16:14.200 --> 00:16:18.559
<v Speaker 3>But when I actually started moving the project over the typescript,

232
00:16:19.240 --> 00:16:24.840
<v Speaker 3>it turned out that because of the transpilation step, things

233
00:16:25.039 --> 00:16:28.600
<v Speaker 3>didn't run in exactly the same order, and then certain

234
00:16:28.639 --> 00:16:33.840
<v Speaker 3>tests broke. Or I had certain situations where I needed

235
00:16:33.879 --> 00:16:36.120
<v Speaker 3>to touch the business logic, and then I wanted to

236
00:16:36.200 --> 00:16:40.320
<v Speaker 3>run particular tests individually, and I found out that when

237
00:16:40.360 --> 00:16:43.559
<v Speaker 3>I tried to run the test individually, they failed, and

238
00:16:43.600 --> 00:16:46.159
<v Speaker 3>then I went back to the original code and founded

239
00:16:46.200 --> 00:16:49.720
<v Speaker 3>those tests. Even when I ran them individually in the

240
00:16:49.759 --> 00:16:54.960
<v Speaker 3>actual original JavaScript project, they also failed because they only

241
00:16:55.000 --> 00:16:57.399
<v Speaker 3>passed when they were run in a batch in the

242
00:16:57.440 --> 00:17:03.279
<v Speaker 3>appropriate order, because again of mock leaks. I won't go

243
00:17:03.399 --> 00:17:07.519
<v Speaker 3>into the detail of what mock leaks have are. Basically,

244
00:17:08.000 --> 00:17:11.400
<v Speaker 3>it just means that a mock was put in but

245
00:17:11.720 --> 00:17:16.279
<v Speaker 3>wasn't properly removed at the end of the test. It

246
00:17:16.359 --> 00:17:21.079
<v Speaker 3>consequently leaked into the next test, uh, and it impacted

247
00:17:21.119 --> 00:17:23.519
<v Speaker 3>that and in that case it actually enabled it to

248
00:17:24.079 --> 00:17:27.519
<v Speaker 3>complete successfully. And when you just run that test on

249
00:17:27.559 --> 00:17:31.119
<v Speaker 3>its own, it doesn't get those mocks, and then it failed.

250
00:17:31.400 --> 00:17:35.119
<v Speaker 1>So in all the idea, I mean, obviously, I think

251
00:17:35.160 --> 00:17:39.759
<v Speaker 1>the idea there is that tests should be self but

252
00:17:40.119 --> 00:17:42.799
<v Speaker 1>they stand by themselves. I don't know what the correct

253
00:17:42.839 --> 00:17:45.559
<v Speaker 1>term is, right, so you're not dependent upon other tests.

254
00:17:45.960 --> 00:17:47.400
<v Speaker 2>Yeah, for the test to spin up.

255
00:17:47.359 --> 00:17:49.400
<v Speaker 1>Your environment and give you a mock up and give

256
00:17:49.400 --> 00:17:51.640
<v Speaker 1>you everything you need, run the test, break it down

257
00:17:51.960 --> 00:17:52.880
<v Speaker 1>on the next test.

258
00:17:53.519 --> 00:17:56.079
<v Speaker 3>Yeah. By the way, even the fact that you know

259
00:17:56.119 --> 00:17:58.839
<v Speaker 3>a lot of the code has that so many marks

260
00:17:58.839 --> 00:18:02.079
<v Speaker 3>were used were test statement to the fact that it

261
00:18:02.119 --> 00:18:05.759
<v Speaker 3>was legacy code, because ideally, in more modern code I

262
00:18:05.799 --> 00:18:10.039
<v Speaker 3>would use dependency injection and try to avoid so many marks.

263
00:18:11.319 --> 00:18:14.440
<v Speaker 3>But again, the code is what it is, and that

264
00:18:14.599 --> 00:18:23.079
<v Speaker 3>was the situation. So basically the thing was that before

265
00:18:23.119 --> 00:18:26.599
<v Speaker 3>I could actually start the migration to Typescript, I actually

266
00:18:26.680 --> 00:18:30.559
<v Speaker 3>needed to fix a bunch of mock leaks and get

267
00:18:30.599 --> 00:18:34.279
<v Speaker 3>the tests to run properly in the original project before

268
00:18:34.319 --> 00:18:38.240
<v Speaker 3>I even start migrating it over to typescript. So I

269
00:18:38.319 --> 00:18:43.039
<v Speaker 3>verified that all the tests could run individually, and only

270
00:18:43.079 --> 00:18:46.480
<v Speaker 3>then did I actually start the migration process. The next step,

271
00:18:46.519 --> 00:18:52.319
<v Speaker 3>of course, is to install Typescript and initialize it. So

272
00:18:52.359 --> 00:18:56.640
<v Speaker 3>you do youless you're using NPM or yarn or whatever.

273
00:18:56.880 --> 00:19:02.880
<v Speaker 3>You NPM or yarn or MPM installed typescript, you do

274
00:19:03.000 --> 00:19:09.160
<v Speaker 3>Typescript in it. And already here I ran into an

275
00:19:09.200 --> 00:19:18.160
<v Speaker 3>issue because my default assumption was that the installation of

276
00:19:18.319 --> 00:19:23.480
<v Speaker 3>Typescript should be as a dev dependency, because why would

277
00:19:23.559 --> 00:19:28.920
<v Speaker 3>you need the actual Typescript compiler in the production environment.

278
00:19:29.160 --> 00:19:33.319
<v Speaker 3>It's just part of your development pipeline. In order to

279
00:19:33.400 --> 00:19:42.839
<v Speaker 3>actually build the system, the installable part of your project.

280
00:19:44.000 --> 00:19:47.480
<v Speaker 3>You only actually deploy the disk folder or whatever it

281
00:19:47.559 --> 00:19:50.799
<v Speaker 3>is that you're creating. And it turns out that at

282
00:19:50.880 --> 00:19:53.920
<v Speaker 3>least in our case and maybe also in the case

283
00:19:54.039 --> 00:19:58.759
<v Speaker 3>of our listeners, that was not the case. I actually

284
00:19:58.920 --> 00:20:01.799
<v Speaker 3>had to install it as a PRAD dependency. Are you

285
00:20:01.839 --> 00:20:04.839
<v Speaker 3>familiar with the difference between a PROD and a DEV dependency?

286
00:20:05.880 --> 00:20:06.440
<v Speaker 2>Absolutely?

287
00:20:06.480 --> 00:20:09.079
<v Speaker 1>I mean we ran into the same thing, uh in

288
00:20:09.119 --> 00:20:13.480
<v Speaker 1>the PHP world on the back end with composer, where

289
00:20:13.799 --> 00:20:17.559
<v Speaker 1>a classic a similar analog to what you're doing is

290
00:20:17.960 --> 00:20:21.920
<v Speaker 1>PHP stand which is a static analysis tool for PHP.

291
00:20:22.000 --> 00:20:26.160
<v Speaker 1>Where you don't want that, you know, in your in

292
00:20:26.240 --> 00:20:29.119
<v Speaker 1>your PROD build, so you put it as a dependency

293
00:20:29.599 --> 00:20:30.680
<v Speaker 1>use a save DEAV flag.

294
00:20:30.759 --> 00:20:35.119
<v Speaker 3>Yeah. So unfortunately, I actually had to install typescript as

295
00:20:35.119 --> 00:20:38.559
<v Speaker 3>a PROD dependency in our case. And the reason was

296
00:20:38.759 --> 00:20:41.960
<v Speaker 3>that the build. The way that the built pipeline worked

297
00:20:42.640 --> 00:20:49.799
<v Speaker 3>is that it actually created a pod for deployment, uh,

298
00:20:49.920 --> 00:20:53.359
<v Speaker 3>you know, like a Docker pod basically, and and it

299
00:20:53.519 --> 00:20:59.160
<v Speaker 3>actually did sort like a get pulled inside the pod

300
00:20:59.720 --> 00:21:04.279
<v Speaker 3>and then ran the build in the pod. So if

301
00:21:05.039 --> 00:21:12.000
<v Speaker 3>and it only did and it only ran the PROD installation,

302
00:21:12.720 --> 00:21:15.599
<v Speaker 3>so if I didn't put it as product PRAD, I

303
00:21:15.720 --> 00:21:20.000
<v Speaker 3>actually broke our CICD pipeline because it tried to run

304
00:21:20.599 --> 00:21:24.039
<v Speaker 3>the TC as part of the PROD build, and it

305
00:21:24.119 --> 00:21:31.319
<v Speaker 3>wasn't there. Now, ideally I should fix the CICD pipeline

306
00:21:31.359 --> 00:21:34.519
<v Speaker 3>so that it doesn't work this way, maybe build it

307
00:21:34.559 --> 00:21:37.880
<v Speaker 3>into a special environment and then copy the files over

308
00:21:38.039 --> 00:21:41.319
<v Speaker 3>into the PROD environment rather than build in the PROD environment.

309
00:21:42.160 --> 00:21:46.319
<v Speaker 3>But I wanted to reduce the amount of DevOps work

310
00:21:46.400 --> 00:21:49.559
<v Speaker 3>that I actually had to do, and it seemed just

311
00:21:49.640 --> 00:21:54.799
<v Speaker 3>a lot easier to just make Typescript itself a PROD dependency.

312
00:21:54.880 --> 00:21:58.720
<v Speaker 3>It's just an ideal, of course, because you're shipping Typescript

313
00:21:58.759 --> 00:22:05.839
<v Speaker 3>as part of your note modules. It's broad installation. But

314
00:22:06.000 --> 00:22:09.519
<v Speaker 3>you know what, it's so big anyway, it didn't make

315
00:22:09.720 --> 00:22:11.920
<v Speaker 3>that hole that much of a difference in our case.

316
00:22:11.960 --> 00:22:14.400
<v Speaker 3>And as I said, I just wanted to get over

317
00:22:14.519 --> 00:22:16.920
<v Speaker 3>this this blocker, so just.

318
00:22:17.680 --> 00:22:20.359
<v Speaker 1>So just to clarify that, so it doesn't you know,

319
00:22:20.440 --> 00:22:24.440
<v Speaker 1>I'm not a big Typescript user myself used some and

320
00:22:25.759 --> 00:22:27.039
<v Speaker 1>not a real big user of it.

321
00:22:27.279 --> 00:22:28.359
<v Speaker 2>But correct me if I'm wrong.

322
00:22:28.359 --> 00:22:30.559
<v Speaker 1>But doesn't the whole point of the typescript compiler that,

323
00:22:30.680 --> 00:22:33.519
<v Speaker 1>as you you know, you write your typescript code and

324
00:22:33.559 --> 00:22:35.759
<v Speaker 1>then it compiles. It does I was checking it saves

325
00:22:35.759 --> 00:22:37.839
<v Speaker 1>it to job script files, and that's what you want

326
00:22:37.839 --> 00:22:39.680
<v Speaker 1>to build off of, isn't am I crrect?

327
00:22:39.759 --> 00:22:43.319
<v Speaker 3>Yeah? Look, there there are really two ways these days

328
00:22:43.319 --> 00:22:48.119
<v Speaker 3>in which you can run typescript on top of note,

329
00:22:49.359 --> 00:22:53.359
<v Speaker 3>the way that you usually want to do in production

330
00:22:53.519 --> 00:22:56.799
<v Speaker 3>environments is you want to run the Typescript compiler TSC.

331
00:22:58.079 --> 00:23:01.319
<v Speaker 3>It runs, it does all the X, it fails if

332
00:23:01.359 --> 00:23:05.000
<v Speaker 3>it identifies an error, but if everything is fine, it

333
00:23:05.319 --> 00:23:08.720
<v Speaker 3>general like you said, it generates JavaScript files from the

334
00:23:08.759 --> 00:23:11.720
<v Speaker 3>typescript files. So for every dot TS file you get

335
00:23:11.720 --> 00:23:16.400
<v Speaker 3>a dot js file, and in that JS it's basically

336
00:23:16.519 --> 00:23:21.880
<v Speaker 3>just essentially looked mostly like stripped out the type information.

337
00:23:22.559 --> 00:23:26.039
<v Speaker 3>And then ideally you would just deploy those JS files

338
00:23:26.079 --> 00:23:29.559
<v Speaker 3>and you don't deploy the TS files. But as I explained,

339
00:23:29.599 --> 00:23:35.279
<v Speaker 3>the way that our CICD pipeline was built, because it

340
00:23:35.359 --> 00:23:39.359
<v Speaker 3>was originally done before TSC, nobody thought about about that.

341
00:23:39.799 --> 00:23:42.200
<v Speaker 3>The way that it worked was that it actually did

342
00:23:42.240 --> 00:23:47.559
<v Speaker 3>a Git pull directly to the production pod that it

343
00:23:47.640 --> 00:23:51.839
<v Speaker 3>was building, and then ran a quote unquote build on it,

344
00:23:51.880 --> 00:23:57.920
<v Speaker 3>which effectively did very little in the pre TSC scenario.

345
00:23:58.519 --> 00:24:04.039
<v Speaker 3>In the TSC scenario, that build actually runs the TSC compiler.

346
00:24:04.599 --> 00:24:13.000
<v Speaker 3>So building the production pod required having TSC on that pod,

347
00:24:13.359 --> 00:24:18.480
<v Speaker 3>so again not ideal. A better solution would be to

348
00:24:18.519 --> 00:24:27.640
<v Speaker 3>fix the CICD pipeline, but that's how it was built

349
00:24:27.640 --> 00:24:29.880
<v Speaker 3>when it was built, and I didn't want to mess

350
00:24:29.920 --> 00:24:37.079
<v Speaker 3>about with the CICD job and building new one or whatever.

351
00:24:38.119 --> 00:24:41.799
<v Speaker 3>As I said, I don't consider myself a dev's off person,

352
00:24:41.920 --> 00:24:45.680
<v Speaker 3>and if I can avoid doing that, and I prefer to.

353
00:24:46.160 --> 00:24:49.359
<v Speaker 3>By the way, these days, there's a different you can

354
00:24:49.480 --> 00:24:53.920
<v Speaker 3>there's a different way for running typescript on top of Node.

355
00:24:56.079 --> 00:24:59.599
<v Speaker 3>Actually there's a couple of ways. So first of all,

356
00:24:59.599 --> 00:25:05.160
<v Speaker 3>there's this project called tsnode which literally wraps Node and

357
00:25:05.799 --> 00:25:12.119
<v Speaker 3>adds TSC some support for typescript files into Node by

358
00:25:12.160 --> 00:25:16.119
<v Speaker 3>effectively running TSC when it loads a file when files

359
00:25:16.119 --> 00:25:20.160
<v Speaker 3>are loaded into Node, so you can use tsnode to

360
00:25:20.400 --> 00:25:25.319
<v Speaker 3>run the typescript files directly on note without having to

361
00:25:25.400 --> 00:25:28.359
<v Speaker 3>use TSC first to build the jobscript project out of it.

362
00:25:28.920 --> 00:25:31.759
<v Speaker 3>But obviously this is not something you really want in

363
00:25:31.799 --> 00:25:35.680
<v Speaker 3>production environments because all that thing adds a lot of

364
00:25:35.759 --> 00:25:40.400
<v Speaker 3>overhead when the Node process starts, and why pay for

365
00:25:40.480 --> 00:25:48.079
<v Speaker 3>that overhead. What the Node team has recently done is

366
00:25:48.119 --> 00:25:54.640
<v Speaker 3>they've actually added a new command line switch, which kind

367
00:25:54.640 --> 00:25:59.440
<v Speaker 3>of quote unquote gives Node TS support. The way that

368
00:25:59.519 --> 00:26:03.799
<v Speaker 3>they do though, is not by running TSC, is by

369
00:26:03.920 --> 00:26:08.519
<v Speaker 3>stripping out the type information. So think about like it's

370
00:26:08.640 --> 00:26:13.039
<v Speaker 3>it's overwriting all the type definition with spaces, so it's

371
00:26:13.119 --> 00:26:18.240
<v Speaker 3>kind of evaporating the type information out of the out

372
00:26:18.319 --> 00:26:21.160
<v Speaker 3>of the TS files and then what you're left with

373
00:26:21.319 --> 00:26:24.119
<v Speaker 3>is just JavaScript and it runs that, and it can

374
00:26:24.160 --> 00:26:28.720
<v Speaker 3>do that fairly quickly. But on the conversely, it doesn't

375
00:26:28.720 --> 00:26:32.559
<v Speaker 3>actually do any type checking. It just so they expect

376
00:26:32.559 --> 00:26:35.039
<v Speaker 3>you to do the type checking beforehand, but they say

377
00:26:35.079 --> 00:26:38.559
<v Speaker 3>you can still run the TS files directly and you

378
00:26:38.720 --> 00:26:43.440
<v Speaker 3>hardly pay any over any overhead costs for that. Is

379
00:26:43.440 --> 00:26:44.000
<v Speaker 3>that clear?

380
00:26:44.279 --> 00:26:46.400
<v Speaker 2>Yes, sir, good.

381
00:26:46.759 --> 00:26:52.400
<v Speaker 3>But again this is variatively new, relatively recent, and when

382
00:26:52.440 --> 00:26:56.200
<v Speaker 3>I worked on that project, I didn't use it, so

383
00:26:56.319 --> 00:27:00.440
<v Speaker 3>I I really needed to compile the TS file into

384
00:27:00.519 --> 00:27:05.400
<v Speaker 3>JS files. So as I said, I installed TS, I

385
00:27:05.440 --> 00:27:07.759
<v Speaker 3>initialized it, but I put it as part of the

386
00:27:07.799 --> 00:27:11.839
<v Speaker 3>pro dependency, not a dev dependency because of the way

387
00:27:11.839 --> 00:27:15.799
<v Speaker 3>in which our CICD pipeline is built. When you install

388
00:27:16.119 --> 00:27:20.599
<v Speaker 3>an initialized when you initialize typescript, actually it generates a

389
00:27:20.640 --> 00:27:24.240
<v Speaker 3>TS config file or TS configured dot json file to

390
00:27:24.319 --> 00:27:29.160
<v Speaker 3>be precise, at the root of your folder of your project. Sorry.

391
00:27:29.599 --> 00:27:33.960
<v Speaker 3>In fact, that's how TSC knows where the root of

392
00:27:34.000 --> 00:27:37.039
<v Speaker 3>your project is. It assumes that where that file is

393
00:27:37.119 --> 00:27:42.440
<v Speaker 3>located is the root of your project, and that ts

394
00:27:42.480 --> 00:27:46.599
<v Speaker 3>configured dot json files is a JSON file obviously of

395
00:27:46.720 --> 00:27:52.680
<v Speaker 3>configuration data for TSC telling it how to work how

396
00:27:52.720 --> 00:27:57.759
<v Speaker 3>to process your project. For example, you can tell it

397
00:27:58.279 --> 00:28:05.559
<v Speaker 3>which folders to include or exclude from its compilation. In

398
00:28:05.640 --> 00:28:10.079
<v Speaker 3>our case, all the source files except for the root

399
00:28:10.200 --> 00:28:14.480
<v Speaker 3>index file resided in an src folder, and all the

400
00:28:14.559 --> 00:28:17.839
<v Speaker 3>test files the unit test files, and also some of

401
00:28:18.119 --> 00:28:22.119
<v Speaker 3>the end two n test files resided in a test folder.

402
00:28:24.400 --> 00:28:31.559
<v Speaker 3>I configured ts configure to compile both these to look

403
00:28:31.599 --> 00:28:37.839
<v Speaker 3>at just these two folders, and by default TSC tries

404
00:28:37.880 --> 00:28:40.640
<v Speaker 3>to compile of the files to be next to the

405
00:28:40.720 --> 00:28:43.559
<v Speaker 3>original files. So if you have let's say a inn

406
00:28:43.759 --> 00:28:47.759
<v Speaker 3>x dot ts, it will generate an x dot js

407
00:28:47.799 --> 00:28:51.880
<v Speaker 3>alongside it. That is not what I wanted. The reason

408
00:28:51.920 --> 00:28:54.799
<v Speaker 3>that this is not what I wanted is that my

409
00:28:55.000 --> 00:28:59.039
<v Speaker 3>project is full of JS files and I want them

410
00:28:59.119 --> 00:29:02.039
<v Speaker 3>to be processed as well, and I can't generate an

411
00:29:02.240 --> 00:29:05.640
<v Speaker 3>x dot js file from an x dot JS file

412
00:29:06.000 --> 00:29:08.720
<v Speaker 3>into the same folder I need. I have to generate

413
00:29:08.759 --> 00:29:13.319
<v Speaker 3>it somewhere else. So I had to configure TSC to

414
00:29:13.400 --> 00:29:17.920
<v Speaker 3>build everything into a disc folder, so it would take

415
00:29:17.960 --> 00:29:21.440
<v Speaker 3>everything from the src and test folder and build them

416
00:29:21.480 --> 00:29:25.960
<v Speaker 3>into a disc slash slash SRC and a disc slash

417
00:29:26.279 --> 00:29:27.759
<v Speaker 3>slash sorry Test.

418
00:29:28.079 --> 00:29:30.039
<v Speaker 1>Yes, So I don't know if I'm jumping ahead here,

419
00:29:30.640 --> 00:29:34.559
<v Speaker 1>so pardon if I am. But is it normal practice

420
00:29:34.599 --> 00:29:36.640
<v Speaker 1>to have like a TS file for the typescript and

421
00:29:36.640 --> 00:29:39.119
<v Speaker 1>that compiles to JS or is that yeah?

422
00:29:39.240 --> 00:29:41.559
<v Speaker 3>But I'm going to do Yeah, But like I said,

423
00:29:41.640 --> 00:29:45.480
<v Speaker 3>I have one thousand JS files and I don't want

424
00:29:45.519 --> 00:29:49.519
<v Speaker 3>to just arbitrarily rename all these files to dot TS.

425
00:29:50.160 --> 00:29:53.039
<v Speaker 3>So from the way that I wanted to work is

426
00:29:53.160 --> 00:29:57.480
<v Speaker 3>that is to manually transform each and every file at

427
00:29:57.519 --> 00:30:02.000
<v Speaker 3>a time and do it gradually over time. So this

428
00:30:02.119 --> 00:30:06.279
<v Speaker 3>project going all the way. If we ever go full TS,

429
00:30:06.680 --> 00:30:11.119
<v Speaker 3>it might take years, and you know, but we'll, you know,

430
00:30:11.480 --> 00:30:15.079
<v Speaker 3>every day or two will take a JS file and

431
00:30:15.119 --> 00:30:20.759
<v Speaker 3>move it that particular file over to TS. But until

432
00:30:20.799 --> 00:30:24.960
<v Speaker 3>we do, that file stays as JS. So I really

433
00:30:25.039 --> 00:30:30.839
<v Speaker 3>need to have the TSC compiler take all the TS

434
00:30:30.880 --> 00:30:35.519
<v Speaker 3>files but also also all the JS files Effectively, I

435
00:30:35.640 --> 00:30:39.440
<v Speaker 3>needed to quote unquote compile the JS files as well

436
00:30:39.440 --> 00:30:43.759
<v Speaker 3>as the TS files because I need them all to

437
00:30:43.960 --> 00:30:49.160
<v Speaker 3>be compiled into the same folder, because otherwise I'll break

438
00:30:49.200 --> 00:30:52.759
<v Speaker 3>the project structure. I can't just compile the TS files

439
00:30:52.759 --> 00:30:55.640
<v Speaker 3>if I. If I have there a one thousand five

440
00:30:55.720 --> 00:30:59.319
<v Speaker 3>files in this project that are JS and three files

441
00:30:59.319 --> 00:31:03.599
<v Speaker 3>that I've moved over to TS, I need the resulting fold,

442
00:31:03.720 --> 00:31:07.759
<v Speaker 3>the resulting this folder to have all the JS files,

443
00:31:08.839 --> 00:31:11.839
<v Speaker 3>both from the originals and from the ones that I've

444
00:31:11.880 --> 00:31:16.000
<v Speaker 3>already moved. I hope I'm explaining it clearly enough.

445
00:31:16.440 --> 00:31:17.279
<v Speaker 2>Yeah, I get it.

446
00:31:17.839 --> 00:31:20.359
<v Speaker 3>The other thing is I did is I enabled incremental

447
00:31:20.400 --> 00:31:26.680
<v Speaker 3>build for speed. Incremental build means that that TSC maintains

448
00:31:26.720 --> 00:31:30.599
<v Speaker 3>something like a cash and it sees that, hey, this

449
00:31:30.720 --> 00:31:33.839
<v Speaker 3>file that I've previously compiled, nothing has changed in it,

450
00:31:34.000 --> 00:31:36.519
<v Speaker 3>based let's say, on the time and date, so I

451
00:31:36.519 --> 00:31:39.640
<v Speaker 3>don't need to compile it again. And this way you

452
00:31:39.680 --> 00:31:42.400
<v Speaker 3>don't need to compile the entire project each and every time,

453
00:31:42.480 --> 00:31:45.720
<v Speaker 3>even though in our case it was very very quick,

454
00:31:47.119 --> 00:31:49.759
<v Speaker 3>precisely because most of the files it was just taking

455
00:31:49.839 --> 00:31:54.079
<v Speaker 3>JS files and generating JS files from them almost as is,

456
00:31:54.960 --> 00:32:01.200
<v Speaker 3>which apparently it can do very quickly. They specified the

457
00:32:01.319 --> 00:32:05.759
<v Speaker 3>latest possible target based in terms of the JavaScript support,

458
00:32:06.160 --> 00:32:08.920
<v Speaker 3>based on the no JS version that we're using. And

459
00:32:09.319 --> 00:32:12.519
<v Speaker 3>since as I said, the project is using common JS,

460
00:32:12.640 --> 00:32:16.759
<v Speaker 3>which means it uses a required rather than import, and

461
00:32:16.880 --> 00:32:19.920
<v Speaker 3>also all the tests that we had did a lot

462
00:32:19.960 --> 00:32:23.799
<v Speaker 3>of their mocking based on the assumption that require was

463
00:32:23.880 --> 00:32:28.039
<v Speaker 3>being used, I can figure the output to be common JS.

464
00:32:28.319 --> 00:32:31.079
<v Speaker 3>That means that in the ts files that we're creating,

465
00:32:31.160 --> 00:32:35.000
<v Speaker 3>we can actually start using imports, but when the JavaScript,

466
00:32:35.079 --> 00:32:40.839
<v Speaker 3>when the TSC compiles it into JavaScript, those import become required. Now,

467
00:32:41.000 --> 00:32:44.200
<v Speaker 3>again this is less than ideal because ideally we would

468
00:32:44.319 --> 00:32:50.480
<v Speaker 3>like to also move eventually from common JS over to ESM.

469
00:32:51.200 --> 00:32:54.559
<v Speaker 3>But you know, one thing at a time, you can't

470
00:32:54.599 --> 00:32:58.240
<v Speaker 3>do everything all at once. So the next thing that

471
00:32:58.279 --> 00:33:02.640
<v Speaker 3>I did was allow JS files, since as I explained

472
00:33:02.759 --> 00:33:07.440
<v Speaker 3>multiple times, we aren't actually converting most of the files

473
00:33:07.480 --> 00:33:11.279
<v Speaker 3>yet most of the files remain JS. What it means

474
00:33:11.279 --> 00:33:15.039
<v Speaker 3>by allowed JS files it means that the ts C

475
00:33:15.400 --> 00:33:19.680
<v Speaker 3>will also process the JS files, effectively copying them over

476
00:33:19.759 --> 00:33:24.119
<v Speaker 3>into the disc folder when it compiles the project.

477
00:33:24.200 --> 00:33:25.759
<v Speaker 2>So that you had to do that.

478
00:33:25.799 --> 00:33:28.279
<v Speaker 1>Could you mentioned that earlier about about creating that.

479
00:33:28.480 --> 00:33:31.359
<v Speaker 3>Because I don't. If I don't do that, think what

480
00:33:31.400 --> 00:33:34.359
<v Speaker 3>would happen That this folder will only contain the like

481
00:33:34.440 --> 00:33:37.119
<v Speaker 3>the three JS files that were compiled out of the

482
00:33:37.160 --> 00:33:40.640
<v Speaker 3>TS So sorry, I wouldn't be able to run the

483
00:33:40.680 --> 00:33:44.640
<v Speaker 3>original because the original already contained some TS files and

484
00:33:44.880 --> 00:33:48.480
<v Speaker 3>no doesn't know R to run them, at least without

485
00:33:48.519 --> 00:33:51.880
<v Speaker 3>that special command line switch. The disc folder will just

486
00:33:52.279 --> 00:33:55.319
<v Speaker 3>contain the JS files generated from those TS files, so

487
00:33:55.400 --> 00:33:57.759
<v Speaker 3>most of the files will be gone, so neither the

488
00:33:57.839 --> 00:34:01.039
<v Speaker 3>original source nor the disc fold there would be runnable.

489
00:34:01.720 --> 00:34:04.759
<v Speaker 3>I wanted the disk folder to be runnable, which means

490
00:34:04.759 --> 00:34:07.920
<v Speaker 3>that all the JAS files needed to be compiled quote

491
00:34:08.000 --> 00:34:10.199
<v Speaker 3>unquote into that folder as well.

492
00:34:10.559 --> 00:34:12.440
<v Speaker 1>So my point was just that you had to have

493
00:34:12.519 --> 00:34:16.159
<v Speaker 1>this in conjunction with the earlier build step that copies

494
00:34:16.159 --> 00:34:18.679
<v Speaker 1>everything to the separate discfolder. You'd get a whole lot

495
00:34:18.719 --> 00:34:19.079
<v Speaker 1>of nothing.

496
00:34:19.880 --> 00:34:23.800
<v Speaker 3>Basically. Yes, now, some of the code, some of the

497
00:34:23.960 --> 00:34:29.559
<v Speaker 3>Jazz files actually required JSON files that were also located

498
00:34:29.719 --> 00:34:34.079
<v Speaker 3>in the src folder with him. So what you also

499
00:34:34.199 --> 00:34:37.320
<v Speaker 3>need to enable is the flag that tells TSC to

500
00:34:39.079 --> 00:34:42.920
<v Speaker 3>handle to resolve Jason files. So it sees that a

501
00:34:43.000 --> 00:34:47.519
<v Speaker 3>certain JavaScript or typescript files requires a jason file. It

502
00:34:47.639 --> 00:34:51.679
<v Speaker 3>will also copy that Jason file over to that disk

503
00:34:51.760 --> 00:34:56.239
<v Speaker 3>folder in the same relative location. And because if I

504
00:34:56.280 --> 00:34:59.840
<v Speaker 3>initially neglected to do that, it didn't find those Jason

505
00:34:59.880 --> 00:35:02.239
<v Speaker 3>f files when I try to run the project and

506
00:35:02.559 --> 00:35:05.840
<v Speaker 3>that turned out to be bad. You can easily search

507
00:35:05.920 --> 00:35:09.480
<v Speaker 3>your folder and see if you've got any files that

508
00:35:09.880 --> 00:35:16.800
<v Speaker 3>don't match the dot js or dot jsx extension, and

509
00:35:16.840 --> 00:35:19.480
<v Speaker 3>then you know that you need to make sure that

510
00:35:19.519 --> 00:35:23.519
<v Speaker 3>these are copied over into the disc folder as well,

511
00:35:24.280 --> 00:35:29.840
<v Speaker 3>and preferably by the TSC compiler itself. The next thing

512
00:35:29.880 --> 00:35:33.480
<v Speaker 3>that I needed to do was enable source maps for debugging,

513
00:35:34.800 --> 00:35:37.880
<v Speaker 3>since I still want to be able to debug the project,

514
00:35:38.960 --> 00:35:41.679
<v Speaker 3>but now I'm actually running it from the disk folder,

515
00:35:41.719 --> 00:35:45.239
<v Speaker 3>but I want to debug it in the typescript files.

516
00:35:45.280 --> 00:35:47.559
<v Speaker 3>I want to see the original code that I wrote

517
00:35:48.000 --> 00:35:51.880
<v Speaker 3>when I put in break points, not the compiled output code.

518
00:35:52.280 --> 00:35:57.199
<v Speaker 3>It's very similar, but it's not identical, and I prefer

519
00:35:57.360 --> 00:36:00.960
<v Speaker 3>debugging the original. So in order to achieve that, you

520
00:36:01.119 --> 00:36:04.960
<v Speaker 3>enable source maps. Source maps are maps with the dot

521
00:36:05.079 --> 00:36:10.280
<v Speaker 3>map extension that are generated by default in the same

522
00:36:10.440 --> 00:36:15.239
<v Speaker 3>disk folder alongside the JS files. So if you had

523
00:36:15.280 --> 00:36:19.639
<v Speaker 3>an x dot ts it gets compiled into the same

524
00:36:19.679 --> 00:36:24.000
<v Speaker 3>relative location, and the disk folder into actually two files,

525
00:36:24.400 --> 00:36:27.280
<v Speaker 3>one with the dot x dot JS and one with

526
00:36:27.719 --> 00:36:31.079
<v Speaker 3>called x dot map. And actually at the very bottom

527
00:36:31.119 --> 00:36:34.800
<v Speaker 3>of the JS file, it adds a special comment that

528
00:36:35.039 --> 00:36:41.800
<v Speaker 3>tells dev tools where that where the map file is located.

529
00:36:41.800 --> 00:36:44.159
<v Speaker 3>And in this case it's easy because it's located in

530
00:36:44.199 --> 00:36:49.400
<v Speaker 3>exactly the same place, so it's a simple relative location.

531
00:36:49.719 --> 00:36:53.840
<v Speaker 3>Map files enable debuggers like dev tools, which is built

532
00:36:53.880 --> 00:36:57.880
<v Speaker 3>into Chrome or Edge or effectively any dev tools of

533
00:36:57.920 --> 00:37:03.000
<v Speaker 3>any debugger any browser, sorry or the built in the

534
00:37:03.119 --> 00:37:07.199
<v Speaker 3>buggers in most IDs, to be able to single step

535
00:37:07.599 --> 00:37:13.480
<v Speaker 3>through the original files because the debuggers is smart enough

536
00:37:13.480 --> 00:37:17.920
<v Speaker 3>to understand that this line in this file is actually translated.

537
00:37:18.119 --> 00:37:22.280
<v Speaker 3>It matches that line in the original file, and here's

538
00:37:22.639 --> 00:37:29.119
<v Speaker 3>the location of that original file relative to the compiled

539
00:37:29.159 --> 00:37:33.280
<v Speaker 3>output file. The next thing I enabled was strict type checking.

540
00:37:33.599 --> 00:37:37.079
<v Speaker 3>I was kind of concerned about that, but there was

541
00:37:37.119 --> 00:37:41.239
<v Speaker 3>no problem with it, so I used that. And I

542
00:37:41.320 --> 00:37:45.360
<v Speaker 3>also in our case, because we're using common JS, I

543
00:37:45.440 --> 00:37:49.320
<v Speaker 3>made sure to enable the flag that instructs TSC to

544
00:37:49.400 --> 00:37:52.000
<v Speaker 3>always put you strict at the type of at the

545
00:37:52.000 --> 00:37:56.599
<v Speaker 3>top of the generated files. If you're using ESM, you

546
00:37:56.679 --> 00:38:01.800
<v Speaker 3>don't need it because ESM files arem module files are

547
00:38:01.880 --> 00:38:05.960
<v Speaker 3>strict by default. But in our case sense again, since

548
00:38:06.000 --> 00:38:10.000
<v Speaker 3>everything was compiled to common JS, I really wanted to

549
00:38:10.039 --> 00:38:13.079
<v Speaker 3>have you strict there to get strict behavior.

550
00:38:13.840 --> 00:38:16.719
<v Speaker 1>Can you elucidate on what strict means or what it's

551
00:38:16.760 --> 00:38:17.119
<v Speaker 1>going to do.

552
00:38:17.920 --> 00:38:22.199
<v Speaker 3>Yeah, Strict is a very old JavaScript feature, dates back

553
00:38:22.239 --> 00:38:27.840
<v Speaker 3>to US six or before. Basically, there was certain let's

554
00:38:27.880 --> 00:38:32.800
<v Speaker 3>call it less than ideal behaviors in JavaScript that they

555
00:38:32.880 --> 00:38:36.039
<v Speaker 3>unfortunately could not remove out of the language due to

556
00:38:36.119 --> 00:38:41.079
<v Speaker 3>backward compatibility issues, and the way that they decided to

557
00:38:41.159 --> 00:38:45.840
<v Speaker 3>fix them was add this use strict directive that if

558
00:38:45.840 --> 00:38:48.400
<v Speaker 3>you put it at the top of your file, for example,

559
00:38:48.719 --> 00:38:53.440
<v Speaker 3>it's just a string quote open quote U strict close quote.

560
00:38:54.480 --> 00:39:00.000
<v Speaker 3>It puts the JavaScript engine in strict mode, which changed

561
00:39:00.199 --> 00:39:05.599
<v Speaker 3>just certain those certain bad behaviors a couple of examples.

562
00:39:07.880 --> 00:39:11.960
<v Speaker 3>The with statement turned out to be a bad idea

563
00:39:12.280 --> 00:39:18.119
<v Speaker 3>in JavaScript for various reasons. With you strict with is gone.

564
00:39:19.519 --> 00:39:24.559
<v Speaker 3>There's also a difference in what happens if you try

565
00:39:24.639 --> 00:39:29.880
<v Speaker 3>to use this outside the context of an object. You know,

566
00:39:29.920 --> 00:39:32.119
<v Speaker 3>if you just have a function and it does this

567
00:39:32.239 --> 00:39:35.920
<v Speaker 3>dot x before you strict, it would default to the

568
00:39:35.920 --> 00:39:42.320
<v Speaker 3>global object with stricted defaults to undefined. So they they

569
00:39:43.159 --> 00:39:48.360
<v Speaker 3>made certain changes that improved the behavior of JavaScript, but

570
00:39:48.480 --> 00:39:51.159
<v Speaker 3>they were not backward compatible, so they had to add

571
00:39:51.280 --> 00:39:55.599
<v Speaker 3>the TC thirty nine way back when had to add

572
00:39:55.719 --> 00:39:59.480
<v Speaker 3>this flag in order to support it. Now in modern

573
00:39:59.639 --> 00:40:03.400
<v Speaker 3>environment like EES models, if you're using ESM, then by

574
00:40:03.840 --> 00:40:08.199
<v Speaker 3>by definition you're using e S six, then you you're

575
00:40:08.719 --> 00:40:11.400
<v Speaker 3>they can assume that you're US strict by default because

576
00:40:11.400 --> 00:40:15.119
<v Speaker 3>there are no backward compatibility issues there. Likewise, if you're

577
00:40:15.159 --> 00:40:20.519
<v Speaker 3>inside of a JavaScript class, again it's modern JavaScript by definition,

578
00:40:21.039 --> 00:40:25.199
<v Speaker 3>so they can assume you strict within that class, regardless

579
00:40:25.199 --> 00:40:27.800
<v Speaker 3>of whether you put ustrict that in the top of

580
00:40:27.840 --> 00:40:30.320
<v Speaker 3>the file or not. And the last thing that I

581
00:40:30.400 --> 00:40:34.519
<v Speaker 3>needed to add was to skip lib lib tests, which

582
00:40:34.679 --> 00:40:38.800
<v Speaker 3>checks that you have type definitions for all the LIBS

583
00:40:39.480 --> 00:40:43.000
<v Speaker 3>libraries that you're using, because you were using some old

584
00:40:43.039 --> 00:40:49.800
<v Speaker 3>and even almost deprecated libraries which and especially some internal

585
00:40:49.880 --> 00:40:53.679
<v Speaker 3>libraries did not have type information, which means that did

586
00:40:53.679 --> 00:40:57.480
<v Speaker 3>they did not have a d dot t S files.

587
00:40:57.480 --> 00:40:59.400
<v Speaker 3>If you're familiar with the concept, yes, we.

588
00:40:59.360 --> 00:41:02.320
<v Speaker 1>Would clarify that lib is not liberal versus conservative, that

589
00:41:02.480 --> 00:41:03.400
<v Speaker 1>is library.

590
00:41:03.880 --> 00:41:08.159
<v Speaker 3>Yeah, exactly. So you've got a library let's say let's

591
00:41:08.159 --> 00:41:11.280
<v Speaker 3>say you have a library and it was compiled when

592
00:41:11.280 --> 00:41:14.800
<v Speaker 3>it was built from typescript to JavaScript, and you are

593
00:41:14.920 --> 00:41:20.679
<v Speaker 3>only distributing that library because it's it's an NPM package.

594
00:41:21.000 --> 00:41:26.360
<v Speaker 3>You're only distributing it as the compiled output the JAS files.

595
00:41:26.360 --> 00:41:29.960
<v Speaker 3>But you still want the type information, so that code

596
00:41:30.440 --> 00:41:35.719
<v Speaker 3>that uses that library can can only call library APIs

597
00:41:36.119 --> 00:41:40.960
<v Speaker 3>with your passing in the correct parameters of the correct

598
00:41:40.960 --> 00:41:46.119
<v Speaker 3>types and stuff like that. So what the Typescript compiler

599
00:41:46.159 --> 00:41:49.000
<v Speaker 3>can do is it generates a file with a dot

600
00:41:49.360 --> 00:41:55.679
<v Speaker 3>D dot ts extension, and that file contains type definitions

601
00:41:55.679 --> 00:42:00.280
<v Speaker 3>for that library, so that Typescript knows to verify that

602
00:42:00.360 --> 00:42:04.039
<v Speaker 3>you're using that library correctly. But some of our own libraries,

603
00:42:04.119 --> 00:42:08.840
<v Speaker 3>especially internal libraries, were old, did not have this support,

604
00:42:08.920 --> 00:42:11.840
<v Speaker 3>and unless I told it to skip the library tests,

605
00:42:12.119 --> 00:42:15.000
<v Speaker 3>it would fail because they would say, hey, you're trying

606
00:42:15.039 --> 00:42:18.320
<v Speaker 3>to use this library. I'm looking for type information for

607
00:42:18.400 --> 00:42:21.440
<v Speaker 3>this library and I can't find it. I can't use it,

608
00:42:21.960 --> 00:42:26.880
<v Speaker 3>you know, abort. By setting that skip lip tests, I

609
00:42:26.920 --> 00:42:29.679
<v Speaker 3>was able to tell TSC, you know, okay, it is

610
00:42:29.719 --> 00:42:34.400
<v Speaker 3>what it is, just deal with it. Give the things

611
00:42:34.400 --> 00:42:38.760
<v Speaker 3>that you import from that library type any effectively, well

612
00:42:38.800 --> 00:42:45.559
<v Speaker 3>not effectively literally now, since all the JavaScript files are

613
00:42:45.599 --> 00:42:50.400
<v Speaker 3>also processed as I explained. As I said, I needed

614
00:42:50.400 --> 00:42:53.840
<v Speaker 3>to specify everything to go into a disk folder to

615
00:42:53.960 --> 00:42:58.960
<v Speaker 3>avoid collisions. And obviously you need to add this disc

616
00:42:59.039 --> 00:43:02.679
<v Speaker 3>folder to your get ignored for example, because you don't

617
00:43:02.760 --> 00:43:08.159
<v Speaker 3>want to save that disc folder into git up for example,

618
00:43:08.199 --> 00:43:11.199
<v Speaker 3>because it's you know, you don't ever put in git

619
00:43:11.880 --> 00:43:15.480
<v Speaker 3>auto generated files. The next thing I wanted to do

620
00:43:15.599 --> 00:43:19.400
<v Speaker 3>is install types for various libraries that I use, So

621
00:43:19.719 --> 00:43:25.199
<v Speaker 3>you basically NPM install or arn't add things like at

622
00:43:25.280 --> 00:43:31.599
<v Speaker 3>types slash node or at types slash Express. Basically there

623
00:43:31.639 --> 00:43:34.519
<v Speaker 3>are a lot of these type these things that you

624
00:43:34.559 --> 00:43:39.840
<v Speaker 3>can install or that are at types slash something based

625
00:43:39.880 --> 00:43:43.039
<v Speaker 3>on the service or library that you use, and they

626
00:43:43.159 --> 00:43:47.360
<v Speaker 3>just make sure to add the type information for those

627
00:43:47.679 --> 00:43:51.000
<v Speaker 3>various libraries and services. So now that if I use

628
00:43:51.039 --> 00:43:54.519
<v Speaker 3>a Node API, I get the type checking for that

629
00:43:54.639 --> 00:43:57.920
<v Speaker 3>Node API, or likewise for Express, which is really great

630
00:43:57.960 --> 00:44:03.639
<v Speaker 3>and what we really want Typeescript for. Since I had

631
00:44:03.679 --> 00:44:08.039
<v Speaker 3>to put Typescript itself as a prod dependency, I unfortunately

632
00:44:08.519 --> 00:44:10.880
<v Speaker 3>had to put these as a proud dependency as well.

633
00:44:11.199 --> 00:44:14.320
<v Speaker 3>In your case, if your CICD allows it. You can

634
00:44:14.360 --> 00:44:19.840
<v Speaker 3>put both d S and these type these type packages

635
00:44:20.320 --> 00:44:26.599
<v Speaker 3>as as dev dependency sorry, assuming again your CICD pipeline

636
00:44:26.599 --> 00:44:31.360
<v Speaker 3>supports it. I also needed to install a package called

637
00:44:31.639 --> 00:44:36.599
<v Speaker 3>source slash map slash support to get the proper debugging

638
00:44:36.639 --> 00:44:39.119
<v Speaker 3>support in all the environments that I use with the

639
00:44:39.159 --> 00:44:42.239
<v Speaker 3>map files that have already configured. The generation of a

640
00:44:42.280 --> 00:44:46.360
<v Speaker 3>lot of steps and again not trivial. I for some

641
00:44:46.519 --> 00:44:50.320
<v Speaker 3>reason I couldn't really find Maybe our listeners are better

642
00:44:50.400 --> 00:44:53.320
<v Speaker 3>at they have a stronger Google for AI food than

643
00:44:53.360 --> 00:44:56.199
<v Speaker 3>I have and can find this information. I could not

644
00:44:56.519 --> 00:45:00.599
<v Speaker 3>find a clear description of all this information. The next

645
00:45:00.639 --> 00:45:04.400
<v Speaker 3>step that I had to do is I had to

646
00:45:04.440 --> 00:45:08.760
<v Speaker 3>do with eslint. So I assume or hope that you're

647
00:45:08.880 --> 00:45:12.679
<v Speaker 3>using islint in your project. If you do. If you don't,

648
00:45:12.960 --> 00:45:18.880
<v Speaker 3>then you should. We had guests on our show talking

649
00:45:18.920 --> 00:45:26.639
<v Speaker 3>about eslinteslint is a linting tool that verifies that you're

650
00:45:26.920 --> 00:45:33.719
<v Speaker 3>using the language JavaScript according to best practices you know,

651
00:45:33.840 --> 00:45:37.840
<v Speaker 3>either generally accepted or ones that you've decided on within

652
00:45:37.880 --> 00:45:42.559
<v Speaker 3>your organization. It could be almost comical rules like you know,

653
00:45:42.679 --> 00:45:46.480
<v Speaker 3>prefer quote single quote over double quotes, so you don't

654
00:45:46.519 --> 00:45:49.639
<v Speaker 3>have a random mixture of both types of quote in

655
00:45:49.639 --> 00:45:55.199
<v Speaker 3>your project. Or it can be about things like putting

656
00:45:55.239 --> 00:45:57.599
<v Speaker 3>the curly brackets at the end of the line rather

657
00:45:57.719 --> 00:46:01.119
<v Speaker 3>at the beginning of the next line, and so on

658
00:46:01.159 --> 00:46:04.159
<v Speaker 3>and so forth, everything that you prefer in terms of

659
00:46:04.280 --> 00:46:13.400
<v Speaker 3>coding style and avoiding legal but bad patterns within your code. Now,

660
00:46:13.519 --> 00:46:18.320
<v Speaker 3>if you're using Typescript, you also want to install something

661
00:46:18.440 --> 00:46:22.360
<v Speaker 3>called t s slint or Typescript e slint. We had

662
00:46:22.519 --> 00:46:25.960
<v Speaker 3>Josh Goldberg on our show to talk about why you

663
00:46:26.079 --> 00:46:32.000
<v Speaker 3>want this. Basically, it's es slint for your Typescript. Now.

664
00:46:32.039 --> 00:46:36.280
<v Speaker 3>You need it for two reasons. The obvious reasons is

665
00:46:36.320 --> 00:46:41.960
<v Speaker 3>that it adds particular specific linting rules for Typescript itself.

666
00:46:42.519 --> 00:46:48.079
<v Speaker 3>I mean obviously because similarly to JavaScript, there can be

667
00:46:48.199 --> 00:46:52.639
<v Speaker 3>things that are legal in Typescript, but you nonetheless prefer

668
00:46:52.719 --> 00:46:55.679
<v Speaker 3>to avoid because there are sort of anti patterns in

669
00:46:55.719 --> 00:46:59.719
<v Speaker 3>the language. But it actually goes beyond that. It turns

670
00:46:59.760 --> 00:47:05.320
<v Speaker 3>out without t S slint, eslint itself will flag certain

671
00:47:05.400 --> 00:47:11.480
<v Speaker 3>things in your Typeescript code as bugs because they don't

672
00:47:11.599 --> 00:47:18.199
<v Speaker 3>match lint JavaScript linting rules. For example, you can use

673
00:47:18.360 --> 00:47:23.840
<v Speaker 3>extends in JavaScript in TS in Typescript generics, but it

674
00:47:23.960 --> 00:47:28.800
<v Speaker 3>assumes that extends its used for extending JavaScript classes and

675
00:47:28.840 --> 00:47:31.760
<v Speaker 3>that you're using it wrong and it flags it. So

676
00:47:31.800 --> 00:47:35.280
<v Speaker 3>you need t S e S Flint for the linting

677
00:47:35.440 --> 00:47:39.400
<v Speaker 3>to work properly. Now, if you're adding t S slint,

678
00:47:39.960 --> 00:47:42.599
<v Speaker 3>you need to make sure that you're using the latest

679
00:47:42.679 --> 00:47:47.400
<v Speaker 3>version of eslint. Unfortunately, because we were a legacy project

680
00:47:47.480 --> 00:47:51.079
<v Speaker 3>in our case, this was not the case. So I

681
00:47:51.119 --> 00:47:56.360
<v Speaker 3>had to update eslint to the latest version. And then

682
00:47:56.440 --> 00:48:00.960
<v Speaker 3>I found out the hard way that they the Slint project,

683
00:48:02.239 --> 00:48:07.360
<v Speaker 3>made a significant, not backward compatible change in the way

684
00:48:07.400 --> 00:48:12.039
<v Speaker 3>in which they managed configuration. They went to a flat

685
00:48:12.079 --> 00:48:17.000
<v Speaker 3>configuration file. They basically changed the whole structure of the configuration.

686
00:48:17.679 --> 00:48:21.760
<v Speaker 3>So I had to go through the process of fixing

687
00:48:21.800 --> 00:48:26.199
<v Speaker 3>the configurations and as long as I was there, rethinking

688
00:48:26.239 --> 00:48:29.920
<v Speaker 3>the configurations because a lot of the rules were dated,

689
00:48:30.440 --> 00:48:35.159
<v Speaker 3>so I updated our Slint rules as a part of

690
00:48:35.199 --> 00:48:38.440
<v Speaker 3>this migration process. As you can see a lot of work.

691
00:48:38.519 --> 00:48:41.320
<v Speaker 3>The next issue that I ran into was the fact

692
00:48:41.360 --> 00:48:44.519
<v Speaker 3>that some people on our team prefer using vis Code

693
00:48:44.840 --> 00:48:47.639
<v Speaker 3>and some people in our team preferred using web Storm

694
00:48:48.079 --> 00:48:53.440
<v Speaker 3>for JavaScript development, and I wanted to support both I

695
00:48:53.480 --> 00:48:56.760
<v Speaker 3>didn't want to force people to have to switch their

696
00:48:56.800 --> 00:49:00.159
<v Speaker 3>development environment, which means that I had to get at

697
00:49:00.480 --> 00:49:05.239
<v Speaker 3>everything working in both. And where this ran into a

698
00:49:05.320 --> 00:49:11.719
<v Speaker 3>problem was with the unit tests. Web Storm out of

699
00:49:11.760 --> 00:49:15.000
<v Speaker 3>the box had this ability, has this great ability that

700
00:49:15.079 --> 00:49:23.039
<v Speaker 3>it can actually scan your files, find the unit tests,

701
00:49:23.639 --> 00:49:27.039
<v Speaker 3>and make it possible to run individual unit tests and

702
00:49:27.079 --> 00:49:32.760
<v Speaker 3>debug individual unit tests directly from within the web Storm environment.

703
00:49:32.840 --> 00:49:35.400
<v Speaker 3>You can actually do the same thing in VS code,

704
00:49:35.679 --> 00:49:38.920
<v Speaker 3>but you actually need to install an appropriate extension first.

705
00:49:39.000 --> 00:49:42.400
<v Speaker 3>Once you install the extension, it's great. I actually prefer

706
00:49:42.559 --> 00:49:45.599
<v Speaker 3>vis code with the extension of a WebStorm, but that's me.

707
00:49:46.159 --> 00:49:49.679
<v Speaker 3>We had developers who preferred using WebStorm, and for the

708
00:49:49.840 --> 00:49:54.719
<v Speaker 3>life of me, I could not get WebStorm to handle

709
00:49:55.119 --> 00:50:01.400
<v Speaker 3>the situation in which the TS file files were located

710
00:50:01.480 --> 00:50:05.159
<v Speaker 3>in one place and the output JS files were located

711
00:50:05.199 --> 00:50:08.480
<v Speaker 3>in a different place in the disfolder and to figure

712
00:50:08.519 --> 00:50:11.719
<v Speaker 3>out that even though the test code the source code

713
00:50:11.760 --> 00:50:14.360
<v Speaker 3>for the test was here, it should actually run the

714
00:50:14.400 --> 00:50:17.480
<v Speaker 3>code that's over there and use the map files to

715
00:50:17.519 --> 00:50:22.480
<v Speaker 3>properly support the single step and debugging with the VS code.

716
00:50:22.559 --> 00:50:25.119
<v Speaker 3>And as I said, we were using Mocha and Shi

717
00:50:25.880 --> 00:50:30.159
<v Speaker 3>on VS code. I was able to install those the

718
00:50:30.280 --> 00:50:35.119
<v Speaker 3>vs code extensions for Moca properly configure it. It just worked.

719
00:50:35.159 --> 00:50:39.280
<v Speaker 3>In that scenario WebStorm, I could not get it to work.

720
00:50:39.719 --> 00:50:41.800
<v Speaker 3>The only way in which I finally was able to

721
00:50:41.800 --> 00:50:45.199
<v Speaker 3>get it to work. As I mentioned before, this tsnode

722
00:50:45.360 --> 00:50:49.960
<v Speaker 3>thing where it's a wrapper to node that teaches node

723
00:50:49.960 --> 00:50:53.320
<v Speaker 3>how to handle TS files. So I actually had to

724
00:50:53.360 --> 00:50:58.199
<v Speaker 3>configure the template file for Moca on WebStorm to use

725
00:50:58.320 --> 00:51:03.079
<v Speaker 3>tsnde instead of nodes, and then it worked. So I

726
00:51:03.599 --> 00:51:10.199
<v Speaker 3>used a different typical configuration between web Storm and between

727
00:51:10.360 --> 00:51:15.159
<v Speaker 3>vs code and vis code. I would I preferred the

728
00:51:15.280 --> 00:51:18.599
<v Speaker 3>test to run closer to the way that they run

729
00:51:18.599 --> 00:51:22.119
<v Speaker 3>in the CICD pipeline. That means to run the test

730
00:51:22.159 --> 00:51:25.519
<v Speaker 3>and the compiled tests and the disfolder. And as I said,

731
00:51:25.880 --> 00:51:28.519
<v Speaker 3>I could get I could get it to work with

732
00:51:29.199 --> 00:51:34.840
<v Speaker 3>the source maps because the extension from Mocha was smart

733
00:51:34.920 --> 00:51:37.800
<v Speaker 3>enough to handle it. In the case of WebStorm, I

734
00:51:37.800 --> 00:51:39.719
<v Speaker 3>don't know if it can or it can't. I could

735
00:51:39.800 --> 00:51:43.239
<v Speaker 3>not figure it out. I had to use ts node.

736
00:51:44.000 --> 00:51:46.000
<v Speaker 2>Now you can still run the test from the command line,

737
00:51:46.039 --> 00:51:46.480
<v Speaker 2>Is that right?

738
00:51:46.960 --> 00:51:47.159
<v Speaker 3>Yeah?

739
00:51:47.599 --> 00:51:49.840
<v Speaker 1>You're talking about is like the UI you know, it

740
00:51:49.840 --> 00:51:52.119
<v Speaker 1>gives you a little button you can press run this test.

741
00:51:52.480 --> 00:51:57.199
<v Speaker 3>Exactly exactly which you want if you want to debug tests,

742
00:51:58.320 --> 00:52:01.440
<v Speaker 3>because when you have that button, you can actually right

743
00:52:01.519 --> 00:52:04.719
<v Speaker 3>click it select debug instead of run, and then you

744
00:52:04.760 --> 00:52:09.840
<v Speaker 3>actually single step that test within your ID, which you know,

745
00:52:09.880 --> 00:52:12.239
<v Speaker 3>if you have a failing test, the ability to debug

746
00:52:12.280 --> 00:52:15.639
<v Speaker 3>that failing test makes life a whole lot easier. It's

747
00:52:15.639 --> 00:52:21.199
<v Speaker 3>certainly much more, much more fun than console log debugging exactly.

748
00:52:21.719 --> 00:52:24.079
<v Speaker 3>And the other thing I needed to do was configure

749
00:52:24.159 --> 00:52:26.760
<v Speaker 3>the Mocha itself to run all the tests from this

750
00:52:27.039 --> 00:52:32.360
<v Speaker 3>test instead of tests. One more thing, and now I

751
00:52:32.519 --> 00:52:37.519
<v Speaker 3>had to start modifying scripts in the package json itself.

752
00:52:38.039 --> 00:52:40.639
<v Speaker 3>You know, we had all the built scripts and run

753
00:52:40.679 --> 00:52:46.519
<v Speaker 3>scripts and dev scripts, so I added the script for example,

754
00:52:46.559 --> 00:52:49.920
<v Speaker 3>a built script so that you could run TC as

755
00:52:50.840 --> 00:52:55.760
<v Speaker 3>NPM run build or Yarn build would literally just run TSC.

756
00:52:57.639 --> 00:53:04.960
<v Speaker 3>But I also wanted to support a more dynamic mode

757
00:53:05.000 --> 00:53:09.599
<v Speaker 3>for development. You know, in development, you want for example, node,

758
00:53:10.599 --> 00:53:14.920
<v Speaker 3>Node has this ability to watch your folder, see that

759
00:53:14.960 --> 00:53:21.800
<v Speaker 3>it changes, and then restart itself whenever it identifies that

760
00:53:21.880 --> 00:53:27.000
<v Speaker 3>the file is changed. But now it becomes a more

761
00:53:27.039 --> 00:53:31.800
<v Speaker 3>complicated scenario because what actually needs to happen is you

762
00:53:31.920 --> 00:53:36.159
<v Speaker 3>save that file. You want that file. You want ESC

763
00:53:36.760 --> 00:53:40.440
<v Speaker 3>to notice that the file is changed and then compile

764
00:53:40.519 --> 00:53:44.480
<v Speaker 3>it to the disk folder. And then Node you want

765
00:53:44.519 --> 00:53:47.000
<v Speaker 3>it to notice that the contents of the disk folder

766
00:53:47.119 --> 00:53:50.920
<v Speaker 3>is changed and to restart itself. So it becomes like

767
00:53:51.199 --> 00:53:55.440
<v Speaker 3>a two step instead of a one step. Is that clear, crystal?

768
00:53:55.599 --> 00:54:01.199
<v Speaker 3>So initially I did the naive thing. There was dev

769
00:54:01.280 --> 00:54:08.159
<v Speaker 3>script in the package Jason that literally had uh node

770
00:54:08.960 --> 00:54:12.880
<v Speaker 3>running Node in watch mode. I forget the syntax. Let

771
00:54:12.960 --> 00:54:16.360
<v Speaker 3>me take a quick look at how it actually is implemented.

772
00:54:18.480 --> 00:54:21.679
<v Speaker 3>So it had it had it used nodemon with a

773
00:54:21.800 --> 00:54:28.400
<v Speaker 3>watch to actually automatically reload Node whenever the content of

774
00:54:28.480 --> 00:54:31.559
<v Speaker 3>the folder change. And originally it was running things directly

775
00:54:31.599 --> 00:54:35.760
<v Speaker 3>from the source folder. I wanted noemond to look at

776
00:54:35.760 --> 00:54:38.440
<v Speaker 3>the disc folder instead. That was easy enough, but I

777
00:54:38.519 --> 00:54:45.079
<v Speaker 3>also wanted uh TSC to look at to watch the

778
00:54:45.119 --> 00:54:48.480
<v Speaker 3>source folder and see if it changed, to compile automatically

779
00:54:48.920 --> 00:54:53.400
<v Speaker 3>into the death folder. And there is a TSC minus

780
00:54:53.400 --> 00:54:58.639
<v Speaker 3>minus watch that you can use for that. So originally, initially,

781
00:54:58.880 --> 00:55:01.840
<v Speaker 3>so one thing you can do just run those two

782
00:55:01.840 --> 00:55:06.159
<v Speaker 3>commands separately. You can open like two terminals, or you

783
00:55:06.239 --> 00:55:10.199
<v Speaker 3>can use in vs code there's this thing that they call,

784
00:55:10.280 --> 00:55:15.920
<v Speaker 3>I forget the name tasks you can do. You can

785
00:55:16.000 --> 00:55:21.159
<v Speaker 3>run both two tasks, one to have TSC watching your

786
00:55:21.239 --> 00:55:25.960
<v Speaker 3>source and node more watching your disc. But I did

787
00:55:26.039 --> 00:55:28.639
<v Speaker 3>want to have to do to force our developers to

788
00:55:28.719 --> 00:55:31.639
<v Speaker 3>do these two steps, where in the past they just

789
00:55:31.719 --> 00:55:36.280
<v Speaker 3>did one. In the past, they would just do yarn

790
00:55:37.639 --> 00:55:39.800
<v Speaker 3>dev and it just worked, and I wanted to work

791
00:55:39.840 --> 00:55:42.679
<v Speaker 3>this way. So initially I was kind of naive and

792
00:55:42.719 --> 00:55:47.039
<v Speaker 3>I did TSC minus minus watch, then hun percent unpercent

793
00:55:47.559 --> 00:55:51.679
<v Speaker 3>node mon minus minus watch, and it didn't work. Can

794
00:55:51.719 --> 00:55:54.000
<v Speaker 3>you guess why it didn't work. It didn't work because

795
00:55:54.159 --> 00:55:57.920
<v Speaker 3>un percent unpercent waits for the process on the left

796
00:55:58.360 --> 00:56:01.719
<v Speaker 3>to finish successfully before running the process on the right.

797
00:56:02.000 --> 00:56:04.280
<v Speaker 3>If you remember your Bash.

798
00:56:04.280 --> 00:56:06.840
<v Speaker 2>Oh sorry, I'm not a Bash guru, but hey, strip, so.

799
00:56:07.840 --> 00:56:11.199
<v Speaker 3>It was waiting on TSC minus minus watch to successfully

800
00:56:11.239 --> 00:56:14.679
<v Speaker 3>finish before running a nodemond. But TSC minus minus watch

801
00:56:14.800 --> 00:56:19.280
<v Speaker 3>never finishes. That's the whole point. It runs continuously in

802
00:56:19.400 --> 00:56:22.840
<v Speaker 3>order to watch for changes in the source file never

803
00:56:23.280 --> 00:56:26.280
<v Speaker 3>so it never actually ran the nodemd Oh. Yeah. So

804
00:56:26.800 --> 00:56:30.000
<v Speaker 3>the easiest solution that I finally found for this is

805
00:56:30.480 --> 00:56:34.880
<v Speaker 3>another package called concurrently, which you can tell it to

806
00:56:35.039 --> 00:56:38.880
<v Speaker 3>run both things simultaneously and kill them both if you

807
00:56:38.960 --> 00:56:43.719
<v Speaker 3>do a control C. So look at a package called concurrently.

808
00:56:44.480 --> 00:56:46.679
<v Speaker 3>That's what I used to fix it. Maybe there's a

809
00:56:46.760 --> 00:56:50.440
<v Speaker 3>smart maybe smarter Bash gurus can do it without it.

810
00:56:50.960 --> 00:56:53.800
<v Speaker 3>That was the easiest solution for me. That's what I

811
00:56:53.880 --> 00:56:57.440
<v Speaker 3>ended up using. Notice one important thing that I have

812
00:56:57.639 --> 00:57:01.320
<v Speaker 3>not done so far at all, and that's kind of important.

813
00:57:01.400 --> 00:57:04.880
<v Speaker 3>I wanted to emphasize this. All this work was done

814
00:57:05.559 --> 00:57:11.920
<v Speaker 3>before I converted even one JS file to Typescript. So

815
00:57:12.119 --> 00:57:16.000
<v Speaker 3>I've got all this pipeline working and TSC working and whatnot,

816
00:57:16.440 --> 00:57:20.519
<v Speaker 3>but it's basically compiling JavaScript files to JavaScript files. I

817
00:57:20.559 --> 00:57:23.159
<v Speaker 3>don't have a single TS file in the project yet.

818
00:57:23.239 --> 00:57:28.079
<v Speaker 3>And that's really important because initially I kind of when

819
00:57:28.119 --> 00:57:30.960
<v Speaker 3>I kind of got ahead of myself and I started

820
00:57:31.039 --> 00:57:35.599
<v Speaker 3>moving JS files to TS in order to see that

821
00:57:35.679 --> 00:57:39.840
<v Speaker 3>things worked before I had everything properly working, and then

822
00:57:39.920 --> 00:57:43.280
<v Speaker 3>I ran into all sorts of problems, which eventually ended

823
00:57:43.360 --> 00:57:45.880
<v Speaker 3>up with me throwing the whole thing away and starting

824
00:57:45.880 --> 00:57:50.800
<v Speaker 3>from scratch. So make sure you've got everything working so

825
00:57:51.000 --> 00:57:55.880
<v Speaker 3>far before moving even a single JS file to TS,

826
00:57:55.880 --> 00:58:00.000
<v Speaker 3>because otherwise you'll be sorry. So create a PR from

827
00:58:00.079 --> 00:58:04.000
<v Speaker 3>everything that you've done so far, make sure that everything

828
00:58:04.079 --> 00:58:07.719
<v Speaker 3>according to what I explained. Make sure that your CI,

829
00:58:07.840 --> 00:58:13.760
<v Speaker 3>your updated CICD now passes while running TSC again without

830
00:58:13.960 --> 00:58:17.239
<v Speaker 3>converting any TS file yet at all.

831
00:58:18.599 --> 00:58:20.920
<v Speaker 1>And I didn't with the assumption being that when you

832
00:58:21.000 --> 00:58:25.239
<v Speaker 1>do convert TS files and everything's in place, right, you haven't.

833
00:58:25.559 --> 00:58:27.639
<v Speaker 1>Everything you've done is to handle the conversion of the

834
00:58:27.679 --> 00:58:30.440
<v Speaker 1>typescript files to jobascript exactly.

835
00:58:30.519 --> 00:58:33.800
<v Speaker 3>I wanted to get to a situation where everything else

836
00:58:33.920 --> 00:58:39.199
<v Speaker 3>worked and then I can start converting files individually and

837
00:58:39.280 --> 00:58:41.559
<v Speaker 3>not have to worry about it. I didn't want to

838
00:58:42.119 --> 00:58:45.559
<v Speaker 3>deal both with the configurations and the conversions at the

839
00:58:45.599 --> 00:58:50.079
<v Speaker 3>same time. So I created a PR. I verified that

840
00:58:50.239 --> 00:58:53.519
<v Speaker 3>the whole CI process passed for that PR. I didn't

841
00:58:53.559 --> 00:58:56.159
<v Speaker 3>merge that PR. I just wanted to see that it

842
00:58:56.320 --> 00:58:59.840
<v Speaker 3>was green. Yes, after I saw. After I saw that

843
00:58:59.880 --> 00:59:04.719
<v Speaker 3>it was green, I moved one and just one file

844
00:59:05.079 --> 00:59:08.840
<v Speaker 3>from being a jazz file to a TS file and

845
00:59:09.440 --> 00:59:10.880
<v Speaker 3>to see that it still worked.

846
00:59:11.760 --> 00:59:13.920
<v Speaker 2>And by that you just changed the extension.

847
00:59:13.480 --> 00:59:17.400
<v Speaker 3>Right, No, because that's not enough. If I changed the extension,

848
00:59:17.480 --> 00:59:22.159
<v Speaker 3>it would complain about various missing type declarations and whatnot.

849
00:59:22.679 --> 00:59:25.599
<v Speaker 3>I can obviously set it to super relaxed, not the

850
00:59:25.639 --> 00:59:28.840
<v Speaker 3>strict mode, but I intentionally wanted strict mode. So I

851
00:59:29.239 --> 00:59:34.559
<v Speaker 3>actually I chose a really small JS file, literally one

852
00:59:34.599 --> 00:59:37.159
<v Speaker 3>of the smallest files in the project that I can found,

853
00:59:37.880 --> 00:59:41.039
<v Speaker 3>one that was not dependent on any other project, a

854
00:59:41.159 --> 00:59:44.280
<v Speaker 3>file in my project. So it was literally a leaf

855
00:59:44.400 --> 00:59:48.920
<v Speaker 3>file only it may depend on external packages, but not

856
00:59:49.000 --> 00:59:54.239
<v Speaker 3>on anything inside my own project. And I just converted,

857
00:59:54.559 --> 00:59:56.840
<v Speaker 3>but I made sure that that jazz file was actually

858
00:59:56.840 --> 00:59:58.880
<v Speaker 3>a file that's being used. I didn't want to convert

859
00:59:58.960 --> 01:00:04.559
<v Speaker 3>something that nob the actually imports or requires, uh, And

860
01:00:04.639 --> 01:00:09.159
<v Speaker 3>I converted just that JS file D two ts. I

861
01:00:09.239 --> 01:00:12.760
<v Speaker 3>did it using get m vy or get move in

862
01:00:12.880 --> 01:00:16.320
<v Speaker 3>order to preserve its history. Are you familiar with Git move?

863
01:00:16.599 --> 01:00:17.639
<v Speaker 2>Oh, yeah, very much.

864
01:00:17.679 --> 01:00:20.360
<v Speaker 1>So it's basically it's it's one of the weird things

865
01:00:20.360 --> 01:00:23.519
<v Speaker 1>about get, At least to me, it seems a little weird.

866
01:00:24.320 --> 01:00:25.880
<v Speaker 1>Maybe it makes sense when you think about it. If

867
01:00:25.880 --> 01:00:28.760
<v Speaker 1>you want to rename a file, it's not a renamed command.

868
01:00:28.800 --> 01:00:32.320
<v Speaker 1>It's a move command to move it from one file

869
01:00:32.400 --> 01:00:32.880
<v Speaker 1>to another.

870
01:00:34.159 --> 01:00:36.840
<v Speaker 2>Yeah, kind of the same making a branch, same thing

871
01:00:36.840 --> 01:00:38.440
<v Speaker 2>with the branch exactly.

872
01:00:38.880 --> 01:00:41.559
<v Speaker 3>So I did a geit move of that a single

873
01:00:41.639 --> 01:00:45.920
<v Speaker 3>file from JS to TS, preserving its history. I added

874
01:00:46.000 --> 01:00:51.599
<v Speaker 3>the type information. I made sure that that it's a

875
01:00:51.639 --> 01:00:55.480
<v Speaker 3>file that's actually as I said. Then give the rules.

876
01:00:56.199 --> 01:00:58.280
<v Speaker 3>All file as small a file as I can find,

877
01:00:58.880 --> 01:01:01.800
<v Speaker 3>not dependent on any the other file within my own

878
01:01:02.280 --> 01:01:07.119
<v Speaker 3>within that particular project, but can be dependent on external things.

879
01:01:07.880 --> 01:01:10.440
<v Speaker 3>Is used by one of the unit tests again either

880
01:01:10.519 --> 01:01:15.960
<v Speaker 3>directly or indirectly, but small and simple, and is required

881
01:01:16.400 --> 01:01:19.079
<v Speaker 3>by somebody again by a by a unit test or

882
01:01:19.119 --> 01:01:24.760
<v Speaker 3>by and buy some code and and converted that. Added

883
01:01:24.800 --> 01:01:30.679
<v Speaker 3>the type information. UH, make it as simple as possible,

884
01:01:30.719 --> 01:01:36.760
<v Speaker 3>avoid changing execution logic, business logic. Just add the type information,

885
01:01:37.199 --> 01:01:42.440
<v Speaker 3>committed it, committed that change. UH, created a commit for

886
01:01:42.480 --> 01:01:48.199
<v Speaker 3>that change, updated the PR and saw that it still worked.

887
01:01:49.320 --> 01:01:52.079
<v Speaker 3>And happily you did so.

888
01:01:52.199 --> 01:01:56.280
<v Speaker 1>You mentioned you said when I UH mentioned about just

889
01:01:56.400 --> 01:02:01.039
<v Speaker 1>changing the file from JAS or even moving it from JST, that.

890
01:02:01.039 --> 01:02:01.880
<v Speaker 2>It would still fail.

891
01:02:02.000 --> 01:02:04.880
<v Speaker 1>So in a typescript file, just for clarity, is there

892
01:02:04.880 --> 01:02:06.599
<v Speaker 1>something else that you have to put in there that

893
01:02:06.599 --> 01:02:07.199
<v Speaker 1>says no, you.

894
01:02:07.159 --> 01:02:09.639
<v Speaker 3>Need to put it in the type information and unless

895
01:02:09.639 --> 01:02:11.960
<v Speaker 3>you make as I said, as I mentioned when I

896
01:02:12.000 --> 01:02:17.960
<v Speaker 3>created the TS CONFIGU Todd jason file. I set it

897
01:02:18.360 --> 01:02:23.639
<v Speaker 3>to strict type checking. I could have not put it

898
01:02:23.679 --> 01:02:27.000
<v Speaker 3>a strict type checking, and then I could have just

899
01:02:27.079 --> 01:02:31.719
<v Speaker 3>renamed that file. But I put it a strict which

900
01:02:31.760 --> 01:02:36.039
<v Speaker 3>means that it expects to see type information on things

901
01:02:36.079 --> 01:02:39.719
<v Speaker 3>like variables. Unless it can in further type information, it

902
01:02:39.840 --> 01:02:42.440
<v Speaker 3>needs you to give it the type information. So if

903
01:02:42.440 --> 01:02:46.159
<v Speaker 3>you do a const x equals three, it knows that

904
01:02:46.440 --> 01:02:50.039
<v Speaker 3>x is a number. But if it's just let x

905
01:02:50.079 --> 01:02:54.280
<v Speaker 3>without signing anything, it can't know the type of X,

906
01:02:54.599 --> 01:02:57.000
<v Speaker 3>So you need to be explicit about it. Likewise, if

907
01:02:57.000 --> 01:02:59.960
<v Speaker 3>you've got arguments, you need to tell it type of

908
01:03:00.039 --> 01:03:02.719
<v Speaker 3>the arguments. It can in further return value, but you

909
01:03:03.079 --> 01:03:05.679
<v Speaker 3>need to give it the types of the of the

910
01:03:05.719 --> 01:03:09.280
<v Speaker 3>function parameters or function argument. So when I renamed the

911
01:03:09.320 --> 01:03:12.440
<v Speaker 3>TF file from JS tots, I also needed to put

912
01:03:12.480 --> 01:03:16.079
<v Speaker 3>in the relevant type information. After all, that's the whole

913
01:03:16.119 --> 01:03:19.199
<v Speaker 3>point of moving from JS tots, and I wanted to

914
01:03:19.239 --> 01:03:22.159
<v Speaker 3>see it handle that type information. And as I said,

915
01:03:22.320 --> 01:03:26.159
<v Speaker 3>I moved just that one file. I pushed it in

916
01:03:26.840 --> 01:03:30.840
<v Speaker 3>and verified that everything that all the build works, that

917
01:03:30.920 --> 01:03:34.000
<v Speaker 3>the unit tests work, that the end to end test work,

918
01:03:34.199 --> 01:03:37.880
<v Speaker 3>that deployment is created, that I can actually use that

919
01:03:37.960 --> 01:03:42.639
<v Speaker 3>created deployment, and I even looked in the disk folder

920
01:03:43.039 --> 01:03:46.000
<v Speaker 3>to verify that the JS file was created for that

921
01:03:46.119 --> 01:03:49.320
<v Speaker 3>TS file, and then it contained what I expected it

922
01:03:49.400 --> 01:03:55.440
<v Speaker 3>to contain. So it was that that anal about it, really,

923
01:03:57.079 --> 01:04:01.239
<v Speaker 3>just because again it was that first file. After that

924
01:04:01.320 --> 01:04:05.199
<v Speaker 3>you can be more relaxed than your attitude. I then

925
01:04:05.400 --> 01:04:10.840
<v Speaker 3>intentionally introduced a typescript error into that file to see

926
01:04:10.960 --> 01:04:17.559
<v Speaker 3>that it failed. Because if you don't see that everything fails,

927
01:04:17.599 --> 01:04:19.679
<v Speaker 3>how do you know that it actually even working and

928
01:04:19.760 --> 01:04:23.719
<v Speaker 3>not just doing something stupid. So I put in intentionally

929
01:04:23.760 --> 01:04:27.320
<v Speaker 3>a typescript error. Shane, let's say something supposed to be

930
01:04:27.400 --> 01:04:30.239
<v Speaker 3>a string. I said that it's a number, and saw

931
01:04:30.440 --> 01:04:34.079
<v Speaker 3>that typescript you know, failed and the build failed, And

932
01:04:34.119 --> 01:04:36.320
<v Speaker 3>then I fixed it again and saw that the build

933
01:04:36.760 --> 01:04:42.119
<v Speaker 3>passed again, and I and I and as I said,

934
01:04:42.559 --> 01:04:47.000
<v Speaker 3>I pushed it into that branch and saw that the

935
01:04:47.000 --> 01:04:51.480
<v Speaker 3>CI process failed, passed, sorry, and everything was green. But

936
01:04:51.639 --> 01:04:59.159
<v Speaker 3>again I didn't merge it yet. Instead, I deployed it

937
01:04:59.559 --> 01:05:06.360
<v Speaker 3>to our testing environment, and I made sure that I

938
01:05:06.400 --> 01:05:12.920
<v Speaker 3>could properly debug it both using vis code and web Storm.

939
01:05:13.280 --> 01:05:17.400
<v Speaker 3>We've got a rather complex complicated for various technical reason

940
01:05:17.920 --> 01:05:24.239
<v Speaker 3>environment for debugging, which involves remote deployments and stuff like that.

941
01:05:24.639 --> 01:05:27.239
<v Speaker 3>It's not really important in the context of this discussion.

942
01:05:27.639 --> 01:05:30.559
<v Speaker 3>I won't go into the details. I then asked some

943
01:05:30.719 --> 01:05:34.079
<v Speaker 3>of my colleagues to test out that branch as well,

944
01:05:34.400 --> 01:05:37.320
<v Speaker 3>see that they're also able to use it and debug

945
01:05:37.400 --> 01:05:40.440
<v Speaker 3>it and that everything just works for them. Again, I

946
01:05:40.599 --> 01:05:44.119
<v Speaker 3>was very very careful about it. After I got the

947
01:05:44.280 --> 01:05:49.000
<v Speaker 3>okay from those colleagues, I rebased the branch, and because

948
01:05:49.039 --> 01:05:52.840
<v Speaker 3>we use rebase rather than merge, because it took me

949
01:05:52.880 --> 01:05:55.360
<v Speaker 3>a while, so obviously other changes were done in the

950
01:05:55.440 --> 01:05:59.960
<v Speaker 3>project during that time. So I rebased and finally merge

951
01:06:00.119 --> 01:06:06.320
<v Speaker 3>that pr and finally we had a version that supported

952
01:06:06.360 --> 01:06:11.239
<v Speaker 3>Typescript and had one and exactly one TS file in

953
01:06:11.280 --> 01:06:17.280
<v Speaker 3>that project out of those one thousand JavaScript files. And

954
01:06:17.440 --> 01:06:20.039
<v Speaker 3>I also made sure not to have to do that

955
01:06:21.039 --> 01:06:24.280
<v Speaker 3>right before the weekend, so that I don't break everything

956
01:06:24.400 --> 01:06:25.360
<v Speaker 3>just before the weekend.

957
01:06:26.039 --> 01:06:28.280
<v Speaker 1>Well that's the general rule anyway, right, you don't do

958
01:06:28.360 --> 01:06:29.840
<v Speaker 1>major deployments on Friday.

959
01:06:32.280 --> 01:06:36.679
<v Speaker 3>After merge, I verified that the main branch again was

960
01:06:36.719 --> 01:06:39.800
<v Speaker 3>also built correctly, that all the end to end test paths,

961
01:06:39.880 --> 01:06:43.840
<v Speaker 3>that everything worked correctly, I was ready to roll back otherwise.

962
01:06:44.079 --> 01:06:48.840
<v Speaker 3>Fortunately I did not have to. I then basically informed

963
01:06:48.920 --> 01:06:53.800
<v Speaker 3>everybody else about this change, and we started discussing about

964
01:06:53.840 --> 01:06:58.480
<v Speaker 3>how we can gradually move from JS to TS. And

965
01:06:58.719 --> 01:07:02.400
<v Speaker 3>we've been doing it very slowly since then, and that

966
01:07:03.039 --> 01:07:07.360
<v Speaker 3>more or less concludes where we are now. And it was,

967
01:07:07.679 --> 01:07:12.039
<v Speaker 3>as I said, it was a lot less trivial than

968
01:07:12.079 --> 01:07:15.280
<v Speaker 3>I expected it to be. Now some of the issues

969
01:07:15.320 --> 01:07:20.079
<v Speaker 3>had to do with our own unique environment. But still

970
01:07:20.559 --> 01:07:23.599
<v Speaker 3>now I have heard other suggestions about how to go

971
01:07:23.719 --> 01:07:28.920
<v Speaker 3>about it. For example, convert your repo into a mono

972
01:07:28.960 --> 01:07:34.079
<v Speaker 3>repo type environment, start pulling out self contained files as

973
01:07:34.119 --> 01:07:38.280
<v Speaker 3>separate packages within that mono repo, and since there are

974
01:07:38.320 --> 01:07:41.480
<v Speaker 3>new packages, just make them TS from the get go.

975
01:07:42.599 --> 01:07:45.360
<v Speaker 3>You can do that. You still need to be very

976
01:07:45.400 --> 01:07:48.440
<v Speaker 3>careful about how you preserve history and stuff like that.

977
01:07:48.599 --> 01:07:52.280
<v Speaker 3>It's not trivial, but that's not what I did in

978
01:07:52.320 --> 01:07:55.599
<v Speaker 3>this project. Anyway, I might actually have to do that

979
01:07:55.719 --> 01:07:59.360
<v Speaker 3>other way in that project with JavaScript and flow, because

980
01:07:59.400 --> 01:08:01.840
<v Speaker 3>I don't take I can get both JavaScript and flow

981
01:08:01.920 --> 01:08:07.400
<v Speaker 3>to work within the same package. Anyway, I'm done.

982
01:08:08.719 --> 01:08:10.800
<v Speaker 1>So, how many files have you actually now that all

983
01:08:10.800 --> 01:08:13.639
<v Speaker 1>that's in place, how many files that you actually.

984
01:08:13.320 --> 01:08:17.520
<v Speaker 3>Converted not so many so far, approximately ten out of

985
01:08:17.560 --> 01:08:20.800
<v Speaker 3>the one thousand. This will take time. The biggest problem

986
01:08:21.039 --> 01:08:28.840
<v Speaker 3>in converting files is that, well, you know, sometimes you

987
01:08:28.960 --> 01:08:33.760
<v Speaker 3>run into complicated types that require generics and stuff like that,

988
01:08:34.319 --> 01:08:36.560
<v Speaker 3>and you need to get the team up to speed

989
01:08:36.960 --> 01:08:39.960
<v Speaker 3>about typescript because a lot of them have been basically

990
01:08:40.000 --> 01:08:43.760
<v Speaker 3>just using javascripts, so they're not as familiar with typescript

991
01:08:43.800 --> 01:08:47.119
<v Speaker 3>as ideally they should be, and you need to allocate

992
01:08:47.199 --> 01:08:51.399
<v Speaker 3>time for that as well. But the bigger issue is

993
01:08:51.479 --> 01:08:56.680
<v Speaker 3>that the move to typescript has actually uncovered various bugs

994
01:08:56.760 --> 01:09:05.079
<v Speaker 3>in the code, places where null tests were missing. So

995
01:09:05.199 --> 01:09:08.520
<v Speaker 3>one of the great things about typescript is the typeescript

996
01:09:09.239 --> 01:09:16.119
<v Speaker 3>basically having is explicit about something being that can be null.

997
01:09:16.600 --> 01:09:20.359
<v Speaker 3>So it's something is can be either if something is,

998
01:09:20.399 --> 01:09:23.800
<v Speaker 3>then if a variable is of type number, it cannot

999
01:09:23.800 --> 01:09:28.399
<v Speaker 3>be null. It you basically, if you wanted to also

1000
01:09:28.479 --> 01:09:31.319
<v Speaker 3>be null, you need to explicit be explicit about and

1001
01:09:31.359 --> 01:09:37.159
<v Speaker 3>say number or null. And it uncovered a lot of

1002
01:09:37.239 --> 01:09:43.079
<v Speaker 3>places in the code that null tests were not properly

1003
01:09:43.119 --> 01:09:48.079
<v Speaker 3>put in place, or places where library third party libraries

1004
01:09:48.079 --> 01:09:51.880
<v Speaker 3>were used and a version was updated that changed the API,

1005
01:09:52.079 --> 01:09:55.800
<v Speaker 3>but the way in which that library was used, wasn't updated,

1006
01:09:56.680 --> 01:10:01.439
<v Speaker 3>and the wrong parameters were actually passed into certain APIs.

1007
01:10:01.720 --> 01:10:06.760
<v Speaker 3>Now somehow it worked, but now Typescript complains about it.

1008
01:10:06.800 --> 01:10:09.119
<v Speaker 3>Then you have to fix it, and you have to

1009
01:10:09.159 --> 01:10:11.319
<v Speaker 3>think about, you know, how do I fix it? It

1010
01:10:11.399 --> 01:10:16.239
<v Speaker 3>actually requires changing the actual execution code in order to

1011
01:10:16.279 --> 01:10:19.319
<v Speaker 3>get Typescript to be happy about it. If you're passing

1012
01:10:19.680 --> 01:10:22.640
<v Speaker 3>something which is a number into something that should be

1013
01:10:22.720 --> 01:10:27.560
<v Speaker 3>a string and it happens to work, you know, you

1014
01:10:27.640 --> 01:10:29.960
<v Speaker 3>don't just want to cast a number a string. You

1015
01:10:30.640 --> 01:10:32.640
<v Speaker 3>want to fix it. You want it to work properly.

1016
01:10:33.199 --> 01:10:37.960
<v Speaker 3>So the biggest time consumer really so far has been

1017
01:10:38.279 --> 01:10:41.359
<v Speaker 3>basically fixing bugs that Typescript uncovers.

1018
01:10:42.000 --> 01:10:44.000
<v Speaker 1>Yeah, I've been so I do a lot of work

1019
01:10:44.119 --> 01:10:46.000
<v Speaker 1>leral on PHP in my day to day, and so

1020
01:10:46.119 --> 01:10:49.239
<v Speaker 1>the past couple of weeks I've been working with PHP STAN,

1021
01:10:49.439 --> 01:10:53.399
<v Speaker 1>which is a PHP static analysis tool, hence the name STAN.

1022
01:10:54.640 --> 01:10:56.560
<v Speaker 2>And STAN. I definitely have a love a lot of

1023
01:10:56.640 --> 01:10:58.960
<v Speaker 2>hate relationship with it. Well.

1024
01:10:59.000 --> 01:11:01.039
<v Speaker 1>A couple of things that I found out is one

1025
01:11:02.880 --> 01:11:05.479
<v Speaker 1>cases you're correct, it does the similar thing where you

1026
01:11:05.520 --> 01:11:07.560
<v Speaker 1>have to declare okay, it can be the this or no.

1027
01:11:09.079 --> 01:11:11.439
<v Speaker 1>You know, I have to clear the options well, a

1028
01:11:11.439 --> 01:11:14.640
<v Speaker 1>lot of times, what I find myself having to do,

1029
01:11:14.760 --> 01:11:16.560
<v Speaker 1>and I'm curious to see if you've run into this

1030
01:11:16.600 --> 01:11:24.520
<v Speaker 1>as well, is having to restructure working code for the tool.

1031
01:11:24.680 --> 01:11:27.840
<v Speaker 1>So in other words, if if you have a step

1032
01:11:27.880 --> 01:11:30.479
<v Speaker 1>that has that you know, does some chaining and does

1033
01:11:30.600 --> 01:11:32.600
<v Speaker 1>multiple things, sometimes you have to break that apart so

1034
01:11:32.720 --> 01:11:35.520
<v Speaker 1>the static analysis tool can realize, okay, this variable is

1035
01:11:35.560 --> 01:11:38.079
<v Speaker 1>of this class and then you can go on into

1036
01:11:38.119 --> 01:11:41.560
<v Speaker 1>it where it works fine, you know with with when

1037
01:11:41.600 --> 01:11:44.319
<v Speaker 1>things are chained together, but you have to break things

1038
01:11:44.359 --> 01:11:48.239
<v Speaker 1>apart strictly for the static analysis tool. That was probably

1039
01:11:48.279 --> 01:11:51.560
<v Speaker 1>one of the bigger frustrations that I've you know, in

1040
01:11:51.680 --> 01:11:53.680
<v Speaker 1>dealing with that, that I've had to fight.

1041
01:11:54.960 --> 01:11:59.079
<v Speaker 3>Look you can, yeah, but I'm thinking about how to

1042
01:11:59.119 --> 01:12:03.479
<v Speaker 3>phrase it. First of all, I'm not familiar with PHP

1043
01:12:03.640 --> 01:12:07.960
<v Speaker 3>stand but I can say that typescript is amazing in

1044
01:12:07.960 --> 01:12:11.760
<v Speaker 3>the in the sophistication of the static analysis that it

1045
01:12:11.800 --> 01:12:16.760
<v Speaker 3>can perform. So, for example, if something is if a variable,

1046
01:12:16.800 --> 01:12:20.560
<v Speaker 3>as I said, is number or null, and then you

1047
01:12:20.600 --> 01:12:23.000
<v Speaker 3>do an if in the code and check that it's

1048
01:12:23.279 --> 01:12:27.199
<v Speaker 3>not null, then it knows that within the scope of

1049
01:12:27.199 --> 01:12:30.600
<v Speaker 3>that if the type of that variable is now assumed

1050
01:12:30.600 --> 01:12:33.039
<v Speaker 3>to be number and not number or null. It's really

1051
01:12:33.199 --> 01:12:37.960
<v Speaker 3>smart about how to infer the correct type. So the

1052
01:12:38.079 --> 01:12:44.199
<v Speaker 3>value that the type of of of a variable actually

1053
01:12:44.359 --> 01:12:49.039
<v Speaker 3>changes according to the code because of various type checks

1054
01:12:49.039 --> 01:12:51.359
<v Speaker 3>that can exist in the in the runtime code. These

1055
01:12:51.359 --> 01:12:55.199
<v Speaker 3>are known as type guards. We actually talked about in

1056
01:12:55.239 --> 01:12:58.000
<v Speaker 3>the in the recent episode that we did with the

1057
01:12:58.960 --> 01:13:04.119
<v Speaker 3>Lyran and Ariel. You were in that episode, I believe, right, yes, yeah,

1058
01:13:04.119 --> 01:13:06.720
<v Speaker 3>so we actually talked about that. So Typescript is amazingly

1059
01:13:06.760 --> 01:13:10.600
<v Speaker 3>sophisticated about such things. The fact that you need to

1060
01:13:10.640 --> 01:13:14.680
<v Speaker 3>break the code into smaller pieces. From my perspective, that's

1061
01:13:14.720 --> 01:13:18.920
<v Speaker 3>actually a benefit. I like my code broken down in

1062
01:13:18.960 --> 01:13:20.960
<v Speaker 3>smaller pieces.

1063
01:13:21.720 --> 01:13:23.239
<v Speaker 1>Right, and I tend to be that way too. You

1064
01:13:23.239 --> 01:13:25.680
<v Speaker 1>don't want to, you know, have fifteen chain functions on there,

1065
01:13:25.840 --> 01:13:27.680
<v Speaker 1>just for the sake of having shorter code. If a

1066
01:13:27.680 --> 01:13:30.640
<v Speaker 1>little more broken up code is easier to read. But

1067
01:13:30.880 --> 01:13:32.880
<v Speaker 1>when it's already working, you got to break it up

1068
01:13:32.880 --> 01:13:34.439
<v Speaker 1>just for the tool, it can be frustrating.

1069
01:13:35.199 --> 01:13:37.399
<v Speaker 3>I agree with that, and that exactly goes to the

1070
01:13:37.439 --> 01:13:40.439
<v Speaker 3>point that I mentioned that the biggest challenge so far

1071
01:13:41.079 --> 01:13:44.840
<v Speaker 3>has been those situations in which we actually had to

1072
01:13:45.039 --> 01:13:49.960
<v Speaker 3>change the JavaScript in order for Typescript to be happy

1073
01:13:49.960 --> 01:13:53.439
<v Speaker 3>about it, and in most cases the change was for

1074
01:13:53.479 --> 01:13:58.239
<v Speaker 3>the better. It was a good change, but it's still work.

1075
01:13:58.840 --> 01:14:03.399
<v Speaker 3>And once you know ideally, you're thinking, I'm just adding types,

1076
01:14:03.880 --> 01:14:07.199
<v Speaker 3>so all the tests should pass because the types are

1077
01:14:07.439 --> 01:14:11.119
<v Speaker 3>removed from the generated code anyway, so they don't impact

1078
01:14:11.119 --> 01:14:15.560
<v Speaker 3>the tests. But once you have to start modifying the code,

1079
01:14:15.920 --> 01:14:18.680
<v Speaker 3>you also start breaking tests, which is another reason why

1080
01:14:18.720 --> 01:14:24.039
<v Speaker 3>you should have good test coverage when starting projects like that.

1081
01:14:24.840 --> 01:14:27.000
<v Speaker 2>Right, sure, Okay, I think.

1082
01:14:26.800 --> 01:14:28.479
<v Speaker 3>We're more or less run out of time.

1083
01:14:28.399 --> 01:14:32.079
<v Speaker 2>Yes, I believe so. Quick question.

1084
01:14:32.199 --> 01:14:35.359
<v Speaker 1>You had mentioned at the beginning that you had documented

1085
01:14:35.359 --> 01:14:39.359
<v Speaker 1>this on your internal wiki, and we've got this episode obviously,

1086
01:14:39.399 --> 01:14:40.760
<v Speaker 1>but are you going to put this out in written

1087
01:14:40.800 --> 01:14:43.319
<v Speaker 1>format publicly, like a blog post or something.

1088
01:14:44.079 --> 01:14:45.039
<v Speaker 3>I probably should.

1089
01:14:46.479 --> 01:14:48.279
<v Speaker 2>I seem like some pretty valuable information.

1090
01:14:48.920 --> 01:14:52.960
<v Speaker 3>I think so too. As I said, maybe it exists somewhere,

1091
01:14:52.960 --> 01:14:57.560
<v Speaker 3>but I just couldn't find it, but it probably is.

1092
01:14:58.079 --> 01:15:00.279
<v Speaker 3>Probably should. The only problem is that I I don't

1093
01:15:00.319 --> 01:15:04.159
<v Speaker 3>really have a blog anymore, so I need to figure

1094
01:15:04.159 --> 01:15:07.000
<v Speaker 3>out about where to actually put it. I'm also, as

1095
01:15:07.039 --> 01:15:09.880
<v Speaker 3>I mentioned, I think I may want to submit it

1096
01:15:09.920 --> 01:15:13.119
<v Speaker 3>as a conference talk, not that you know it prevents

1097
01:15:13.560 --> 01:15:15.319
<v Speaker 3>I can do all three. You know, we now have

1098
01:15:15.359 --> 01:15:17.239
<v Speaker 3>a podcast. I can have it as a blog and

1099
01:15:17.319 --> 01:15:20.479
<v Speaker 3>as a proposed conference talk. I just need to figure

1100
01:15:20.520 --> 01:15:25.520
<v Speaker 3>out where to put that blog post. Probably should You're.

1101
01:15:25.439 --> 01:15:28.800
<v Speaker 2>Right, all righty, So that will move on to picks.

1102
01:15:29.039 --> 01:15:31.199
<v Speaker 1>Picks are the part of the show where we can

1103
01:15:31.239 --> 01:15:33.960
<v Speaker 1>talk about anything else, or we can talk about tech

1104
01:15:34.000 --> 01:15:38.239
<v Speaker 1>if we want. I'll give Dan throw to break since

1105
01:15:38.279 --> 01:15:41.000
<v Speaker 1>he's been doing most of the talking here, and do

1106
01:15:41.199 --> 01:15:45.279
<v Speaker 1>my dad jokes of the week. Maybe we'll get a

1107
01:15:45.319 --> 01:15:48.439
<v Speaker 1>laugh from Damn. Maybe not so recently. You know, I

1108
01:15:48.479 --> 01:15:51.399
<v Speaker 1>had to change a password, and I normally use a

1109
01:15:51.399 --> 01:15:56.680
<v Speaker 1>password manager, but this particular time, we'll say this was

1110
01:15:56.720 --> 01:15:59.279
<v Speaker 1>back before password managers. I need a password that had

1111
01:15:59.319 --> 01:16:01.520
<v Speaker 1>eight characters, so I did snow White and the Seven

1112
01:16:01.600 --> 01:16:08.680
<v Speaker 1>Dwarfs because seven plus one is eight. So I've got

1113
01:16:08.720 --> 01:16:13.880
<v Speaker 1>three kids, and when our last one was born, my

1114
01:16:13.920 --> 01:16:16.000
<v Speaker 1>wife was in labor and I tried to tell her

1115
01:16:16.079 --> 01:16:18.359
<v Speaker 1>jokes to distract her from the pain, but she didn't

1116
01:16:18.399 --> 01:16:23.279
<v Speaker 1>last at all. It must have been the delivery, right man. Yeah,

1117
01:16:23.439 --> 01:16:25.640
<v Speaker 1>this is this is a recent one. I love it

1118
01:16:25.840 --> 01:16:28.279
<v Speaker 1>because it's somebody pointed out to me on Twitter it's

1119
01:16:28.279 --> 01:16:31.279
<v Speaker 1>both funny and inspirational. Says when you think that all

1120
01:16:31.399 --> 01:16:35.119
<v Speaker 1>is lost, there's no hope left. Just remember the lobsters

1121
01:16:35.119 --> 01:16:37.159
<v Speaker 1>in the tank in the Titanic's restaurant.

1122
01:16:37.239 --> 01:16:39.199
<v Speaker 3>Oh that's that's a good point.

1123
01:16:39.439 --> 01:16:42.239
<v Speaker 2>I'm free, I'm free. Anyway, Those are the dad jokes

1124
01:16:42.239 --> 01:16:44.600
<v Speaker 2>of the week. Dan, you got any picks for us?

1125
01:16:45.000 --> 01:16:50.479
<v Speaker 3>Yeah, not that many, but a few. So one pick

1126
01:16:50.560 --> 01:16:54.000
<v Speaker 3>I have is a friend of mine here in Israel

1127
01:16:54.119 --> 01:16:58.119
<v Speaker 3>called the lead Josef great confidence speaker by the way,

1128
01:16:59.680 --> 01:17:06.279
<v Speaker 3>So he created a very interesting project. There's he actually

1129
01:17:06.319 --> 01:17:08.680
<v Speaker 3>put on X the whole story, a thread about the

1130
01:17:08.680 --> 01:17:11.119
<v Speaker 3>whole story about how they built this thing. It's an

1131
01:17:11.159 --> 01:17:15.800
<v Speaker 3>incredible read. Unfortunately it's an Hebrew I know that it

1132
01:17:15.840 --> 01:17:19.479
<v Speaker 3>has a built in transition capability, but still but anyway,

1133
01:17:20.039 --> 01:17:27.039
<v Speaker 3>this this really interesting thing is called get mcph. I

1134
01:17:27.119 --> 01:17:30.840
<v Speaker 3>spoke about MCP with Jack Hankton when we had him

1135
01:17:30.880 --> 01:17:34.159
<v Speaker 3>as a guest on the show. MCP I forget what

1136
01:17:34.199 --> 01:17:38.199
<v Speaker 3>it's what it stands for, but it's basically a standard

1137
01:17:38.199 --> 01:17:48.199
<v Speaker 3>protocol for connecting stuff to llms. So the llms can

1138
01:17:48.239 --> 01:17:52.640
<v Speaker 3>actually use that protocol to get additional context, additional information,

1139
01:17:53.319 --> 01:17:59.560
<v Speaker 3>or to control various external resources. So they created something

1140
01:17:59.640 --> 01:18:05.560
<v Speaker 3>called get MCP, which basically makes it possible to instantly

1141
01:18:05.680 --> 01:18:10.760
<v Speaker 3>create an MCP server from any getub project and then

1142
01:18:10.800 --> 01:18:14.039
<v Speaker 3>you can hand it over to something like Cursor and

1143
01:18:14.119 --> 01:18:19.640
<v Speaker 3>immediately Cursor has context based on that getub project, which

1144
01:18:20.520 --> 01:18:23.800
<v Speaker 3>is really interesting. So if you want to learn about

1145
01:18:23.840 --> 01:18:27.560
<v Speaker 3>some getub you know, you can obviously clone a getub

1146
01:18:27.640 --> 01:18:32.359
<v Speaker 3>project and open it within you within Cursor and then

1147
01:18:32.399 --> 01:18:36.159
<v Speaker 3>you get context. But suppose you want to you're working

1148
01:18:36.199 --> 01:18:40.920
<v Speaker 3>on your own project that uses some other project APIs

1149
01:18:41.000 --> 01:18:44.039
<v Speaker 3>from some other project, and you want Cursor to be

1150
01:18:44.119 --> 01:18:48.920
<v Speaker 3>able to help you generate code for using those APIs. Well,

1151
01:18:49.000 --> 01:18:53.760
<v Speaker 3>with get MCP you can just point. It's literally just

1152
01:18:53.840 --> 01:18:59.399
<v Speaker 3>replacing the word GitHub in the URL with geitub dot

1153
01:18:59.439 --> 01:19:04.199
<v Speaker 3>com with get mcp dot io. That's literally it. That

1154
01:19:04.520 --> 01:19:07.960
<v Speaker 3>URL will immediately work. You just hand over that URL

1155
01:19:08.119 --> 01:19:13.119
<v Speaker 3>to Cursor, for example, and then and instantly Cursor has

1156
01:19:13.239 --> 01:19:17.960
<v Speaker 3>context about that project. It seems like magic to me.

1157
01:19:18.079 --> 01:19:21.760
<v Speaker 3>I've not tried it myself yet, but it literally seems

1158
01:19:21.760 --> 01:19:24.279
<v Speaker 3>like magic. Some of the videos that they have on

1159
01:19:24.319 --> 01:19:28.319
<v Speaker 3>their website literally seem like magic. It's it's pretty amazing

1160
01:19:28.359 --> 01:19:30.600
<v Speaker 3>the stuff that you can do. These days with these tools.

1161
01:19:31.039 --> 01:19:33.800
<v Speaker 1>So MCP stands for you mentioned the CEE. It's a

1162
01:19:33.920 --> 01:19:35.880
<v Speaker 1>model context protocol.

1163
01:19:35.960 --> 01:19:43.039
<v Speaker 3>Right, it's a this protocol proposal that's supposed to be

1164
01:19:43.319 --> 01:19:48.000
<v Speaker 3>a new standard for connecting llms to stuff, and uh,

1165
01:19:48.920 --> 01:19:52.760
<v Speaker 3>it's pretty amazing what they've achieved. So it works with Claude,

1166
01:19:52.800 --> 01:19:55.960
<v Speaker 3>it works with Cursor, it works with Windsurf, it works

1167
01:19:55.960 --> 01:19:58.880
<v Speaker 3>with vis code. As I said, I've not tried it yet.

1168
01:19:58.880 --> 01:20:02.279
<v Speaker 3>I've only learned about it effectively yesterday and I haven't

1169
01:20:02.319 --> 01:20:04.840
<v Speaker 3>had a chance to play with it, but it seems

1170
01:20:04.840 --> 01:20:07.600
<v Speaker 3>pretty amazing the fact that you can literally just by

1171
01:20:07.760 --> 01:20:12.359
<v Speaker 3>changing replacing the word in the URL from getub to

1172
01:20:12.479 --> 01:20:16.520
<v Speaker 3>get MCP and immediately get it to work, it's just

1173
01:20:16.600 --> 01:20:24.960
<v Speaker 3>amazing to me. And the other pick is I think

1174
01:20:25.000 --> 01:20:29.760
<v Speaker 3>I mentioned that I'm speaking at a conference in Romania

1175
01:20:30.560 --> 01:20:35.079
<v Speaker 3>towards the end of May. It's called JS Heroes. I'll

1176
01:20:35.119 --> 01:20:41.279
<v Speaker 3>be talking about how modern web frameworks use or prefer

1177
01:20:41.479 --> 01:20:46.760
<v Speaker 3>using RPC as the communication protocol between the front end

1178
01:20:46.800 --> 01:20:49.800
<v Speaker 3>and their back ends. If you're thinking about frameworks like

1179
01:20:51.359 --> 01:20:58.319
<v Speaker 3>next JS or like quick or like solid, they're all

1180
01:20:58.600 --> 01:21:02.560
<v Speaker 3>or ten stack. They're they're kind of moving over to

1181
01:21:02.680 --> 01:21:07.680
<v Speaker 3>using our PC, So I'm talking about what RPC is

1182
01:21:07.960 --> 01:21:10.800
<v Speaker 3>and why they're doing it, and what are the implications,

1183
01:21:10.920 --> 01:21:14.800
<v Speaker 3>the good sides the bad sides of this transition. And

1184
01:21:15.720 --> 01:21:17.960
<v Speaker 3>the thing is that, first of all, I have to

1185
01:21:18.000 --> 01:21:23.039
<v Speaker 3>say that Jas Heroes Conference, the agenda looks amazing, The

1186
01:21:23.079 --> 01:21:27.359
<v Speaker 3>speaker lineup is really awesome. The interesting thing, though, is

1187
01:21:27.479 --> 01:21:30.640
<v Speaker 3>one of the organizers is Tagus. We've had Tags on

1188
01:21:30.680 --> 01:21:34.039
<v Speaker 3>their show a few times. Tags is an amazing person,

1189
01:21:35.560 --> 01:21:43.039
<v Speaker 3>and he kind of tweeted recently that a lot of

1190
01:21:43.239 --> 01:21:47.239
<v Speaker 3>conferences have effectively disappeared in the past year or two,

1191
01:21:47.600 --> 01:21:51.439
<v Speaker 3>that there are very few conferences actually still running. And

1192
01:21:51.520 --> 01:21:55.199
<v Speaker 3>now he should know because he's very involved in the

1193
01:21:55.439 --> 01:21:59.199
<v Speaker 3>in the conference scene. He does like thirty conference talks

1194
01:21:59.239 --> 01:22:03.079
<v Speaker 3>a year or maybe even more. He's really into it.

1195
01:22:03.119 --> 01:22:05.600
<v Speaker 3>So if he's saying that a lot of conferences are

1196
01:22:05.640 --> 01:22:09.520
<v Speaker 3>shutting down, I trust him about it, and it sounds

1197
01:22:09.600 --> 01:22:14.800
<v Speaker 3>really unfortunate to me. My information myself is anecdotal. I'm

1198
01:22:14.840 --> 01:22:18.000
<v Speaker 3>looking at services like sessionize, and it does seem to

1199
01:22:18.000 --> 01:22:21.039
<v Speaker 3>be the case that there are a lot fewer conferences

1200
01:22:21.119 --> 01:22:26.079
<v Speaker 3>out there. That's really unfortunate, and it seems to me

1201
01:22:26.159 --> 01:22:28.880
<v Speaker 3>that we should be supporting the conferences that are still

1202
01:22:28.920 --> 01:22:34.079
<v Speaker 3>running by participating by buying tickets, and attending by sponsoring.

1203
01:22:34.600 --> 01:22:37.880
<v Speaker 3>So if you can help a conference organizer keep the

1204
01:22:37.880 --> 01:22:43.000
<v Speaker 3>conference up and running, please do my last pick since

1205
01:22:43.079 --> 01:22:48.840
<v Speaker 3>I mentioned Tagous, Tajos has his own podcast these days.

1206
01:22:48.840 --> 01:22:52.319
<v Speaker 3>It's called Contagious Code, which is a nice play on words.

1207
01:22:52.399 --> 01:22:54.520
<v Speaker 2>I was going to say, yeah, that's a good name

1208
01:22:54.600 --> 01:22:55.039
<v Speaker 2>right there.

1209
01:22:55.439 --> 01:23:01.199
<v Speaker 3>And he recently posted a new episode which is really interesting.

1210
01:23:01.279 --> 01:23:08.319
<v Speaker 3>Usually most of his episodes are about he interviews people

1211
01:23:08.680 --> 01:23:10.720
<v Speaker 3>you know in a same similar vein to the way

1212
01:23:10.720 --> 01:23:16.319
<v Speaker 3>that we do. And and you know, even though we

1213
01:23:16.359 --> 01:23:18.479
<v Speaker 3>have a podcast, he has a podcast. I have no

1214
01:23:18.600 --> 01:23:22.159
<v Speaker 3>problems saying that his podcast is awesome. I highly recommend

1215
01:23:22.199 --> 01:23:24.800
<v Speaker 3>listening to it. In fact, I was a guest on

1216
01:23:24.840 --> 01:23:27.600
<v Speaker 3>his podcast a while back. But the reason that I'm

1217
01:23:27.640 --> 01:23:32.039
<v Speaker 3>mentioning it is that his latest episode, that he basically

1218
01:23:32.039 --> 01:23:36.079
<v Speaker 3>put out a week ago, is not an interview. Rather,

1219
01:23:36.279 --> 01:23:40.239
<v Speaker 3>it stages himself speaking for one and a half hours

1220
01:23:40.640 --> 01:23:46.560
<v Speaker 3>about the state of AI in twenty twenty five. He also,

1221
01:23:46.640 --> 01:23:50.199
<v Speaker 3>you know we mentioned MCP. He talks about MCP in detail.

1222
01:23:50.279 --> 01:23:55.359
<v Speaker 3>He talks about agents, he talks about RAG and much more.

1223
01:23:56.039 --> 01:24:01.159
<v Speaker 3>And I'm about halfway in. It's excellent. I highly recommend

1224
01:24:01.199 --> 01:24:03.960
<v Speaker 3>listening to that episode. I hope we can get them

1225
01:24:03.960 --> 01:24:07.800
<v Speaker 3>on our show as well, but regardless, I recommend listening

1226
01:24:07.880 --> 01:24:10.359
<v Speaker 3>to that episode to get really up to speed about

1227
01:24:10.399 --> 01:24:14.319
<v Speaker 3>the technicalities of AI in twenty twenty five. And those

1228
01:24:14.399 --> 01:24:15.920
<v Speaker 3>will be my picks for today, all.

1229
01:24:15.880 --> 01:24:19.079
<v Speaker 2>Right, So with that we will wrap things up.

1230
01:24:19.880 --> 01:24:23.720
<v Speaker 1>Hopefully this provided good information from you that for you

1231
01:24:23.880 --> 01:24:27.079
<v Speaker 1>that are going to be converting code basis to typescript

1232
01:24:27.800 --> 01:24:32.079
<v Speaker 1>and Dan, I can people follow you on Twitter if

1233
01:24:32.079 --> 01:24:34.239
<v Speaker 1>they want to get info or do your Twitter or

1234
01:24:34.239 --> 01:24:36.600
<v Speaker 1>where can they find out if you publish this written

1235
01:24:36.760 --> 01:24:37.479
<v Speaker 1>form somewhere?

1236
01:24:37.520 --> 01:24:40.560
<v Speaker 3>Well if if and when I do, I'll obviously announce

1237
01:24:40.600 --> 01:24:45.359
<v Speaker 3>it on X, so yeah they can, and if they,

1238
01:24:45.600 --> 01:24:48.520
<v Speaker 3>if they're on X, please do follow me. I'm Dan Shapier.

1239
01:24:49.159 --> 01:24:51.319
<v Speaker 3>That's d A N S H A P P I

1240
01:24:51.479 --> 01:24:57.840
<v Speaker 3>R on X. I'm also on Blue Sky if you

1241
01:24:57.920 --> 01:25:01.560
<v Speaker 3>prefer that platform instead, so I'm there as well. On

1242
01:25:01.720 --> 01:25:07.640
<v Speaker 3>Blue Sky, I'm also Dan Shapiir, so find me there

1243
01:25:07.640 --> 01:25:11.399
<v Speaker 3>as well. Follow me here or there or anywhere. I'll

1244
01:25:11.479 --> 01:25:16.640
<v Speaker 3>gladly follow you back. Also glad to get feedback about

1245
01:25:16.640 --> 01:25:19.720
<v Speaker 3>our podcast in general, So feel free to contact me

1246
01:25:20.640 --> 01:25:21.319
<v Speaker 3>and that's.

1247
01:25:21.119 --> 01:25:23.800
<v Speaker 1>It, alrighty, And if you want to get a dad

1248
01:25:23.920 --> 01:25:27.520
<v Speaker 1>joke today, if you're amazed the quality of my curated

1249
01:25:27.560 --> 01:25:30.079
<v Speaker 1>dad jokes, you can follow me on x slash Twitter

1250
01:25:30.119 --> 01:25:33.079
<v Speaker 1>at Wonder nine to five. All right, with that, we

1251
01:25:33.159 --> 01:25:35.720
<v Speaker 1>will wrap this poppy up, thanks for listening, and we'll

1252
01:25:35.760 --> 01:25:36.720
<v Speaker 1>talk it to you next time.

1253
01:25:37.720 --> 01:25:40.079
<v Speaker 3>Bye,
