How to redirect if is post edit or publish page?

For what you want to achieve, using the id instead of post-type should do the job. Try this:

add_action('admin_menu', 'custom_redirect_function');

function custom_redirect_function() {
    $screen = get_current_screen();
    if ( $screen->id == "edit-post" ) {
        wp_redirect( site_url() );
        exit();
    }
}

References: