import type {IsReadonlyKeyOf} from './is-readonly-key-of.d.ts'; /** Extract all readonly keys from the given type. This is useful when you want to create a new type that contains readonly keys only. @example ``` import type {ReadonlyKeysOf} from 'type-fest'; interface User { name: string; surname: string; readonly id: number; } type UpdateResponse = Pick>; const update1: UpdateResponse = { id: 123, }; ``` @category Utilities */ export type ReadonlyKeysOf = Type extends unknown // For distributing `Type` ? (keyof {[Key in keyof Type as IsReadonlyKeyOf extends false ? never : Key ]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `ReadonlyKeysOf` is always assignable to `keyof Type` : never; // Should never happen export {};