

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
Type inference lets TypeScript determine a variable's type from its value, so we actually don't need to write obvious annotations:
// explicit (unnecessary)
const bootupLog: string = "starting server...";
// inferred (preferred)
const bootupLog = "starting server...";
Both versions are type-safe, but the inferred version is shorter!
Fix the type error by removing the incorrect type annotation.