persona-community-5/.pnpm-store/v3/files/47/8720764b0c3730169acc89be90250b8e2e5cd4460272ff43cfb3f486c1feff2aab85d1e984a32419e8b14e4398d94e19577f6fb94cbd1af9c058c1a72eba66
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

31 lines
647 B
Plaintext

import type {WritableKeysOf} from './writable-keys-of';
/**
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<Entity extends object> = Pick<Entity, ReadonlyKeysOf<Entity>>;
const update1: UpdateResponse<User> = {
id: 123,
};
```
@category Utilities
*/
export type ReadonlyKeysOf<T> =
T extends unknown // For distributing `T`
? Exclude<keyof T, WritableKeysOf<T>>
: never; // Should never happen