Skip to main content

Types in TypeScript

The one thing that makes TypeScript the most different from JavaScript is its syntax for providing types. No matter if we want to provide types for functions parameters, returns or when declaring variables - TypeScript makes it possible.

Basic Types

These are the three, you will work with the most.

  • string is for all strings just like in JS
  • number covers all types of numbers, no matter if float or integer
  • boolean holds either true or false

Using Types

As we just covered the three most important types, let's see how we can use them.

Variable declartion

const name: string = "Max";
let age: number = 24;
let isMarried: boolean = false;

### Functions


## Advanced Types

## Providing Data Types