// This defines an interface that only allows values to be numbers
interface INumbersOnly {
[key: string]: number;
}
// when using it, it will check that all properties are numbers
var x: INumbersOnly = {
num: 1, // works fine
str: 'x' // will give a type error
};