How to install deck railing top board slanted
You'd just slope the 4x4 posts, set the top rails on them, and fit your 2x4 rails underneath. A slight wedge gap would be present, but that's not going to look terrible.
I'd reconsider for a few reasons, though:

You'll need a substantial slope to drain enough water to make a difference. We're talking about beads of water or, at worst, shallow puddling. Both require at least several degrees of slope to eliminate.
This isn't going to substantially extend the life of the rail. Even if it did, replacing just the top rails after 10-15 years might be worth not creating conditions whereby...
You'll eliminate the railing as a drink/dish platform. Don't underestimate the utility of that surface for you and your guests.

I'm in a moist climate and we routinely used 5/4x6 deck boards as top rails. Folks really liked being able to rest dishes and elbows on that wide surface. They didn't rot out any quicker than the hundreds of feet of decking below. A quick squeegee cleans them off after a rain.