Static Typing and TypeScript Explained For Recruiters

Static Typing and TypeScript Explained For Recruiters
Post Author: Aaron Decker
Date published: January 14, 2020

Static Typing is a concept in computer science used to describe programming languages. TypeScript is a variant of JavaScript with Static Typing instead of Dynamic Typing (JavaScript has Dynamic Typing).

In this post I'm going to explain both of these concepts - my argument is that as a recruiter you will benefit from understanding from fundamental concepts like typing in programming languages because it will help you converse with hiring managers and candidates on a deeper level.

What are Data Types?

To understand typing you need to first understand data types. To understand data types you first need to understand that computer programs are essentially instructions for telling a computer what to do with data.

A variable is a named storage location for data. Data has types, or put another way, you can describe what kind of data you are storing into a variable.

What are some common types of data?

  • String - That is what we call text. Like "Hello", or "Goodbye"
  • Integer - what we call a number with no decimals. Like 5 or 119938.
  • Array - this is a list of things. It might be a list of any other data type.

There are more types of data but we don't need to go into that. You just need to understand the basics.

What is Typing

Typing describes how a programming language works with data types.

It's actually that simple, but it has huge implications for how compilers work and how memory can be managed inside of programming languages.

Static Vs Dynamic Typing

Static Typing means when you create a variable you need to tell the computer what kind of data will be stored in it (Text, Numeric, something else...) and you can't change it after the fact.

Dynamic Typing means you don't need to tell the computer what kind of data will be stored in a variable when you create it. The types are checked as the program runs (at "runtime").

TypeScript

TypeScript can be thought of as JavaScript with types. Or JavaScript with static typing. Normal JavaScript is dynamically typed.

Why would people do this? Why re-do the language with types?

Because types offer a lot of advantages. It can be easier to share code and work with a larger team because the types are clearly defined. This has a sort of built-in documentation effect.

Types also eliminate whole categories of errors that can occur. For example you can multiply a number by another number... But what happens if you try to multiple a string (some text) by another string? Seems like that is impossible right? It does not make any sense. Well, you could accidentally do that in normal JavaScript.

But TypeScript will prevent you from making this mistake because it knows all of the types before you run the program.

An example

Okay, going back to that example of multiplying a text by some other text let's see what happens.

Here is Node.js. Notice you are just allowed to do this and you get a result NaN which stands for "Not A Number". The program runs, but the result makes no sense! The "a * b" means multiply variable a by variable b. If you didn't know, in most programming languages (and Excel) "*" means multiply.

Node js multiple words example

Here is that same equivalent code in TypeScript. Notice that you get red squiggly lines: the program can tell you ahead of time that this an error! You don't even have to test it or run it, you can catch it right as you write the program.

TypeScript error

Summary

I hope that was easy to follow. Just FYI, a university computer science course might take a whole lecture or whole week to cover that information. I tried to boil it down to the basics.

What I think you should take away from this is that some languages are Static and some languages are Dynamic. There is a big difference between these two in practice and it can be a huge preference between organizations, hiring managers and programmers.

The other thing to take away is that TypeScript is basically JavaScript with static typing. JavaScript developers should be able to pick up TypeScript easily, but they may not actually want to. Part of the appeal of JavaScript is dynamic typing so make sure to ask candidates about this.


Want updates?

Want new posts about tech topics emailed to you? Sign up to the list below 👇

Also, if you are interested in learning technical topics through a video course specifically created for recruiters, don't forget to check out the courses I offer.

The main course "How to Speak Software Engineering Jargon for Recruiters" is specifically designed to help tech recruiters get up to speed fast on technical topics.


Written By Aaron Decker

I'm currently a co-founder and head of engineering at a venture backed startup called Bounty. I tend to think of myself as a backend engineer that can work up and down the stack in Typescript. Previously, I have worked as a Tech Lead and hired teams, and as a Senior Software Engineer at multiple fortune 500 companies building large products. I also did a brief stint teaching programming courses as an Adjunct Instructor at a local community college, which taught me a lot about breaking down complex things into understandable chunks.