Pretty straightforward question, not sure what I've got wrong syntactically here.
const options: object[] = [
{ value: 0, label: 'Ab' },
{ value: 1, label: 'A' },
{ value: 2, label: 'Bb' },
{ value: 3, label: 'B' },
{ value: 4, label: 'C' },
{ value: 5, label: 'Db' },
{ value: 6, label: 'D' },
{ value: 7, label: 'Eb' },
{ value: 8, label: 'E' },
{ value: 9, label: 'F' },
{ value: 10, label: 'Gb' },
{ value: 11, label: 'G' }
]
console.log(options[1].value)
CodePudding user response:
You need to define an interface for the objects:
interface Item { value: number, label: string };
const options: Item[] = [
...