typescript check if object implements interface