为什么长度应该是索引器的子类型?

Why length should be subtype of the indexer?

我在 here 的 TypeScript 手册中看到了一个示例。 我不明白为什么 length 属性 无效?

interface Dictionary {
  [index: string]: string;
  length: number;    // error, the type of 'length' is not a subtype of the indexer
} 

因为x['length']是一个数字,但是你说索引x字符串会产生一个字符串。他们不可能都是真的。