Promise only refers to a type error: how to solve it?

When transpiling TypeScript you could get the error:

error TS2585: Promise only refers to a type, but is being used as a var here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.

It's an interesting scenario, since the code below shouldn't be throwing errors.