# CompactType

> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

[**@midnight-ntwrk/compact-runtime v0.21.0**](https://docs.midnight.network/api-reference/compact-runtime.md)

***

[@midnight-ntwrk/compact-runtime](https://docs.midnight.network/api-reference/compact-runtime/globals.md) / CompactType

# Interface: CompactType\<A>

A runtime representation of a type in Compact

## Type Parameters[​](#type-parameters "Direct link to Type Parameters")

### A[​](#a "Direct link to A")

`A`

## Methods[​](#methods "Direct link to Methods")

### alignment()[​](#alignment "Direct link to alignment()")

```
alignment(): Alignment;
```

The field-aligned binary alignment of this type.

#### Returns[​](#returns "Direct link to Returns")

[`Alignment`](https://docs.midnight.network/api-reference/compact-runtime/type-aliases/Alignment.md)

***

### fromValue()[​](#fromvalue "Direct link to fromValue()")

```
fromValue(value): A;
```

Converts this type's field-aligned binary representation to its TypeScript representation destructively; (partially) consuming the input, and ignoring superflous data for chaining.

#### Parameters[​](#parameters "Direct link to Parameters")

##### value[​](#value "Direct link to value")

[`Value`](https://docs.midnight.network/api-reference/compact-runtime/type-aliases/Value.md)

#### Returns[​](#returns-1 "Direct link to Returns")

`A`

***

### toValue()[​](#tovalue "Direct link to toValue()")

```
toValue(value): Value;
```

Converts this type's TypeScript representation to its field-aligned binary representation

#### Parameters[​](#parameters-1 "Direct link to Parameters")

##### value[​](#value-1 "Direct link to value")

`A`

#### Returns[​](#returns-2 "Direct link to Returns")

[`Value`](https://docs.midnight.network/api-reference/compact-runtime/type-aliases/Value.md)
