Type alias ReadonlyKeys<T>

ReadonlyKeys<T>: {
    [P in keyof T]-?: IfEquals<{
        [Q in P]: T[P]
    }, {
        -readonly [Q in P]: T[P]
    }, never, P>
}[keyof T]

找出readonly属性

跟WritableKeys相反

Type Parameters

  • T

Example

type T = ReadonlyKeys<{ readonly a: number; b: string; readonly c: boolean }>; // 'a'|'c'