[vector-api] Type checking improvements

This is the part of #1377 that cannot be backported to the `master` branch.