The error is caused by the fact that the signature is not explicitly defined.
You can explicitly declare index signaturelike this:
let ox : { [index:string] : number } = {};
ox['b'] = 3;
I think the reason is o['a'] = 3;not an error due to rule 1 of accessing the notation properties for brackets, which is defined in the following rules from spec :
- index , ( 3.11.1) , ( ), .
- , , Any, Number , .
- , , Any, String Number , .
- , index Any, String Number , Any.
- .