def _get_type_names(type_hint) -> list[str]:
    """Extract type names from a type hint, handling Union types correctly.

    Args:
        type_hint: The type hint to extract names from

    Returns:
        list[str]: List of type names
    """
    # Handle Union types (both typing.Union and types.UnionType (|))
    if hasattr(type_hint, "__origin__"):
        if type_hint.__origin__ is Union or str(type_hint.__origin__) == "typing.Union":
            return [t.__name__ for t in type_hint.__args__]
        if str(type_hint.__origin__) == "|":  # Python 3.10+ Union type
            return [t.__name__ for t in type_hint.__args__]
        if type_hint.__origin__ is list:
            # For list types, process the inner type
            return _get_type_names(type_hint.__args__[0])
        # Handle other generic types
        return [type_hint.__args__[0].__name__]

    # Handle UnionType at the base level (Python 3.10+ |)
    if str(type(type_hint)) == "<class 'types.UnionType'>":
        return [t.__name__ for t in type_hint.__args__]

    # Handle simple types
    return [type_hint.__name__]
Extract type names from a type hint, handling Union types correctly.

    Args:
        type_hint: The type hint to extract names from

    Returns:
        list[str]: List of type names
    
backend/airweave/platform/db_sync.py