> For the complete documentation index, see [llms.txt](https://shopify-1.gitbook.io/typescript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shopify-1.gitbook.io/typescript/beginner/basic-types/primitive-types.md).

# Primitive types

In JavaScript, there are six primitive data types: `boolean`, `number`, `string`, `symbol` (new as of ES6), as well as `null` and `undefined`. TypeScript includes all of these as built-in types.

## Boolean

Booleans have two logical values: `true` or `false`.

```typescript
let isReady: boolean = false;
isReady = 'yes'; // Error: a string is not assignable to type 'boolean'
isReady = true; // OK
```

## Number

All numbers in TypeScript are stored no differently than in JavaScript — as [IEEE 754](http://steve.hollasch.net/cgindex/coding/ieeefloat.html) double-precision floating-point numbers.

```typescript
const integer: number = 6;
const float: number = 6.66;

// Non-decimal numbers are cool too:
const hex: number = 0xf00d;
const binary: number = 0b1010;
const octal: number = 0o744;

// Let's not forget our weird friends:
const negativeZero: number = -0;
const actuallyNumber: number = NaN;
const largeNumber: number = Number.MAX_VALUE;
const pi: number = Math.PI;
const largestNumber: number = Infinity;
```

## String

Strings work the same way as in JavaScript, where both `'` and `"` work correctly, as well as `` ` `` for template literals.

```typescript
const name: string = 'Christine';
const nameTagLabel: string = `Hello, my name is ${name}.`;
```

## Symbol

Symbol is a unique and immutable data type introduced in ES6.

```typescript
let country: symbol = Symbol('Canada'); // OK
country: symbol = 'Canada'; // Error: a string is not assignable to type 'symbol'
// typeof country === "symbol"
```

## Null and Undefined

Both `undefined` and `null` have their own types named `undefined` and `null`, respectively.

```typescript
// Not much else we can assign to these variables!
let u: undefined = undefined;
let n: null = null;

// To illustrate:
u = 200; // Error: a number is not assignable to type 'undefined'
n = 'idk'; // Error: a string is not assignable to type 'null'
```

By default `null` and `undefined` are subtypes of all other types, which means you can assign `null` and `undefined` to something having another type. For example:

```typescript
let myNum: number = 500;
myNum = null; // OK
myNum = undefined; // also OK
```
