Getting Started

Get up and running with ts-lombok-kit in minutes.

Requirements

  • TypeScript 4.8+
  • Node.js 16+
  • ts-patch for compiler plugin support

1. Installation

Install ts-lombok-kit and ts-patch as dev dependencies:

terminal
npm install ts-lombok-kit ts-patch

Or with yarn:

terminal
yarn add ts-lombok-kit ts-patch

2. Setup ts-patch

Add the prepare script to your package.json:

package.json
{
  "scripts": {
    "prepare": "ts-patch install -s"
  }
}

Then run:

terminal
npm run prepare

Note: ts-patch patches the TypeScript compiler to enable custom transformers. The prepare script ensures it's set up whenever dependencies are installed.

3. Configure tsconfig.json

Add the ts-lombok-kit transformer to your tsconfig.json:

tsconfig.json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "plugins": [
      { "transform": "ts-lombok-kit" }
    ]
  }
}

Important: Make sure experimentalDecorators is enabled.

4. Start Using Decorators

Import decorators from ts-lombok-kit/markers and use them on your classes:

example.ts
1import { Data, Builder } from 'ts-lombok-kit/markers';
2
3@Data
4class User {
5 id: number;
6 name: string;
7 email: string;
8}
9
10// All getters, setters, toString, equals, and hashCode are generated!
11const user = new User(1, 'John', 'john@example.com');
12console.log(user.getName()); // 'John'
13console.log(user.toString()); // 'User(id=1, name=John, email=john@example.com)'

IDE Support

For the best development experience, configure your IDE to use the patched TypeScript version.

VS Code

Create or update .vscode/settings.json:

.vscode/settings.json
{
  "typescript.tsdk": "node_modules/typescript/lib"
}

WebStorm / IntelliJ IDEA

Go to Settings > Languages & Frameworks > TypeScript and set the TypeScript package to node_modules/typescript.

Next Steps