1. What happens if you assign a `string` to a variable typed `number`?
- It works, JS is flexible at runtime
- TypeScript throws a compile-time error
- The value silently converts to NaN
- It is ignored by the compiler
Show answer
Answer: TypeScript throws a compile-time error
The TS compiler checks assignments against declared types and refuses to build mismatched code.
Lesson: Primitive Types