Course Link Instructor's repository
- Type System: Dive into TypeScript's robust type system.
- OOP: Grasp Object-Oriented Programming principles.
- Generics: Understand the versatility of generic programming.
- Namespaces and Modules: Learn to organize code efficiently.
- Decorators: Extend the functionality of your code.
- Workshop: Build a real-world TypeScript application.
- Exam Preparation: Prepare for the TypeScript exam.
Install TypeScript
npm install -g typescript
Create the tsconfig.json file
tsc --init
Example tsconfig.json file
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"sourceMap": true, // for debugging
}
}Check files
tsc --noEmit
Run the app
tsc && node dist/app.js
- Namespaces are used to organize code into logical groups and prevent name collisions. They are executed when they are defined.
- Modules are used to organize code into logical groups and prevent name collisions. They are executed when they are imported.
cd "$(git rev-parse --show-toplevel)/04-Namespaces-and-Modules/Demo/namespaces/"
tsc --initcd "$(git rev-parse --show-toplevel)/04-Namespaces-and-Modules/Demo/modules/"
tsc --init
npm init -y
npm i typescript -D
# create index.ts
npm run buildcd "$(git rev-parse --show-toplevel)/04-Namespaces-and-Modules/Demo/skeleton/"
tsc --init
npm init -y
npm i webpack webpack-cli webpack-dev-server typescript ts-loader -D
npm run build
npm run dev
# After the skeleton is created
npm i
npm run dev