Typescript Foundations / Introduction to Typescript

Typescript Vs Javascript

JavaScript

TypeScript

Dynamically typed

Statically typed (types can be defined at compile time)

Errors show at runtime

Errors caught during development (compile time)

No type checking

Type checking with optional type annotations

Flexible but prone to type-related bugs

More robust and predictable due to types


📝 Example

👉 In TypeScript, if you accidentally pass a number instead of a string to greet, TypeScript will show an error before you even run the code!