← Concepts

The `PropertyKey` Type

In TypeScript, PropertyKey is a global type in TypeScript that represents the data type of a property key. It can be a string, a symbol, or a number.

You don't need to import it into your project - it's available globally.

// string | number | symbol
type Example = PropertyKey;

This can be useful in a sticky situation where you want to create record types with all possible keys:

type RecordWithAllKeys = Record<

Share this TypeScript Concept with your friends