How to express a type that represents an associative array whose keys determine the type of the value?
What happens if I try to get Bar before it has been set? If you expect a compilation error, then you are not talking about a single type, but instead a sequence of types, where the type changes after each call to the set method. Look into 'strong update' and 'linear types'.
Why not just use a record type?
type MyRecord = { Foo : Error, Bar : number }