Codington
0 of 5 problems solved0%

Primitives

5 exercises

TypeScript builds on JavaScript by adding types, so we can describe exactly what kind of values a variable can hold.

The three most common primitive types are:

  • string – text values like "Hello" or 'TypeScript'
  • number – all numbers, including decimals
  • boolean – logical values true or false

You can assign these types explicitly with :type annotations, or you can let TypeScript infer the type automatically when you give a variable a value. Inference makes code shorter and easier to read, while annotations help catch mistakes in more complex situations.

In this category, you’ll:

  • See the difference between explicit annotations and inferred types
  • Work with strings, numbers, and booleans
  • Write small functions that use these primitive types
  • Learn how TypeScript can catch mistakes before you run your code

These exercises are designed to be a gentle introduction: short, simple problems that give you a quick win while showing the core idea of TypeScript’s type system.

CodingtonCodington

© 2025 Codington. Built with TypeScript, TanStack Start and a lot of console.log().