Add type checking for interval