Would it be better to use TryGetComponent at the DamageSource class?
I used this syntax:
[SerializeField] private int damageAmount = 1;
private void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.TryGetComponent(out EnemyHealth enemyHealth))
{
enemyHealth.TakeDamage(damageAmount);
}
}