Add assertion in `relatedTypes` to catch undefined relations