enforces type checking for functiondec returns