typecheck in image.js