# convert

Source: https://taxilang.org/docs/language/stdlib/convert

**Full name:** `taxi.stdlib.convert`

## Signature

```taxi
declare extension function <T> convert(source: Any, targetType: lang.taxi.Type<T>): T
```

## Description

Converts a source value to the target type using only the data already available — no service calls are made.

This is faster than a full projection (`source as TargetType`), but less powerful: only the fields present in the source are mapped. Missing fields are not discovered from services.

```taxi
// Convert an Order to a Receipt using only the Order's own fields
find {
   receipt: Receipt = Order.convert(Receipt)
}
```

## Examples

Converts an Order to a Receipt model using only the fields present in the source, without calling any services.

Schema:

```taxi
model Order {
   id: OrderId inherits String
   amount: Amount inherits Decimal
}
model Receipt {
   id: OrderId
   amount: Amount
}
```

Query:

```taxi
given {
   order: Order = { id: 'O1', amount: 99.99 }
}
find {
   receipt: Receipt = Order.convert(Receipt)
}
```

Result:

```json
{
  "receipt": {
    "id": "O1",
    "amount": 99.99
  }
}
```
