Index Signatures
An index signature types an object with unknown keys.
Example
const scores: { [name: string]: number } = { ada: 9 };
scores.kofi = 7;
console.log(scores);Result
{
ada: 9,
kofi: 7,
}Exercise
Any string key.
{ [k: ]: number }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.