TypeScript: error TS2693: 'User' only refers to a type, but is being used as a value here.
You used an interface/type alias where a runtime value is needed.
error TS2693: 'User' only refers to a type, but is being used as a value here.only refers to a type, but is being used as a value hereTS2693 only refers to a typets(2693) 'X' only refers to a typeTS2749: 'X' refers to a value, but is being used as a type here. Did you mean 'typeof X'? 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 typethen used as a value- Mixed type/value namespaces
- zod schema vs inferred type confusion
⚡ Quick fix
- Use a class/const object for runtime use
- Write a type guard
function isUser(x: any): x is User - Import the value normally (
import { Schema })
Detailed fix by platform
TypeScript
function isUser(x: unknown): x is User { return typeof x === "object" && x !== null && "id" in x; }
How to diagnose
- Name — Type or value?
- Import — type-only?
- Runtime — Needed?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot find module './App.vue' or its corresponding type declarations TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations.
- TS1005: ';' expected / ',' expected (syntax error) TypeScript: error TS1005: ';' expected.
- TS1128: Declaration or statement expected TypeScript: error TS1128: Declaration or statement expected.
Most viewed in TypeScript
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026