Give active class to current page on a while loop WP query for custom post types listing

Assuming you want to add the class to the li element.

<li<?php echo get_queried_object_id() == get_the_ID() ? ' class="active"' : '';?>>