TS2693
Type used as a runtime value
'User' only refers to a type, but is being used as a value here.The compiler’s own words. Not translated — this is the string you pasted into a search box.
A type alias was referenced in value space, but aliases are erased from the emitted JavaScript.
Reproduction
type User = { id: string } const Ctor = User
The build asserts this emits exactly this code.
Why the compiler says this
TypeScript has parallel type and value namespaces. `type` and `interface` declarations exist only while checking; code that runs needs a class, function, object, or another real JavaScript value.
Fixes
- 01
type User = { id: string } const user: User = { id: 'u1' }
Use the alias in a type position and provide a real value separately.
- 02
class User { constructor(readonly id: string) {} } const user = new User('u1')Use a class when one name must describe both instances and a runtime constructor.
Takeaway
Ask whether the current position survives into JavaScript. If it does, a type-only declaration cannot fill it.
