Type Alias ReadonlyPropertyKeys<T>

ReadonlyPropertyKeys: Exclude<keyof T, WritablePropertyKeys<T>>

Produces the property keys of T that do not support assignment.

This includes explicitly readonly properties and getter-only accessors.

Type Parameters

  • T extends object

    Object type to inspect.

interface Example
{
value: number;
readonly id: string;
}

type Keys = ReadonlyPropertyKeys<Example>;
// "id"