Type Alias ReadonlyDataProperties<T>

ReadonlyDataProperties: Pick<T, ReadonlyDataPropertyKeys<T>>

Projects T to an object containing only its readonly non-callable properties.

Readonly modifiers, optional modifiers, and property value types are preserved.

Type Parameters

  • T extends object

    Object type to project.

interface Example
{
readonly id: string;
readonly created?: Date;
readonly callback: () => void;
value: number;
}

type Result = ReadonlyDataProperties<Example>;

// {
// readonly id: string;
// readonly created?: Date;
// }