If you want the post types that have posts, why not get all post types and get a count for each of them (not tested):
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
$count = wp_count_posts( $post_type );
if( $count > 0 ) {
// do something with it
}
}