helper to get tuple index from type