# IResource.withRelationship

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Defined on: [IResource](/reference/api/typescript/aspire.hosting/iresource.md)
- Version: `13.4.0`
- Kind: `method`

Adds a relationship to another resource using its builder.

## Definition

```typescript
interface IResource {
  // ... omitted for brevity
  withRelationship(
      resourceBuilder: IResource,
      type: string): IResource;
}
```

## Signature

```typescript
withRelationship(
    resourceBuilder: IResource,
    type: string): IResource
```

## Parameters

- `resourceBuilder` ([IResource](/reference/api/typescript/aspire.hosting/iresource.md))
- `type` (`string`)

## Returns

[IResource](/reference/api/typescript/aspire.hosting/iresource.md) `builder`

## Defined on

- [IResource](/reference/api/typescript/aspire.hosting/iresource.md) -- `interface`
