Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 1.95 KB

File metadata and controls

17 lines (12 loc) · 1.95 KB

Get Readonly Keys extreme #utils #object-keys

by Anthony Fu @antfu

Take the Challenge    简体中文 日本語 한국어 Português (BR)

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"

Back Share your Solutions Check out Solutions