

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Learn TypeScript
incomplete
2: Basic Types
incomplete
3: Type Inference
incomplete
4: Why TypeScript
incomplete
5: What Is TypeScript
incomplete
6: Any
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
TypeScript adds type annotations to JavaScript variables using a : followed by the type. The most common primitive types are:
const bootupMessage: string = "starting server...";
const port: number = 3000;
const isOnline: boolean = true;
const noValue: null = null;
const notDefined: undefined = undefined;
If a value doesn't match its type, TypeScript throws a compilation error:
const bootupMessage: string = 123;
// Error: Type 'number' is not assignable to type 'string'.
We have a compilation bug!
Fix the type of the supportAiLogs variable so that the TypeScript compiler doesn't throw an error.