> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# TypedData.encodeType

:::info
`TypedData.encodeType` is a re-export of ox's [`TypedData.encodeType`](https://oxlib.sh/api/TypedData/encodeType). Refer to the ox documentation for the full reference.
:::

Encodes [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) schema for the provided primaryType.

## Imports

```ts
import { TypedData } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { TypedData } from 'viem/utils'

TypedData.encodeType({
  types: {
    Foo: [
      { name: 'address', type: 'address' },
      { name: 'name', type: 'string' },
      { name: 'foo', type: 'string' }
    ]
  },
  primaryType: 'Foo'
})
// @log: 'Foo(address address,string name,string foo)'
```

## Definition

```ts
function encodeType(
  value: encodeType.Value,
): string
```

## Parameters

### value

* **Type:** `encodeType.Value`

The Typed Data schema.

#### value.primaryType

* **Type:** `string`

#### value.types

* **Type:** `abitype.TypedData`

## Return Type

The encoded type.

`string`
