Fix Type::getMapping from aliased index

As discussed in #588.

That 3rd commit is likely a breaking change. Not sure what the policy on those is, I'll leave it's inclusion to your discretion. (**EDIT**: see comments)