core: refactor checking of imported types