I have typed my object of objects as:
export interface ObjectInterface {
[key: string]: SomeOtherObjectInterface;
}
Then let's say I have object like:
const obj: ObjectInterface = {
a: ...,
b: ...,
}
Then when I want to access some object property it is not type-safe:
const x = obj.dsdssdsdsds;
There is no error within my IDE.
When I remove type from obj it throws an error properly. What could be done here to use our type but still get errors like Property 'dsds' does not exist on type......
ObjectInterfacethen you lose the type-safety. I don't know what you expected. Typescript is duck-typed so as long as your object conforms to the interface it'll be considered an implementation of the interface.