

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 is great at type inference. Instead of explicitly declaring the type of every variable, TypeScript can infer it from the value:
// explicit (unnecessary)
const bootupLog: string = "starting server...";
// inferred (preferred)
const bootupLog = "starting server...";
Both are equally type-safe, but the inferred version is less typing and leaves less room for human error. Let TypeScript infer types for you!
Fix the type error by removing the (incorrect) explicit type declaration.