Types for Correct Concurrent API Usage