TypeScript Compile-Time Decorators

Spice up your TypeScript

ts-lombok-kit is a TypeScript library that automatically plugs into your editor and build tools, eliminating boilerplate code through compile-time AST transformations. Never write another getter again.

$npm install ts-lombok-kit ts-patch

Write Less, Do More

See how ts-lombok-kit transforms verbose boilerplate into clean, declarative code.

Before40+ lines of boilerplate
1class User {
2 private id: number;
3 private name: string;
4 private email: string;
5
6 constructor(id: number, name: string, email: string) {
7 this.id = id;
8 this.name = name;
9 this.email = email;
10 }
11
12 getId(): number { return this.id; }
13 setId(id: number): void { this.id = id; }
14 getName(): string { return this.name; }
15 setName(name: string): void { this.name = name; }
16 getEmail(): string { return this.email; }
17 setEmail(email: string): void { this.email = email; }
18
19 toString(): string {
20 return `User(id=${this.id}, name=${this.name}, email=${this.email})`;
21 }
22
23 equals(other: User): boolean {
24 return this.id === other.id &&
25 this.name === other.name &&
26 this.email === other.email;
27 }
28
29 hashCode(): number {
30 // ... implementation
31 }
32}
AfterJust 8 lines with ts-lombok-kit
1import { Data } from 'ts-lombok-kit/markers';
2
3@Data
4class User {
5 id: number;
6 name: string;
7 email: string;
8}
9
10// That's it! All methods are generated at compile time.

Powerful Features

Everything you need to eliminate boilerplate and write cleaner TypeScript code.

Zero Runtime Cost

All transformations happen at compile time. No runtime overhead, no extra dependencies in production.

Type-Safe

Full TypeScript support with proper type inference. Your IDE will understand all generated methods.

Immutable Patterns

@Record, @Value, and @With decorators for creating immutable data classes with ease.

Builder Pattern

@Builder generates a fluent builder API for complex object construction.

Boilerplate Reduction

@Data, @Getter, @Setter, @ToString, @Equals - generate common methods automatically.

Design Patterns

@Singleton, @Log, and constructor variants for common patterns out of the box.

Combine Decorators for Full Power

Mix and match decorators to get exactly the functionality you need. Create immutable records with builders and withers in just a few lines.

  • @Record for immutability
  • @Builder for fluent construction
  • @With for immutable updates
1import { Record, Builder, With } from 'ts-lombok-kit/markers';
2
3@Record
4@Builder
5@With
6class Product {
7 id: number;
8 name: string;
9 price: number;
10}
11
12// Create with builder
13const product = Product.builder()
14 .id(1)
15 .name('Widget')
16 .price(9.99)
17 .build();
18
19// Immutable update
20const updated = product.withPrice(19.99);
21
22console.log(product.toString());
23// Product(id=1, name=Widget, price=9.99)

Available Decorators

A comprehensive set of decorators covering common patterns and boilerplate.

DecoratorTypeDescription
@RecordClassImmutable data carrier (constructor, readonly, freeze, toString)
@DataClass@Getter + @Setter + @ToString + @Equals + @AllArgsConstructor
@BuilderClassGenerate builder pattern with fluent API
@Getter / @SetterClassGenerate accessor methods
@WithClassGenerate withX() methods for immutable updates
@SingletonClassSingleton pattern with getInstance()

Ready to eliminate boilerplate?

Get started with ts-lombok-kit in minutes. Zero runtime cost, full TypeScript support.