TypeScript · Middle · Question 54 of 75
What are parameter properties, and why are they not "erasable" syntax?
class User {
constructor(private readonly name: string) {}
}- ✓Correct answer: They declare and assign a field from a constructor parameter; TypeScript must generate the assignment code
- 2They're just type annotations
- 3They make parameters optional
Explanation
Since they emit JavaScript, they're rejected by erasableSyntaxOnly and by runtimes that only strip types.