---
title: transform
framework: combine
role: symbol
role_heading: Instance Property
path: combine/publishers/trycompactmap/transform
---

# transform

An error-throwing closure that receives values from the upstream publisher and returns optional values.

## Declaration

```swift
let transform: (Upstream.Output) throws -> Output?
```

## Discussion

Discussion If this closure throws an error, the publisher fails.

## See Also

### Inspecting publisher properties

- [upstream](combine/publishers/trycompactmap/upstream.md)
