Coding⏱️ 1 min read📅 2026-06-03

How to Fix: Why does 'instanceof' in TypeScript give me the error "'Foo' only refers to a type, but is being used as a value here."?

Type checking issue with instanceof operator in TypeScript.

Quick Answer: The error occurs because instanceof checks if an object is an instance of a class, not if it has a specific property. Use the 'in' keyword instead to check for properties.

The error 'Foo' only refers to a type, but is being used as a value here

🔍 Why This Happens

    ✅ Best Solutions to Fix It

    Update System Settings

      Alternative Advanced Fix

        🎯 Final Words

        Did this fix your problem?

        If not, try searching for specific error codes.

        🔍 Search Error Database