{"id":21851833,"url":"https://github.com/nberlette/decorators","last_synced_at":"2026-05-06T23:39:59.979Z","repository":{"id":235739971,"uuid":"779822131","full_name":"nberlette/decorators","owner":"nberlette","description":"Monorepo for packages published under the @decorators scope on JSR.","archived":false,"fork":false,"pushed_at":"2026-02-11T23:06:55.000Z","size":564,"stargazers_count":2,"open_issues_count":9,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-12T04:27:59.320Z","etag":null,"topics":["decorator","decorators","deno","es-decorators","jsr","monorepo","node","stage-3","typescript","typescript-decorators"],"latest_commit_sha":null,"homepage":"https://decorators.deno.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nberlette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"nberlette"}},"created_at":"2024-03-30T21:51:23.000Z","updated_at":"2026-02-11T23:06:59.000Z","dependencies_parsed_at":"2024-04-25T18:29:57.268Z","dependency_job_id":"b4e9023c-bcfa-45de-b178-61a019318b4b","html_url":"https://github.com/nberlette/decorators","commit_stats":null,"previous_names":["nberlette/decorators"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/nberlette/decorators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nberlette%2Fdecorators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nberlette%2Fdecorators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nberlette%2Fdecorators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nberlette%2Fdecorators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nberlette","download_url":"https://codeload.github.com/nberlette/decorators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nberlette%2Fdecorators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32716856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T19:35:05.142Z","status":"ssl_error","status_checked_at":"2026-05-06T19:35:03.996Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decorator","decorators","deno","es-decorators","jsr","monorepo","node","stage-3","typescript","typescript-decorators"],"created_at":"2024-11-28T01:11:33.211Z","updated_at":"2026-05-06T23:39:59.969Z","avatar_url":"https://github.com/nberlette.png","language":"TypeScript","funding_links":["https://ko-fi.com/nberlette"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# [\u003cimg src=\"https://jsr.io/badges/@decorators\" height=\"40\" alt=\"@decorators\" /\u003e][jsr]\n\nMonorepo for packages published under the [`@decorators/*`][JSR] scope on [JSR].\n\n\u003c/div\u003e\n\n---\n\n## Packages\n\n### [`@decorators/alias`]\n\nCreates aliases for existing class members, with support for methods, getters,\nsetters, auto-accessors, and fields. Static members are also supported, along\nwith `#private` members (in environments with support for ES2022 class fields).\n\n- **[➥ API Documentation](https://jsr.io/@decorators/alias)**\n- **[➥ View the README](./packages/alias/README.md)**\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e When working with private members, the `@alias` decorator **must** beß applied\n\u003e inside of the **same** enclosing class that the member is declared in. This is\n\u003e due to the way that private members are scoped in JavaScript.\n\nSimplifies stack traces for improved debugging, improves code readability for a\nmore maintainable codebase, and reduces the boilerplate typically associated\nwith aliasing class members in TypeScript/JavaScript.\n\n#### Install\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:deno.svg?height=3rem\u0026width=4rem\" alt=\"Deno\" /\u003e\n\n```sh\ndeno add @decorators/alias\n```\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:npm.svg?height=3.666rem\u0026width=4rem\" alt=\"NPM\"\u003e\n\n```sh\nnpx jsr add @decorators/alias\n```\n\n#### Usage\n\n```ts\nimport { alias } from \"@decorators/alias\";\n\nclass Foo {\n  // alias() can be used to create multiple aliases from one original member\n  @alias(\"qux\", \"nurp\")\n  bar(): string {\n    return \"baz\";\n  }\n\n  // declare the aliased members to avoid compilation errors\n  declare qux: Foo[\"bar\"];\n  declare nurp: Foo[\"bar\"];\n\n  // or, use @alias.for on the alias itself and pass it the original member name.\n  @alias.for(\"bar\")\n  baz(): string {\n    return this.bar();\n  }\n}\n\nconst foo = new Foo();\n\nconsole.assert(foo.bar === \"baz\"); // OK\nconsole.assert(foo.bar === foo.baz); // OK\nconsole.assert(foo.qux === foo.bar); // OK\nconsole.assert(foo.nurp === foo.bar); // OK\n```\n\n---\n\n### [`@decorators/bind`]\n\nBind methods, getters, and setters to the appropriate context object, with\nsupport for static members and inheritance.\n\n- **[➥ API Documentation](https://jsr.io/@decorators/bind)**\n- **[➥ View the README](./packages/bind/README.md)**\n\n#### Install\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:deno.svg?height=3rem\u0026width=4rem\" alt=\"Deno\" /\u003e\n\n```sh\ndeno add @decorators/bind\n```\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:npm.svg?height=3.666rem\u0026width=4rem\" alt=\"NPM\"\u003e\n\n```sh\nnpx jsr add @decorators/bind\n```\n\n#### Usage\n\n```ts\nimport { bind } from \"@decorators/bind\";\n\nclass Foo {\n  @bind\n  bar(): Foo {\n    return this;\n  }\n\n  @bind\n  static self(): typeof Foo {\n    return this;\n  }\n}\nconst { self } = Foo, { bar } = new Foo();\n\nconsole.log(self === Foo); // true\nconsole.log(bar() instanceof Foo); // true\n```\n\n---\n\n### [`@decorators/lru`]\n\nHighly configurable LRU cache decorator for class methods, with support for TTL,\nmax size, custom key generation, pre- and post-processing, lifecycle event\nhandlers, and much more.\n\n- **[➥ API Documentation](https://jsr.io/@decorators/lru)**\n- **[➥ View the README](./packages/lru/README.md)**\n\n#### Install\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:deno.svg?height=3rem\u0026width=4rem\" alt=\"Deno\" /\u003e\n\n```sh\ndeno add @decorators/lru\n```\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:npm.svg?height=3.666rem\u0026width=4rem\" alt=\"NPM\"\u003e\n\n```sh\nnpx jsr add @decorators/lru\n```\n\n#### Usage\n\n```ts\nimport { lru } from \"@decorators/lru\";\n\nclass BasicExample {\n  @lru({ maxSize: 64, ttl: 1000 })\n  memoized(arg1: string, arg2: number): string {\n    return `${arg1}-${arg2}`;\n  }\n}\n\nconst example = new BasicExample();\nconsole.log(example.memoizedMethod(\"foo\", 42)); // \"foo-42\"\nconsole.log(example.memoizedMethod(\"foo\", 42)); // \"foo-42\" (cached)\n```\n\n### [`@decorators/types`]\n\nCollection of type guard functions, decorator function signatures, decorator\nfactory signatures, and other utility types for working with both Stage 3 and\nLegacy Decorators (Stage 2 / `experimentalDecorators`).\n\n- **[➥ API Documentation](https://jsr.io/@decorators/types)**\n- **[➥ View the README](./packages/types/README.md)**\n\n#### Install\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:deno.svg?height=3rem\u0026width=4rem\" alt=\"Deno\" /\u003e\n\n```sh\ndeno add @decorators/types\n```\n\n\u003cimg align=\"right\" src=\"https://api.iconify.design/logos:npm.svg?height=3.666rem\u0026width=4rem\" alt=\"NPM\"\u003e\n\n```sh\nnpx jsr add @decorators/types\n```\n\n#### Usage\n\n```ts\nimport {\n  type AnyDecoratorArguments,\n  type AnyDecoratorReturn,\n  isDecoratorArguments,\n  isLegacyDecoratorArguments,\n} from \"@decorators/types\";\n\nfunction toStringTag\u003cArgs extends AnyDecoratorArguments\u003e(\n  value: string,\n): (...args: Args) =\u003e AnyDecoratorReturn\u003cArgs\u003e;\n// deno-lint-ignore no-explicit-any\nfunction toStringTag(value: string): (...args: any[]) =\u003e any {\n  return (...args) =\u003e {\n    if (isDecoratorArguments(args)) {\n      const [target, context] = args;\n      if (context.kind !== \"class\") {\n        throw new TypeError(\n          `@toStringTag cannot decorate ${context.kind}s - it can only be used on the class itself.`,\n        );\n      }\n      context.addInitializer(function () {\n        Object.defineProperty(this.prototype, Symbol.toStringTag, {\n          value,\n          configurable: true,\n        });\n      });\n    } else if (isLegacyDecoratorArguments(args)) {\n      const [target] = args;\n      Object.defineProperty(target.prototype, Symbol.toStringTag, {\n        value,\n        configurable: true,\n      });\n    } else {\n      throw new TypeError(\"@toStringTag received invalid arguments\");\n    }\n  };\n}\n\n// this decorator factory works in TS 4.x and 5.x without issue:\n@toStringTag(\"Foo\")\nclass Foo {\n  // ...\n}\n```\n\n---\n\n### Contributing\n\nContributions are warmly welcomed! Please read the [Contributing Guide] for\ndetails on our code of conduct, and the process for submitting pull requests.\n\nIf you find a bug, please [open an issue] and we will get to it as soon as\npossible. Alternatively, if you feel up to fixing it yourself, please create the\nissue anyways (so we can track it) and submit a pull request with the fix!\n\n---\n\n### Further Reading\n\n- **[TC39 Decorators Proposal]** - The official TC39 proposal for decorators.\n- **[Stage 3 Decorators in Deno]** - A microsite we created that's dedicated to\n  cover the [TC39 decorators proposal] and its landmark implementation in Deno.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**[MIT] © [Nicholas Berlette]. All rights reserved.**\n\n\u003csmall\u003e\n\n[github] · [issues] · [jsr] · [docs] · [contributing]\n\n\u003c/small\u003e\u003c/div\u003e\n\n[`@decorators/alias`]: https://jsr.io/@decorators/alias \"Check out the '@decorators/alias' package\"\n[`@decorators/bind`]: https://jsr.io/@decorators/bind \"Check out the '@decorators/bind' package\"\n[`@decorators/lru`]: https://jsr.io/@decorators/lru \"Check out the '@decorators/lru' package\"\n[`@decorators/types`]: https://jsr.io/@decorators/types \"Check out the '@decorators/types' package\"\n[GitHub]: https://github.com/nberlette/decorators#readme \"Check out all the '@decorators/*' packages over at the GitHub monorepo!\"\n[MIT]: https://nick.mit-license.org \"MIT © 2024+ Nicholas Berlette. All rights reserved.\"\n[Nicholas Berlette]: https://github.com/nberlette \"Nicholas Berlette on GitHub\"\n[Issues]: https://github.com/nberlette/decorators/issues \"GitHub Issue Tracker for '@decorators/*' packages\"\n[Open an Issue]: https://github.com/nberlette/decorators/issues/new?assignees=nberlette\u0026labels=bugs\u0026title=%5Bbind%5D+ \"Found a bug? Let's squash it!\"\n[JSR]: https://jsr.io/@decorators \"View @decorators/* packages on JSR\"\n[TC39 Decorators Proposal]: https://github.com/tc39/proposal-decorators \"TC39 Proposal: Decorators\"\n[Stage 3 Decorators in Deno]: https://decorators.deno.dev \"Stage 3 Decorators in Deno\"\n[Contributing Guide]: ./.github/CONTRIBUTING.md \"Contributing Guide\"\n[Contributing]: ./.github/CONTRIBUTING.md \"Contributing Guide\"\n[@decorators/alias]: https://github.com/nberlette/decorators/tree/main/packages/alias#readme \"Check out '@decorators/alias' and more over at the GitHub monorepo!\"\n[@decorators/bind]: https://github.com/nberlette/decorators/tree/main/packages/bind#readme \"Check out '@decorators/bind' and more over at the GitHub monorepo!\"\n[@decorators/types]: https://github.com/nberlette/decorators/tree/main/packages/types#readme \"Check out '@decorators/types' and more over at the GitHub monorepo!\"\n[Docs]: https://nberlette.github.io/decorators \"View @decorators API docs\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnberlette%2Fdecorators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnberlette%2Fdecorators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnberlette%2Fdecorators/lists"}