type checking for declaration and definition