lombok-typescript
v1.4.0
Published
Lombok-like decorators and code generation for TypeScript - reduce boilerplate with powerful annotations and Gang-of-Four design patterns
Maintainers
Readme
lombok-typescript
TypeScript decorators inspired by Project Lombok and common design patterns. Supports legacy experimentalDecorators and Stage 3 decorators via separate entry points.
Install
Install this release:
npm install [email protected]Install the current latest release:
npm install lombok-typescriptDecorators in this release
Lombok-style
- @NonNull
- @ToString
- @Builder
- @Data
- @Value
- @With
- @Equals
- @Getter
- @Setter
- @Log
- @Accessors
- @UtilityClass
- @FieldDefaults
- @Delegate
- @BuilderDefault
- @Singular
Creational patterns
- @Singleton
- @Prototype
- @Factory
- @AbstractFactory
- @Pool
Behavioral patterns
- @Strategy
- @State
- @Command
- @Memento
- @Observable
- @ChainOfResponsibility
- @Iterable
- @Visitor
- @Visitable
- @Hook
Structural patterns
- @Flyweight
- @Proxy
- @Composite
- @Wraps
- @TemplateMethod
TypeScript utilities
- @Memoize
- @Retry
- @Validate
- @Debounce
- @Throttle
- @Trace
- @Serializable
- @DeepFreeze
Marker decorators
- @Adapter
- @Bridge
- @Facade
- @Mediator
- @Interpreter
Quick start
npx lombok-ts init
npx lombok-ts generateimport { Data, Builder, NonNull } from 'lombok-typescript/legacy';
@Data
@Builder
class User {
@NonNull name!: string;
}For NestJS, plain TypeScript, and Stage 3 setup, see the documentation.
CLI
| Command | Description |
| ------- | ----------- |
| lombok-ts generate | Generate companion TypeScript files for decorated classes |
| lombok-ts init | Add lombok configuration to your project |
| lombok-ts clean | Remove generated lombok output from your project |
| lombok-ts watch | Regenerate when source files change |
Documentation
https://a-dev-kit.github.io/lombok-typescript/
License
MIT
