Может быть, этот небольшой пример кода для скриптов поможет.
private getAccount(id: Id) : Account {
let account = Account.empty();
this.repository.get(id)
.then(res => account = res)
.catch(e => Notices.results(e));
return account;
}
Здесь repository.get(id)
возвращает Promise<Account>
. Я назначаю его переменной account
в инструкции then
.