[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/037c390af081e9944d616ff298a729515c5c5ab7/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;
assert(isDog(animal), "Expected a dog.");

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