Better explain with example let's say I have :
class Model{
property1: number;
property2: number;
}
let model= new Model;
When I do
model["property1"]="sdaef" // Good ! typescript checks and know it should be number and give error
var test = model.nonExistingProp // throws error since the property does not exist which is good
Now the problem
var test = model["nonExistingProp"]; // NO ERRORS ??
I'm wondering since it is smart enough to know the properties from strings (associative array) and their types why does not throw error like previous example and say nonExistingProp, is there a way to force this kind of type checking on associative array since it already knows the properties and did the check for the type like first example ??
Thanks