mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-22 02:52:07 +08:00
Add LiteralString overloads to path module (#7727)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRichComparisonT
|
||||
from collections.abc import Sequence
|
||||
from typing import overload
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, LiteralString
|
||||
|
||||
__all__ = [
|
||||
"commonprefix",
|
||||
@@ -22,6 +22,8 @@ __all__ = [
|
||||
# Iterable[T], so that list[T] | Literal[""] could be used as a return
|
||||
# type. But because this only works when T is str, we need Sequence[T] instead.
|
||||
@overload
|
||||
def commonprefix(m: Sequence[LiteralString]) -> LiteralString: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[StrPath]) -> str: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ...
|
||||
|
||||
Reference in New Issue
Block a user