-
Notifications
You must be signed in to change notification settings - Fork 0
Typing Pizza App part 1
Now that we had a glance on how to add basic type definitions on a TypeScript codebase, it's the time to start adding the basic types on our pizza application.
To do so, let's follow this quick workflow:
- We expect the orderId to be a number
- We expect the cashInRegister also to be a number
- Some other internal functios parameters can benefit from basic types
- Fix the code so it can work properly after adding those type definitions
And with that the basic type declarations should be added correctly into the Pizza App.
After a overview of the code, let's add some basic types to our variables and fix some function calls:
let cashInRegister: number = 100;
let orderId: number = 1;
/* some definitions */
const completeOrder = (orderId: number) => {
/* function body */
};
/* rest of the code */
completeOrder(1);Those notes were written while watching the tutorial videos while taking the classes from the online course Learn TypeScript on Scrimba.
Because english is not my mother language, they can contain some typos and everything written here is based on my understanding about the discussed topics and may not be 100% accurate.
If you want the full course, support the instructor by buying their course on Scrimba.
- Home
- Introduction
- Introduction to TypeScript
- The Pizza Application
- Move to TypeScript
- Defensive Coding
- Typing variables
- Typing Pizza App: part 1
- Custom types
- Typing Pizza App: part 2
- Nested Object types
- Optional Properties
- Typing Pizza App: part 3
- Array Types
- Typing Pizza App: part 4
- Literal Types
- Unions
- Typing Pizza App: part 5
- Typing Pizza App: part 6
- Typing Pizza App: part 7
- Returning Types
- Typing Pizza App: part 8
- Any Type
- Typing Pizza App: part 9
- Utility Types
- Typing Pizza App: part 10
- Generics
- Typing Pizza App: part 11