Improve promise interface to be type-safe