---
lang: en
title: 'API docs: metadata.decoratorfactory.mergewithinherited'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/metadata
permalink: /doc/en/lb4/apidocs.metadata.decoratorfactory.mergewithinherited.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/metadata](./metadata.md) &gt; [DecoratorFactory](./metadata.decoratorfactory.md) &gt; [mergeWithInherited](./metadata.decoratorfactory.mergewithinherited.md)

## DecoratorFactory.mergeWithInherited() method

This method is called by the default implementation of the decorator function to merge the spec argument from the decoration with the inherited metadata for a class, all properties, all methods, or all method parameters that are decorated by this decorator.

It MUST be overridden by subclasses to process inherited metadata.

**Signature:**

```typescript
protected mergeWithInherited(inheritedMetadata: M, target: Object, member?: string | symbol, descriptorOrIndex?: TypedPropertyDescriptor<any> | number): M;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

inheritedMetadata


</td><td markdown="1">

M


</td><td markdown="1">

Metadata inherited from the base classes


</td></tr>
<tr><td markdown="1">

target


</td><td markdown="1">

Object


</td><td markdown="1">

Decoration target


</td></tr>
<tr><td markdown="1">

member


</td><td markdown="1">

string \| symbol


</td><td markdown="1">

_(Optional)_ Optional property or method


</td></tr>
<tr><td markdown="1">

descriptorOrIndex


</td><td markdown="1">

TypedPropertyDescriptor&lt;any&gt; \| number


</td><td markdown="1">

_(Optional)_ Optional parameter index or method descriptor


</td></tr>
</tbody></table>

**Returns:**

M


