[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Type](https://evolu.dev/docs/api-reference/common/Type) › base

```ts
function base<Name, T, Error>(
  name: Name,
  fromUnknown: (value: unknown) => Result<T, Error>,
): Type<Name, T, T, Error>;
```

Defined in: [packages/common/src/Type.ts:706](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Type.ts#L706)

Base [Type](https://evolu.dev/docs/api-reference/common/Type/interfaces/Type).

A Base Type validates that a value conforms to a specific TypeScript type.

### Example

```ts
const String = base("String", (value) =>
  typeof value === "string"
    ? ok(value)
    : err<StringError>({ type: "String", value }),
);

interface StringError extends TypeError<"String"> {}

const formatStringError = createTypeErrorFormatter<StringError>(
  (error) => `A value ${error.value} is not a string`,
);
```