У меня есть интерфейс:
export interface ITreeViewItem {
getChildren: Promise<ITreeViewItem[]>;
...
и его реализация:
export class MyClass implements ITreeViewItem {
public async getChildren(): Promise<ITreeViewItem[]> {
let result = await this._fileSystemService.getContents(this.fullPath);
let items = result.map(x => {
let y: ITreeViewItem = null;
return y;
});
return items;
}
...
Для меня это выглядит хорошо, но я получаю ошибку:
Типы свойств 'getChildren' несовместимы.
Type '() => Promise' нельзя назначить типу 'Promise'.
Свойство then тогда отсутствует в типе '() => Обещание '.
Что не так с моей реализацией getChildren
?
Я использую TypeScript 2.5.3 .