export class Foo{
someproperty: string;
}
I am trying to understand why, when trying to access dynamic object property I can do the following as I saw
This is just a convention in TypeScript, available for convenience. If you want to access some arbitrary property that is not defined in the type signature of the object, you can use the ["foo"]
notation, and the type checker will not try to enforce that the instance you're accessing has such a property in its type signature.