Loading Depth Study
Preparing your workspace
Types describe what kind of value a variable can contain and help TypeScript detect invalid operations.
TypeScript provides common types such as string, number, boolean, array, object, null, undefined, and more advanced types. Type annotations can be written explicitly, but TypeScript can also infer many types automatically. Good typing describes the real shape and purpose of data rather than adding unnecessary annotations everywhere.
A course application may define a course title as a string, lesson count as a number, and published status as a boolean.
const title: string = "TypeScript"; const lessons: number = 12; const published: boolean = true; const tags: string[] = ["web", "frontend"]; console.log(title, lessons, published, tags);
The console prints the course title, lesson count, published status, and tags.