This Visual Studio Code extension streamlines the rapid generation of TypeScript classes by offering key features, including:
Features
Builder: Automatically generate a fluent builder for TypeScript classes.
AllArgsConstructor: Create constructors with all class fields as parameters.
Getter/Setter: Efficiently generate getter and setter methods for class fields.
Equal/HashCode: Generate equality checks and a hash code for class properties.
Requirements
To make use of this extension, ensure that you have the following prerequisites installed:
Visual Studio Code version ^1.84.0
TypeScript version 4.x or later
How to Use
To effectively utilize this extension, follow these steps:
Open your TypeScript file in Visual Studio Code.
Create a class within your document, as demonstrated in the following example:
class Test {
private property: string;
}
Execute the desired command by pressing Ctrl + Shift + P and typing one of the following options:
"Builder Class Generate"
"Builder Class Generate With Builder Id"
"AllArgsConstructor Generate"
"Getter Setter Class Generate"
"Equals and Hash Generate"
To create equality checks and generate a hash for a property, highlight the property you intend to apply these operations to. Please be aware that this command does not support arrays or objects.
If you want to use Equals and Hash Generate you have to make this helper function hash to you directory in .ts file