“Массив TypeScript Object с типами” Ответ

Массив типовой цизки объектов

let userTestStatus: { id: number, name: string }[] = [
    { "id": 0, "name": "Available" },
    { "id": 1, "name": "Ready" },
    { "id": 2, "name": "Started" }
];

userTestStatus[34978].nammme; // Error: Property 'nammme' does not exist on type [...]
Energetic Eland

Массив типовных объектов

// Create an interface that describes your object
interface Car {
  name: string;
  brand: string;
  price: number;
}

// The variable `cars` below has a type of an array of car objects.
let cars: Car[];
peachmangopie

Массив TypeScript Object с типами

type submitionDataType = {
    title: string,
    desc: string,
    decks: Array<{ front: string, back: string }>
}
SamuraiR4cc00n

Ответы похожие на “Массив TypeScript Object с типами”

Вопросы похожие на “Массив TypeScript Object с типами”

Больше похожих ответов на “Массив TypeScript Object с типами” по TypeScript

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

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