0Pricing
TypeScript Academy · Lesson

Primitive Types & Annotations

Understand TypeScript primitive types and how to annotate variables.

Primitive Types & Annotations is a free TypeScript Academy lesson on CoddyKit — lesson 1 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the TypeScript Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Intro to Primitives

Goal: Explore primitive types (string, number, boolean, null, undefined, bigint, symbol) and annotate variables clearly.

String & number

string and number are the most common primitive types. Use annotations for clarity when needed.

let title: string = "TypeScript";
let version: number = 5.4;
console.log(title, version);

Boolean, null, undefined

boolean values are true/false. null and undefined represent absence; they have their own types.

let isDone: boolean = false;
let empty: null = null;
let notAssigned: undefined = undefined;
console.log(isDone, empty, notAssigned);

bigint & symbol

bigint handles arbitrarily large integers. symbol creates unique identifiers, often for object keys.

let big: bigint =123456789012345678901234567890n;
let uniqueKey: symbol = Symbol("id");
nconsole.log(big, uniqueKey);

Annotation syntax

Annotations come after the variable name with a colon. This makes code self-documenting.

let username: string = "Alice";
let age: number = 30;
let isMember: boolean = true;

Inference vs annotation

Inference lets TS deduce types from values. Use explicit annotations for clarity, APIs, or when variables start empty.

Annotation check

Quick check: Which is the correct way to annotate a string variable?

Recap & next

Recap: TS supports multiple primitive types: string, number, boolean, null, undefined, bigint, symbol. Annotate with a colon after variable names.

Frequently asked questions

Is the “Primitive Types & Annotations” lesson free?

Yes — the full text of “Primitive Types & Annotations” is free to read here on the web, and the TypeScript Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the TypeScript Academy course, upgrade to CoddyKit PRO.

What will I learn in “Primitive Types & Annotations”?

Understand TypeScript primitive types and how to annotate variables. You practise TypeScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start TypeScript Academy?

No prior experience is required. TypeScript Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 3, so you can start here or from the beginning and move at your own pace.

How long does the “Primitive Types & Annotations” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this TypeScript Academy lesson?

Yes. Every TypeScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Primitive Types & Annotations
  2. Type Inference & any vs unknown
  3. Union & Literal Types (basic narrowing intro)
← Back to TypeScript Academy