Type annotations
A type annotation is a `: type` you write after a name to tell TypeScript which values it accepts.
A type annotation goes after the name of a variable, a parameter or a property: const course: string = "...". You read it as "course is a string".
The type checker (tsc) uses the annotation to watch your code. If you later try to store a number in course, it tells you before anything runs.
The annotation exists only for the type checker. When Node runs the file, it strips the types and plain JavaScript is left. So it does not change what the program does, only what the compiler lets you write.
You will see it from lesson 00.03, for example const course: string = "TypeScript for the backend";, and on almost every function parameter. When the starting value already makes the type clear, TypeScript infers it and you can leave the annotation out.
Reach for it when: Reach for it on function parameters, or when TypeScript cannot infer the type from the initial value.
Examples
Common mistake
const lessons: number = "113"; console.log(lessons);
Why: You said `lessons` is a number, but gave it a string. `"113"` in quotes is text.
How to write it: Write the value without quotes (113), or change the annotation to string if you really want text.
