# TypeScript: error TS2693: 'User' only refers to a type, but is being used as a value here.

**Code:** `TS2693: 'X' only refers to a type, but is being used as a value here` · **Category:** TypeScript · **Seen on:** TypeScript

You used an interface/type alias where a runtime value is needed.

## Meaning

Types disappear at compile time. Use a class, enum or const for runtime values, `typeof`/`keyof typeof` for types of values, or import the runtime value (not `import type`). Example: `instanceof User` needs a class, not an interface; use a type guard function.

## Common causes

- `x instanceof Interface`
- Passing an interface as an argument (`new Foo(User)`)
- `import type` then used as a value
- Mixed type/value namespaces
- zod schema vs inferred type confusion

## Quick fix

1. Use a class/const object for runtime use
2. Write a type guard `function isUser(x: any): x is User`
3. Import the value normally (`import { Schema }`)

## Detailed fix by platform

### TypeScript

1. `function isUser(x: unknown): x is User { return typeof x === "object" && x !== null && "id" in x; }`

## How to diagnose

1. **Name** — Type or value?
2. **Import** — type-only?
3. **Runtime** — Needed?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/typescript/ts2693-only-refers-to-a-type-but-is-being-used-as-a-value)
