Skip to content

Commit

Permalink
refactor: rename inject.call() -> inject.by()
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Oct 12, 2024
1 parent 9cbacdd commit 7afe187
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ export function Scoped<This extends object>(scope: InjectionScope): ClassDecorat
export function Inject<Values extends unknown[]>(...injections: Injections<Values>): ClassFieldDecorator<Values[number]> {
return (_value, _context) =>
function (this, _initialValue) {
return inject.call(this, ...injections)
return inject.by(this, ...injections)
}
}
2 changes: 1 addition & 1 deletion src/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function inject<Values extends unknown[]>(...injections: Injections<Value
// HACK: workaround with flag --isolatedDeclarations
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace inject {
export function call<Values extends unknown[]>(thisArg: any, ...injections: Injections<Values>): Values[number] {
export function by<Values extends unknown[]>(thisArg: any, ...injections: Injections<Values>): Values[number] {
const context = useResolutionContext()
const token = context?.stack[context.stack.length - 1]
assert(token, ErrorMessage.InjectOutsideOfContext)
Expand Down

0 comments on commit 7afe187

Please sign in to comment.