Why do i encounter 'index signature is missing in type' in typescript?

This error indicates that you're trying to use an object as if it were a dictionary, but TypeScript doesn't know that it can be safely indexed by any string or number.


  let obj = { name: "John" };
  let value = obj["age"];

  let obj: { [key: string]: any } = { name: "John" };
  let value = obj["age"];

Beginner's Guide to TypeScript