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.
📋 Table of Contents
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
🛠️ Related Fixes
How to Fix: Stuck in tutorial hell after 4 years: How do I b
Fix Stuck in tutorial hell after 4 years: How do I bui. Practice build
How to Fix: Trying to sync mutliple audio tracks to a movie
Fix Trying to sync mutliple audio tracks to a movie bu. Consider using
How to Fix: Failed to merge latest branches from upstream re
Fix Failed to merge latest branches from upstream repo. Try running 'g