mirror of
https://github.com/type-challenges/type-challenges.git
synced 2025-12-08 19:06:13 +00:00
Get Readonly Keys

by Anthony Fu @antfu
Implement a generic GetReadonlyKeys<T> that returns a union of the readonly keys of an Object.
For example
interface Todo {
readonly title: string
readonly description: string
completed: boolean
}
type Keys = GetReadonlyKeys<Todo> // expected to be "title" | "description"