I want to make an object interface which force to use string as keys, but TypeScript compiler pass codes even if it had a number type as a key. Why?
For example,
interface PriceI {
[key:string]:number;
}
var coursePrice: PriceI = {};
coursePrice["Orange"] = 100;
coursePrice["Apple"] = 200;
coursePrice[3]=200; // It should be compile error, but it pass
coursePrice[true]=300; // It's compile error