In this repo you will find step by step learning on typos. As and entry-level learning process.
Initializing a project w/ typescript con auto-update and predefined configuration:
npx tsc --init --sourceMap --rootDir src --outDir dist
Methods to debug and run TS files:
- Library to transpiled the typescripts files w/ node from Backend development: TS-Node
- Run and debug VS-code.
- Create a launch.json file โ Node.js
- Transpiled the TS files (optional: npx tsc --watch)
- Primitive typos:
- Number, boolean, String, Array
- Special data types:
- Any, union type
- Aliases | Literal types
- Null or undefined
- Functions
- Return values
- Objects inside Functions
- Objects as types
- Modules
A used case of typescript:
let productPrice = 100; //Inference type of number
let productStock: number; // Declarative without assigned value
// โ Bad practices
console.log(productStock); // Variable should have a value
productStock = productPrice + "It cannot sum"; // Only accepts numbers
For more in-depth of this topics I will write down each use case on the notes folder.