“Типовой выбор” Ответ

TypeScript Keyof

interface Person {
  name: string;
  age: number;
  location: string;
}

type K1 = keyof Person; // "name" | "age" | "location"
type K2 = keyof Person[]; // "length" | "push" | "pop" | "concat" | ...
type K3 = keyof { [x: string]: Person }; // string
SHARKO_MAN

Типовой выбор

interface Tarea {
  titulo: string;
  descripcion: string;
  completado: boolean;
}

type TareaReducido = Pick<Tarea, "titulo" | "descripcion">;

const tarea: TareaReducido = {
  titulo: "Limpiar Recamara",
  descripcion: "Poner en orden todo lo que existe en la recamara",
};
Fancy Fowl

Типы утилит типов слияние интерфейсов

interface A {
    x: string
}

interface B extends Omit<A, 'x'> {
  x: number
}

Ответы похожие на “Типовой выбор”

Вопросы похожие на “Типовой выбор”

Больше похожих ответов на “Типовой выбор” по TypeScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования