"Declare a field, assign it, and apply an access modifier — all in the parameter list."
The shorthand
TypeScript supports a special syntax for constructor parameters: prefix the parameter with an access modifier (public, private, protected, readonly), and TypeScript declares a class field with that name, automatically assigns it from the parameter, and applies the modifier.
class User {
constructor(public name: string, private _email: string) {}
// Equivalent to:
// name: string;
// private _email: string;
// constructor(name: string, _email: string) {
// this.name = name;
// this._email = _email;
// }
}
Three things in one parameter: field declaration, modifier, assignment. The shorthand keeps class definitions concise without losing any of the type system's checks.
When parameter properties shine
Data-bag classes — where the constructor just stores its parameters as fields — collapse dramatically. A class with 5 fields and a constructor that assigns each becomes 6 lines instead of 15. The shorthand is especially common in dependency-injection patterns (Angular, NestJS) where constructors are mostly assignments.
When to skip the shorthand
If the constructor does anything else with its parameters — validation, derivation, side effects — keep the explicit form. The shorthand only works for direct field assignment; once you need logic, you have to be explicit anyway.