Angular: typing promises, deferreds