Skip to content

Commit

Permalink
fix: update target name to be a valid typescript 5 decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
notaphplover committed Oct 21, 2024
1 parent 7619dd4 commit 0bc0f04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

### Fixed
property injection tagged as @optional no longer overrides default values with `undefined`.
property injection tagged as @optional no longer overrides default values with `undefined`.
Updated `targetName` to be a valid `typescript@5` decorator.

## [6.0.2]

Expand Down
14 changes: 9 additions & 5 deletions src/annotation/target_name.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import * as METADATA_KEY from '../constants/metadata_keys';
import { Metadata } from '../planning/metadata';
import { tagParameter, DecoratorTarget } from './decorator_utils';
import * as METADATA_KEY from "../constants/metadata_keys";
import { Metadata } from "../planning/metadata";
import { tagParameter, DecoratorTarget } from "./decorator_utils";

function targetName(name: string) {
return function (target: DecoratorTarget, targetKey: string, index: number) {
return function (
target: DecoratorTarget,
targetKey: string | undefined,
index: number
) {
const metadata = new Metadata(METADATA_KEY.NAME_TAG, name);
tagParameter(target, targetKey, index, metadata);
};
}

export { targetName };
export { targetName };

0 comments on commit 0bc0f04

Please sign in to comment.