Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function markParameterOrPropertyAsInjected(
target: Object,
member: string | undefined,
methodDescriptorOrParameterIndex?:
| TypedPropertyDescriptor
| number,
) {
if (typeof methodDescriptorOrParameterIndex === 'number') {
// The decorator is applied to a method parameter
// Please note propertyKey is `undefined` for constructor
const paramDecorator: ParameterDecorator = ParameterDecoratorFactory.createDecorator<
Injection
>(
PARAMETERS_KEY,
{
target,
member,
methodDescriptorOrParameterIndex,
bindingSelector,
metadata: injectionMetadata,
resolve,
},
// Do not deep clone the spec as only metadata is mutable and it's
// shallowly cloned
{cloneInputSpec: false, decoratorName: injectionMetadata.decorator},
);
paramDecorator(target, member!, methodDescriptorOrParameterIndex);