A utility type to retain an unused type parameter T. Similar to phantom type parameters in Rust.

Capturing unused type parameters allows us to define "nominal types," which TypeScript does not natively support. Nominal types in turn allow us to capture semantics not represented in the actual type structure, without requiring us to define new classes or pay additional runtime costs.

For a concrete example, see ByteView, which extends the Uint8Array type to capture type information about the structure of the data encoded into the array.

Type Parameters

  • T

Hierarchy

  • Phantom

Properties

Properties

[Marker]?: T

Generated using TypeDoc