switch order of type token inference to be clearer as per code review