---
url: >-
  https://canary.warp-drive.io/api/@warp-drive/legacy/model/functions/modelFor.md
description: >-
  Legacy `store.modelFor` implementation that returns the `Model` class
  registered for a resource type, if there is one.
---

&#x20;

# &#x20;modelFor()

```ts
function modelFor<T>(type: TypeFromInstance<T>): void | typeof Model;
function modelFor(type: string): void | typeof Model;
```

## Call Signature

```ts
function modelFor<T>(type: TypeFromInstance<T>): void | typeof Model;
```

Defined in: [warp-drive-packages/legacy/src/model/-private/hooks.ts:76](https://github.com/warp-drive-data/warp-drive/blob/48dc0d277b98008082669dadc6a52e5c5682ef8e/warp-drive-packages/legacy/src/model/-private/hooks.ts#L76)

The `modelFor` implementation for use with `Model`, exposed on the store
as `store.modelFor(type)` when the store is configured to use `Model`.
Returns the `Model` subclass registered for the given type, if any.

### Type Parameters

#### T

`T`

### Parameters

#### type

[`TypeFromInstance`](../../../core/types/record/types/TypeFromInstance.md)<`T`>

### Returns

`void` | *typeof* [`Model`](../classes/Model.md)

## Call Signature

```ts
function modelFor(type: string): void | typeof Model;
```

Defined in: [warp-drive-packages/legacy/src/model/-private/hooks.ts:82](https://github.com/warp-drive-data/warp-drive/blob/48dc0d277b98008082669dadc6a52e5c5682ef8e/warp-drive-packages/legacy/src/model/-private/hooks.ts#L82)

Overload accepting a raw type string instead of a typed record instance.

### Parameters

#### type

`string`

### Returns

`void` | *typeof* [`Model`](../classes/Model.md)
