Answer the question
In order to leave comments, you need to log in
How to write an interface for an array with objects?
I have a variable activatedPackages , which contains an array containing objects containing key-value pairs (mandatory and optional fields), where the value is always a string:
const activatedPackages = [
{
// обязательные поля
id: 123, // число
activated: true, // булевое
name: '30 days', // строка
// необязательные поля (несколько)
type: 'blablabla' // any
},
{
// обязательные поля
id: 123, // число
activated: true, // булевое
name: '30 days', // строка
// необязательные поля
type: 'blablabla' // any
},
];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question