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

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Binding](./context.binding.md) &gt; [toAlias](./context.binding.toalias.md)

## Binding.toAlias() method

Bind the key to an alias of another binding

**Signature:**

```typescript
toAlias(keyWithPath: BindingAddress<T>): this;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

keyWithPath


</td><td>

[BindingAddress](./context.bindingaddress.md)<!-- -->&lt;T&gt;


</td><td>

Target binding key with optional path, such as `servers.RestServer.options#apiExplorer`


</td></tr>
</tbody></table>
**Returns:**

this


