unfortunately I have no success with get_post_type() but get_queried_object() helped.
I changed the code to:
function post_type_slug()
{
$post_type = get_queried_object();
$post_type = $post_type->rewrite['slug'];
return $post_type;
}
add_shortcode('pts', 'post_type_slug');
and it’s working in text widget now.