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.