Well, the attack goes off before the attack hits, not before it actually happens. You can throw up a protect real fast once your opponent has launched a thunderbolt, but you can't do anything about it until it actually happens. Since the reacting pokémon is faster, it may be able to outpace its opponent with a quick, relatively weak attack: "If the opponent uses sleep powder, blow it back in their face with gust" works, but "blow it back in their face with hurricane," not so much. Nothing goes off before the opponent's attack actually happens, but priority attacks and relatively low-powered moves can be launched before it manages to reach its target.actually, I meant more like using the move after waiting to see if the opponent will execute an action, but just before it actually happens.
I'd assume from precedent of magic coat and protect that it would work, but.
also, would a pokémon be able to tell what type the opponent's move would be before it's actually executed?
You mean type as in fire type, water type, etc., or type as in damaging/non-damaging, status/healing, and so on?