---
# System prepended metadata

title: Understanding TypeScript - Section 02

---

# Understanding TypeScript - Section 02

## TypeScript Basics and Basic Types

### Using Types

#### *Core Types*
* number
    * all numbers; no differentiation between integers and floats
    * examples: 1, 5.3, -10
* string
    * all text values
    * examples: 'Hi', "Hi", \`Hi\`
* boolean
    * true, false. just these two; no "truthy" or "falsy" values

#### *Notes:*
* What TypeScript does is it helps you during development. It does not change your runtime code. 
* Do not open `ts` and `js` files at the same time as this results to an error called **Duplicate function implementation**. Closing the `js` file fixes this.
![](https://i.imgur.com/ts0IERT.png)

### TypeScript Types vs. JavaScript Types
* The key difference is: JavaScript uses "dynamic types" (resolved at runtime) while TypeScript uses "static types" (set during development).

### Type Casing

#### *Important:*
In TypeScript, you work with types like `string` or `number`.
Important: It is `string` and `number` (etc.), NOT `String`, `Number` etc.
The core primitive types in TypeScript are all **lowercase**!

### Type Assignment and Type Inference
* The core task of TypeScript is checking types and yelling at  us if we're using them incorrectly.

```
let number1: number;
number = 5;
number = '5'; //will throw an error

let resultPhrase = "Result is: ";
resultPhrase = 0; //Trying to store a number will throw an error because TypeScript inferred that we want to store a string. 
```

### Object Types


### Nested Objects & Types


### Array 


### Working with Tuples