---
title: "as(_:)"
framework: appintentstesting
role: symbol
role_heading: Instance Method
path: "appintentstesting/dynamicpropertypath/as(_:)-5po1a"
---

# as(_:)

Casts a property to the provided type.

## Declaration

```swift
func `as`<T>(_ type: T.Type) throws -> T where T : IntentValueConvertible
```

## Discussion

Discussion If the value’s type doesn’t match, this method throws an error. let result = try await intent.run() try result.value.as(String.self) == "My Name"
