Generalise type validation