Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Document incompatibility between normal interface and indexable type interfaces #978

Open
geoffreyyip opened this issue Feb 27, 2019 · 0 comments

Comments

@geoffreyyip
Copy link

The Person interface cannot be assigned to the Dict interface. According to microsoft/TypeScript#15300, this is intended behavior

However, it is not intuitive behavior and should be documented. The Indexable Interfaces section in the Interfaces page seems like a good place.

interface Dict {
  [index: string]: string;
}

interface Person {
  name: string;
  age: number;
}

const person: Person = { name: "Brendan Elrich", age: 57 };

let y: Dict 
y = person; // error: Index signature is missing in type
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant