---
url: 'https://adk.nht.io/api/@nhtio/adk/guards/functions/isInstanceOf.md'
---

# Function: isInstanceOf()

```ts
function isInstanceOf<T>(
  value: unknown,
  type: string,
  ctor?: (...args: any[]) => T,
): value is T;
```

Defined in: [lib/utils/guards.ts:17](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/utils/guards.ts#L17)

Returns `true` if `value` is an instance of the class identified by `type` (and optionally `ctor`).

## Type Parameters

| Type Parameter | Description                 |
| -------------- | --------------------------- |
| `T`            | The expected instance type. |

## Parameters

| Parameter | Type                        | Description                                                                   |
| --------- | --------------------------- | ----------------------------------------------------------------------------- |
| `value`   | `unknown`                   | The value to test.                                                            |
| `type`    | `string`                    | The constructor name to compare against when `instanceof` is unavailable.     |
| `ctor?`   | (...`args`: `any`\[]) => `T` | Optional constructor to use for `instanceof` and `Symbol.hasInstance` checks. |

## Returns

`value is T`

`true` when `value` is an instance of the class described by `type`/`ctor`.

## Remarks

Performs three checks in order: `instanceof ctor`, `Symbol.hasInstance`, then constructor-name
comparison. The constructor-name fallback handles cross-realm cases where `instanceof` fails.
