1
0 Comments

Integrated Typescript into code base

I had been struggling with creating schemas for objects and aligning those objects with the Firebase Firestore fields. Typescript had been on my radar for some time, but I hadn't worked with it before.

I come from a C# background where OOP is king. Moving into Javascript, I wanted to fully embrace the Prototypical Inheritance model rather than using the syntactic sugar of classes. My solution was to use Typescript as a way to simply ensure that customs objects and functions were passed the correct data.

Typescript was really easy to integrate into the project. Vue 3.x is written fully in Typescript so it has excellent support. All I had to do was run vue add typescript and the rest was straightforward. Obviously I had to learn some of the special keywords that Typescript has, but I am quite familiar with the pattern of using Interfaces.

Now my code base is much more scalable and I won't be worrying that I passed the wrong data type into a function. Just like with Javascript, there are good parts and bad parts. The key is to learn the differences and keep moving forward.

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 47 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 27 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments