Fix typescript errors related to promises.