Index finger pain. Typing hurts. How to prevent it?

Act. modification. It sounds like you have exertional tendonitis or possibly early so called trigger finger(another type of tendonitis) it could also be arthritis or a number of other diagnosis if activity modification and nsaids don't help i would see your local hand surgeon for an evaluation which should include x-rays.