type-value-space

Identify whether TypeScript symbols reside in type space or value space.

Updated Jul 17, 2017
One-click install
npx skills add https://github.com/luyi985/lyi-bash --skill type-value-space
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-value-space
Source: https://github.com/luyi985/lyi-bash/tree/main/ai/skills/type-value-space
Command: npx skills add https://github.com/luyi985/lyi-bash --skill type-value-space

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Skill helps developers determine whether a symbol is used in Type Space (type-level) or Value Space (runtime), preventing misinterpretations of interfaces, classes, and type aliases.

Core Features & Use Cases

  • Disambiguation guidance: clearly explains when symbols refer to types versus values, with concrete examples.
  • Error-diagnosis assistance: aids in resolving common TypeScript errors caused by mixing type and value semantics.
  • Code analysis support: supports understanding destructuring, typeof, and enum/class behaviors at runtime.

Quick Start

Provide a code snippet, and I will determine for each symbol whether it resides in type space or value space and explain the runtime implications.

Frequently Asked Questions about type-value-space

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the difference between type space and value space in TypeScript?

Type space in TypeScript refers to compile-time type-level definitions like interfaces and type aliases, whereas value space represents runtime entities such as classes, enums, and variables that actually exist during execution.

How do I fix TypeScript errors caused by mixing type and value semantics?

To fix TypeScript errors from mixing type and value semantics, analyze whether the symbol is a compile-time type or a runtime value, then adjust declarations or use typeof to safely reference value-space entities in type positions.

Why does my TypeScript interface disappear at runtime?

Your TypeScript interface disappears at runtime because interfaces exist solely in type space for compile-time checking, meaning they are completely erased during transpilation and leave no trace in the executed JavaScript value space.

How does typeof work with destructuring in TypeScript?

The typeof operator in TypeScript queries a value-space entity to extract its type-space representation, allowing destructured runtime objects to inform compile-time type definitions without duplicating structural property definitions.

Can TypeScript enums exist in both type space and value space?

TypeScript enums exist in both type space and value space simultaneously, functioning as compile-time types for variable annotations while also emitting real runtime JavaScript objects that hold actual values during execution.

What are the limitations of using type aliases in value space contexts?

Limitations of using type aliases in value space contexts include their complete erasure during compilation, meaning they cannot be instantiated, referenced at runtime, or used in JavaScript logic, strictly confining them to type space.