npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tslombok

v1.2.6

Published

Lombok for TypeScript

Downloads

65

Readme

TSLombok

A decorator-based module that allows developer to reduce boilerplate code, make your code more fatty-free.

TSLombok use TypeScript Compiler API behind the scene to read the Abstract Syntax Tree (AST) of your TypeScript source code and then determine what should declaration to generate into .d.ts (declaration file) for using declaration merging technique. This technique allows TSLombok to merge a magic method from TSLombok into the existing decorated class.

Special thanks to Lombok. This project (TSLombok) is strongly inspired from their.

Preview

Without any IDE extension installation, only TSLombok is installed.

Getting started

Install TSLombok module

# For NPM user
npm install tslombok
# For Yarn user
yarn install tslombok
# For PNPM user
pnpm install tslombok

Then run TSLombok generator engine with npx tslombok and ready to go!
(We plan to remove this step and make TSLombok a TSC plugin for automatically starting up)

Features

@Getter / @Setter

  • @Getter - The property decorator to create a getter method automatically.
    A getter method returns the property, and is named getFoo if the property is called foo.
  • @Setter - The property decorator to create a setter method automatically.
    A setter method is named setFoo if the property is called foo, returns void, and takes 1 parameter of the same type as the property to set the field to the given value.

Example:

export class People {
  @Getter
  @Setter
  private readonly name: string = 'John Doe';
}
// You can call getter and setter seamlessly without any TypeScript warning!
const people = new People();
people.getName(); // 'John Doe'
people.setName('Jane Doe');
people.getName(); // 'Jane Doe'

Limitation

  • TSLombok generator engine reads your source code and determines what parameter type or return type should be by reading TypeReference of PropertyDeclaration on AST, so you must explicitly define the type.
  • We recommend you to use this TypeScript ESLint rule to enforce type annotations on member variables of classes.

Contribution

There are many ways in which you can participate in this project, for example:

License

Copyright (c) Vectier. All rights reserved.
Licensed under the MIT license.