Archive page does not connect to Custom Post Type

I have a Custom Post Type with Speaker. I want to create an archive page where all speakers will be displayed. I have created an archive-speaker.php page template. In the admin panel, I created the Speakers Page page and specified the template – archive-speaker.php I connect the styles for each page separately. Right now is_post_type_archive( ‘speaker’ ) doesn’t work. It does not see the archive page. How can this be resolved?

// add styles
if (is_post_type_archive('speaker')) {
  wp_enqueue_style('speakers-styles', get_stylesheet_directory_uri().
    '/styles/speakers_style.css');
}

// Custom Post Type
 register_post_type( 'speaker', 
      array(
        'labels' => array(
        'name' => __( 'Speakers' ),
        'singular_name' => __( 'speaker' )
      ),
       'public' => true,
       'has_archive' => true,
       'rewrite' => array( 'slug' => 'speaker' ),
      )
  );