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

```ts
function assertThrowsInstanceOf<T>(
  run: () => unknown,
  constructor: T,
): InstanceType<T>;
```

Defined in: [packages/common/src/Assert.ts:466](https://github.com/evoluhq/evolu/blob/ecbac001e0c18bbc45b44715f49ecc3a768c5ec9/packages/common/src/Assert.ts#L466)

Asserts that a function throws an instance of a constructor.

Returns the narrowed instance so additional properties can be asserted
without running the function again.

### Example

```ts

const error = assertThrowsInstanceOf(() => {
  throw new TypeError("Expected a string.");
}, TypeError);
assertEqual(error.message, "Expected a string.");
```