TypeScript · Senior · Question 17 of 75
What does the erasableSyntaxOnly flag (TS 5.8) forbid?
- ✓Correct answer: Syntax that requires code generation:
enum,namespace - 2Any type annotations in
.tsfiles except JSDoc - 3Using
any,unknownandasassertions
Explanation
Node.js can run TypeScript by simply erasing types (type stripping). Constructs that require code generation don't work that way. The flag reports them in advance so the code runs without a separate compile step.