Extract type checks to assertions in mapper