# Function: routerType()

> 

> **routerType**\<`TRouter`\>(): [`RouterType`](https://trpc.io/docs/typedoc/react-query/index/interfaces/RouterType.md)\<`TRouter`\>

Defined in: packages/client/dist/index.d.mts:134

Passes a router's type to `createTRPCClient({ router })` as a normal
option, instead of a type argument. Nothing about the router exists at
runtime, so it's safe to import the router's type only.

## Type Parameters

| Type Parameter |
| ------ |
| `TRouter` *extends* `AnyRouter` |

## Returns

[`RouterType`](https://trpc.io/docs/typedoc/react-query/index/interfaces/RouterType.md)\<`TRouter`\>

## Example

```ts
const client = createTRPCClient({
  router: routerType<AppRouter>(),
  links: [httpBatchLink({ url: 'http://localhost:3000/trpc' })],
});
```

## See

https://trpc.io/docs/client/vanilla/setup#3-initialize-the-trpc-client
