Fix typescript errors related to promises.

Fix typescript errors related to promises.