How to use the @loopback/metadata.MetadataInspector.getDesignTypeForProperty function in @loopback/metadata

To help you get started, we’ve selected a few @loopback/metadata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-next / packages / context / src / inject.ts View on Github external
export function inspectTargetType(injection: Readonly) {
  let type = MetadataInspector.getDesignTypeForProperty(
    injection.target,
    injection.member!,
  );
  if (type) {
    return type;
  }
  const designType = MetadataInspector.getDesignTypeForMethod(
    injection.target,
    injection.member!,
  );
  type =
    designType.parameterTypes[
      injection.methodDescriptorOrParameterIndex as number
    ];
  return type;
}