Step 1 - Pre-requisites
Course: More Typescript APIs - chapter 1
Before you go through this module, make sure you’ve gone through basic typescript classes.
You understand interfaces , types and how typescript is used in a simple Node.js application
If you understand the following code, you’re good to go!
interface User { name: string; age: number;}
function sumOfAge(user1: User, user2: User) { return a.age + b.age;};
// Example usageconst result = sumOfAge({ name: "harkirat", age: 20}, { name: "raman", age: 21});console.log(result); // Output: 9Recap setup procedure
Section titled “Recap setup procedure”To recap, if you want to start a Typescript project locally, please do the following -
- Initialize TS
npx tsc --init- Change tsconfig as per your needs. Usually changing
rootDirandoutDiris a good idea
{ "rootDir": "./src", "outDir": "./dist"}