Skip to content

Static Typing

Medium — good to knowGeneral Dev

ELI5 — The Vibe Check

Static typing means you have to tell the computer what type each variable is when you write the code, and it checks everything is correct BEFORE running. It is like proofreading your essay before handing it in. TypeScript, Java, and Go are statically typed. Python and JavaScript are not — they figure out types on the fly.

Real Talk

Static typing is a type system where variable types are declared explicitly or inferred at compile time and checked before program execution. This catches type errors early, enables better IDE tooling (autocomplete, refactoring), improves self-documentation, and generally makes large codebases more maintainable. The opposite is dynamic typing, where types are determined and checked at runtime. TypeScript adds static typing to JavaScript.

Show Me The Code

// TypeScript (statically typed):
function add(a: number, b: number): number {
  return a + b;
}

add(1, 2);       // OK
add(1, '2');     // TypeScript ERROR before running:
                 // Argument of type 'string' is not assignable to 'number'

// JavaScript (dynamically typed — no error until runtime):
function add(a, b) { return a + b; }
add(1, '2'); // runs fine, returns '12' (string concatenation!)

When You'll Hear This

"TypeScript adds static typing to JavaScript." / "Static typing catches bugs before you even run the code."

Made with passive-aggressive love by manoga.digital. Powered by Claude.