The type of the underlaying file does not matter, only the type of the replacing object.
So if you
touch $t/dev; rm $t/dev; touch $t/dev mkdir $t/dev; rmdir $t/ev; touch $t/dev
those succeed, while
touch $t/dev; rm $t/dev; mkdir $t/dev mkdir $t/dev; rm $t/dev; mkdir $t/dev
both fail.
The type of the underlaying file does not matter, only the type of the replacing object.
So if you
touch $t/dev; rm $t/dev; touch $t/dev
mkdir $t/dev; rmdir $t/ev; touch $t/dev
those succeed, while
touch $t/dev; rm $t/dev; mkdir $t/dev
mkdir $t/dev; rm $t/dev; mkdir $t/dev
both fail.