Description
from typing import assert_type
from msgspec import UnsetType
def f(s: str | UnsetType):
if s:
assert_type(s, str) # this fails
UNSET is the only UnsetType value and bool(UNSET) is False. Therefore the if statement should narrow the type of s to str.