As someone who worked pretty exclusively with Python and Java, joining a new client’s team and learning TypeScript was quite the experience. I first learned Java and then Python, so I had encountered going from a typed language to a non-typed language. I’ve since gone through that cycle a few times! However, starting at ground zero and learning a typed language can make you feel like you’re losing your marbles. I learned a lot along the way, so here’s what to know when adjusting back to typed languages:
Start with a short tutorial
In the beginning, it’s important to find a learning resource to reacclimate yourself with the content. Find a short course or video tutorial — something easy to commit to, around four hours or less. Shorter, digestible content with good ratings is the way to go. I didn’t follow my advice and started a 20-hour TypeScript course, which I do not recommend. I wanted coursework that included web apps, common libraries, and testing.
I found Execute Program courses on TypeScript, and that was much better. Every day I did a small course section because Execute Program only lets you do a certain number of lessons per day. If you do too many, nothing will stick! Each one takes about five minutes, and every few lessons, there’s a little quiz to test your knowledge. I like this because the concepts are bite-sized and are reinforced as you move through the quizzes.
Also! If you’re learning TypeScript for the first time, I highly recommend learning Async/Await because you’re going into a node environment. In my experience with Python and Java, I was exposed to very little Async code. There are tons of helpful videos about Async/Await you can watch to get familiar with it!
Write out the steps of the task
Switching from one language to another, there’s always that moment of “I know what I want to do!”…but the syntax or language features get in the way of you accomplishing what you wanted. Doing courses is crucial, but I’ve found that writing out the steps of the task is just as important. Still being relatively new to TypeScript, I find myself doing this a lot. When I have a problem, I’ve realized that breaking it down into small steps is most helpful.
Utilize IntelliSense (make it your friend)
Another difficult thing about adjusting back to typed languages is applying the same knowledge from a standard library function you’re familiar with to another language (like Python) and finding a similar standard library function in the new language. For example, to get the size of a list, in Python you use len() while in TypeScript you use .length().
It’s times like this where it’s best to have a tool to help you. VSCode IntelliSense can show the types and properties of the objects you’re working with inline. It’s like a little copilot for your code! It’s helpful to have an integrated development environment (IDE) that can tell you what types you’re working with even if it isn’t explicitly set in the code. This way, you can complete tasks (like getting the size of a list!) with fewer obstacles.
Pairing is super helpful
Having someone that’s more well-versed in the typed language you’re looking to learn is super helpful. You can pseudocode what you are comfortable with by pulling from other experiences and asking if that translates into the new language. For instance, “I would do it this way in Python, how do you do that in TypeScript?” When pairing, don’t be afraid to slow down, ask questions, and take notes — it’ll help things stick!
Get your feet wet with a small project
When adjusting back to typed languages, it’s useful to have an old project that you can practice with. Take something you’ve done before that’s fairly low complexity, and rebuild it in the new language. This can help you get your feet wet with common patterns, tasks, and steps in that language.
Have a REPL open
“Okay, I have this list of objects, how do I remove all instances of x?” Questions like this are why I recommend having a REPL open when working with the new typed language. It’s helpful to have that playground to try out different calling methods and approaches with quick feedback. You can then see how you want to solve a problem in a low-stakes way.
Breaking things down into really tiny pieces and working in the REPL is very handy. Instead of going into a difficult code environment and seeing if something works, you can open a REPL and play around with what you’re trying to solve. It’s great for solving small problems when you’re first learning a language — or even beyond that! Sometimes I’m in the thick of it on a client project and I open a REPL to try different things.
Ultimately, having a REPL open is great for brainstorming and thinking things through in the new language. I also like to look at the official documentation of each language and other documentation online when getting familiar with a language like TypeScript. For instance, doing these things is helpful when iterating over a dictionary in Python because it’s done differently than in TypeScript.
You’re going to run into issues — and that’s okay
Going from an untyped to a typed language is hard! For instance, when debugging it can be weird in the beginning because in other languages errors wouldn’t show up until runtime, but in TypeScript, you’ll get them before runtime. I wasn’t used to it, but I did like catching null bugs before they made it to production.
Above all, not explicitly knowing what types you’re working with at any given moment will be challenging. It will make it harder to solve the problem because you won’t know what types of data shapes you’re working with. Knowing what’s available to you is easier if you know the type. The best thing you can do is learn as much as you can with hands-on experience.
Prepare by building a framework
In this pocket of the tech industry, not working in the same stack or language all the time is fairly common. Recognize that this is going to happen, and build a framework for when the time comes. To me, a framework means laying out some steps to make the process easier for yourself. They are integral to the way I work.
Build yourself a framework by doing things like writing out the steps of each task, using VSCode IntelliSense, setting aside time to pair, doing small projects to get your feet wet, and having an REPL open. Frameworks are how you set yourself up for success! Just putting things in a list doesn’t give enough structure or strategy to know what to work through. In my experience, only keeping ideas in my head, in my notes, in a comment, or in tests means that things don’t get thought through. Building a framework so I can see my progress helps motivate me to keep going.
Be aware and give yourself the patience and understanding that when adjusting back to typed languages, it’s not going to sink in overnight. The more exposure you have, the more it will become second nature.