TypeScript
  • Introduction
  • Introduction
    • What is TypeScript?
    • Why TypeScript?
    • Setup
  • Beginner
    • Basic types
      • Primitive types
      • Arrays and tuples
      • Enums
      • Any type
    • Objects
    • Type aliases
    • Interfaces
    • Functions
      • Function signatures
      • Void type
      • Functions as types
    • Union types
    • Type guards
    • Intersection types
    • Nullable types
    • Inference
  • Resources
    • Resources
Powered by GitBook
On this page
  1. Beginner

Basic types

PreviousSetupNextPrimitive types

Last updated 6 years ago

We covered some features of the TypeScript type system in . In this section we will dive a bit deeper, laying a strong foundation so we can tackle more advanced topics to come.

First, it's worth repeating this point: the type system in TypeScript is completely optional. Therefore, vanilla JavaScript is still 100% valid TypeScript. In fact, you can think of JavaScript simply as TypeScript that hasn't been annotated yet. (Ok, that's a bit of an oversimplification.)

Secondly, remember that TypeScript's type enforcement happens during its compile time. Therefore, in your outputted JavaScript, the type annotations will be gone.

Now, let's start get started!

Why TypeScript?