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

```ts
type Refinement<A, B> = (a: A) => a is B;
```

Defined in: [packages/common/src/Types.ts:134](https://github.com/evoluhq/evolu/blob/dd96d79f1dbe9a49fa12ce8e0aa7d3d0177795ca/packages/common/src/Types.ts#L134)

A type guard function that refines type `A` to a narrower type `B`.

### Narrowing a value

```ts

interface Animal {
  readonly name: string;
}
interface Dog extends Animal {
  readonly breed: string;
}

const isDog: Refinement<Animal, Dog> = (animal): animal is Dog =>
  "breed" in animal;
const dog: Dog = { name: "Dog", breed: "Beagle" };
const animal: Animal = dog;
assertTrue(isDog(animal));

assertEqual(animal.breed, "Beagle");
```