Back to Type Challenges

README.Pt BR

questions/00005-extreme-readonly-keys/README.pt-BR.md

latest2.1 KB
Original Source
<!--info-header-start--><h1>Get Readonly Keys </h1><blockquote><p>by Anthony Fu <a href="https://github.com/antfu" target="_blank">@antfu</a></p></blockquote><p><a href="https://tsch.js.org/5/play/pt-BR" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

Traduzido pelo Google, abra um PR para ajudar a melhorar a tradução.

Implemente um GetReadonlyKeys<T> genérico que retorne uma união das chaves somente leitura de um Objeto.

Por exemplo

ts
interface Todo {
  readonly title: string
  readonly description: string
  completed: boolean
}

type Keys = GetReadonlyKeys<Todo> // expected to be "title" | "description"
<!--info-footer-start-->

<a href="../../README.pt-BR.md" target="_blank"></a> <a href="https://tsch.js.org/5/answer/pt-BR" target="_blank"></a> <a href="https://tsch.js.org/5/solutions" target="_blank"></a> <!--info-footer-end-->