TypeScript · Middle · Question 54 of 75

What are parameter properties, and why are they not "erasable" syntax?

class User {
  constructor(private readonly name: string) {}
}

Explanation

Since they emit JavaScript, they're rejected by erasableSyntaxOnly and by runtimes that only strip types.

Further reading

Problem with a question

TypeScript · Middle · question 54

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz